Skip to content

Commit

Permalink
Update dependencies, including support for Vite v5
Browse files Browse the repository at this point in the history
  • Loading branch information
cmalven committed Nov 21, 2023
1 parent c83e656 commit 63a1bd3
Show file tree
Hide file tree
Showing 7 changed files with 3,572 additions and 687 deletions.
9 changes: 9 additions & 0 deletions dist/index.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Plugin } from 'vite';

interface PluginOptions {
ignorePaths?: string[];
}

declare function sassGlobImports(options?: PluginOptions): Plugin;

export { sassGlobImports as default };
45 changes: 23 additions & 22 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, copyDefault, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return target;
return to;
};
var __toESM = (module2, isNodeMode) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
var __toCommonJS = /* @__PURE__ */ ((cache) => {
return (module2, temp) => {
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
};
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/index.ts
var src_exports = {};
__export(src_exports, {
default: () => sassGlobImports
});
module.exports = __toCommonJS(src_exports);
var import_path = __toESM(require("path"));
var import_fs = __toESM(require("fs"));
var import_glob = __toESM(require("glob"));
var import_minimatch = __toESM(require("minimatch"));
var import_glob = require("glob");
var import_minimatch = require("minimatch");
var import_ansi_colors = __toESM(require("ansi-colors"));
function sassGlobImports(options = {}) {
const FILE_REGEX = /\.s[c|a]ss(\?direct)?$/;
Expand All @@ -58,9 +60,10 @@ function sassGlobImports(options = {}) {
let basePath = "";
for (let i2 = 0; i2 < searchBases.length; i2++) {
basePath = searchBases[i2];
files = import_glob.default.sync(import_path.default.join(basePath, globPattern), {
files = (0, import_glob.globSync)(import_path.default.join(basePath, globPattern), {
cwd: "./"
});
files.sort();
const globPatternWithoutWildcard = globPattern.split("*")[0];
if (globPatternWithoutWildcard.length) {
const directoryExists = import_fs.default.existsSync(import_path.default.join(basePath, globPatternWithoutWildcard));
Expand All @@ -78,7 +81,7 @@ function sassGlobImports(options = {}) {
filename = import_path.default.relative(basePath, filename).replace(/\\/g, "/");
filename = filename.replace(/^\//, "");
if (!ignorePaths.some((ignorePath) => {
return (0, import_minimatch.default)(filename, ignorePath);
return (0, import_minimatch.minimatch)(filename, ignorePath);
})) {
imports.push(`@${importType} "` + filename + '"' + (isSass ? "" : ";"));
}
Expand All @@ -103,6 +106,7 @@ function sassGlobImports(options = {}) {
let result = {
code: src,
map: null
// provide source map if available
};
if (FILE_REGEX.test(id)) {
fileName = import_path.default.basename(id);
Expand All @@ -113,6 +117,3 @@ function sassGlobImports(options = {}) {
}
};
}
module.exports = __toCommonJS(src_exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
8 changes: 5 additions & 3 deletions dist/index.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// src/index.ts
import path from "path";
import fs from "fs";
import glob from "glob";
import minimatch from "minimatch";
import { globSync } from "glob";
import { minimatch } from "minimatch";
import c from "ansi-colors";
function sassGlobImports(options = {}) {
const FILE_REGEX = /\.s[c|a]ss(\?direct)?$/;
Expand All @@ -26,9 +26,10 @@ function sassGlobImports(options = {}) {
let basePath = "";
for (let i2 = 0; i2 < searchBases.length; i2++) {
basePath = searchBases[i2];
files = glob.sync(path.join(basePath, globPattern), {
files = globSync(path.join(basePath, globPattern), {
cwd: "./"
});
files.sort();
const globPatternWithoutWildcard = globPattern.split("*")[0];
if (globPatternWithoutWildcard.length) {
const directoryExists = fs.existsSync(path.join(basePath, globPatternWithoutWildcard));
Expand Down Expand Up @@ -71,6 +72,7 @@ function sassGlobImports(options = {}) {
let result = {
code: src,
map: null
// provide source map if available
};
if (FILE_REGEX.test(id)) {
fileName = path.basename(id);
Expand Down
Loading

0 comments on commit 63a1bd3

Please sign in to comment.