unplugin-essor 0.0.5 → 0.0.6-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/chunk-IVXV4IDU.js +97 -0
- package/dist/chunk-IVXV4IDU.js.map +1 -0
- package/dist/esbuild.cjs +126 -0
- package/dist/esbuild.cjs.map +1 -0
- package/dist/esbuild.d.cts +7 -0
- package/dist/esbuild.d.ts +7 -0
- package/dist/esbuild.js +11 -0
- package/dist/esbuild.js.map +1 -0
- package/dist/index.cjs +102 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/rollup.cjs +126 -0
- package/dist/rollup.cjs.map +1 -0
- package/dist/rollup.d.cts +7 -0
- package/dist/rollup.d.ts +7 -0
- package/dist/rollup.js +11 -0
- package/dist/rollup.js.map +1 -0
- package/dist/types.cjs +19 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +10 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/vite.cjs +126 -0
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.d.cts +6 -0
- package/dist/vite.d.ts +6 -0
- package/dist/vite.js +11 -0
- package/dist/vite.js.map +1 -0
- package/dist/webpack.cjs +126 -0
- package/dist/webpack.cjs.map +1 -0
- package/dist/webpack.d.cts +7 -0
- package/dist/webpack.d.ts +7 -0
- package/dist/webpack.js +11 -0
- package/dist/webpack.js.map +1 -0
- package/package.json +80 -42
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// src/index.ts
|
|
19
|
+
import { createUnplugin } from "unplugin";
|
|
20
|
+
import * as babel from "@babel/core";
|
|
21
|
+
import essorBabelPlugin from "babel-plugin-essor";
|
|
22
|
+
import { createFilter } from "vite";
|
|
23
|
+
var CSS_EXTENSIONS = [".css", ".scss", ".sass"];
|
|
24
|
+
var DEFAULT_OPTIONS = {
|
|
25
|
+
symbol: "$"
|
|
26
|
+
};
|
|
27
|
+
var unpluginFactory = (options = {}) => {
|
|
28
|
+
const filter = createFilter(options.include, options.exclude);
|
|
29
|
+
return {
|
|
30
|
+
name: "unplugin-essor",
|
|
31
|
+
// enforce: 'pre',
|
|
32
|
+
config() {
|
|
33
|
+
return {
|
|
34
|
+
esbuild: {
|
|
35
|
+
jsx: "preserve"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
transform(code, id) {
|
|
40
|
+
if (["node_modules", "dist", "public"].some((p) => id.includes(p))) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const result = babel.transformSync(code, {
|
|
47
|
+
filename: id,
|
|
48
|
+
sourceMaps: true,
|
|
49
|
+
sourceType: "module",
|
|
50
|
+
plugins: [[essorBabelPlugin, __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), options)]]
|
|
51
|
+
});
|
|
52
|
+
if (result == null ? void 0 : result.code) {
|
|
53
|
+
return {
|
|
54
|
+
code: result.code,
|
|
55
|
+
map: result.map
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return code;
|
|
59
|
+
},
|
|
60
|
+
handleHotUpdate(ctx) {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
for (const mod of ctx.modules) {
|
|
63
|
+
const deps = (_b = (_a = mod.info) == null ? void 0 : _a.meta) == null ? void 0 : _b.deps;
|
|
64
|
+
if (deps && deps.length > 0) {
|
|
65
|
+
for (const dep of deps) {
|
|
66
|
+
const mod2 = ctx.server.moduleGraph.getModuleById(dep);
|
|
67
|
+
if (mod2) {
|
|
68
|
+
ctx.server.moduleGraph.invalidateModule(mod2);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} else if (mod.type === "js" && Array.from(mod.importers).every(
|
|
72
|
+
(m) => m.type === "css" || CSS_EXTENSIONS.some((ext) => {
|
|
73
|
+
var _a2;
|
|
74
|
+
return (_a2 = m.file) == null ? void 0 : _a2.endsWith(ext);
|
|
75
|
+
})
|
|
76
|
+
)) {
|
|
77
|
+
ctx.server.moduleGraph.invalidateAll();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (CSS_EXTENSIONS.some((ext) => ctx.file.endsWith(ext))) {
|
|
81
|
+
ctx.server.ws.send({
|
|
82
|
+
type: "full-reload"
|
|
83
|
+
});
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
var unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
90
|
+
var src_default = unplugin;
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
unpluginFactory,
|
|
94
|
+
unplugin,
|
|
95
|
+
src_default
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=chunk-IVXV4IDU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createUnplugin } from 'unplugin';\nimport * as babel from '@babel/core';\nimport essorBabelPlugin from 'babel-plugin-essor';\nimport { createFilter } from 'vite';\nimport type { UnpluginFactory } from 'unplugin';\nimport type { Options } from './types';\n\nconst CSS_EXTENSIONS = ['.css', '.scss', '.sass'];\n\nconst DEFAULT_OPTIONS = {\n symbol: '$',\n};\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options = {}) => {\n const filter = createFilter(options.include, options.exclude);\n\n return {\n name: 'unplugin-essor',\n // enforce: 'pre',\n config() {\n return {\n esbuild: {\n jsx: 'preserve',\n },\n };\n },\n\n transform(code, id) {\n if (['node_modules', 'dist', 'public'].some(p => id.includes(p))) {\n return;\n }\n //\n if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {\n return null;\n }\n\n const result = babel.transformSync(code, {\n filename: id,\n sourceMaps: true,\n sourceType: 'module',\n plugins: [[essorBabelPlugin, { ...DEFAULT_OPTIONS, ...options }]],\n });\n if (result?.code) {\n return {\n code: result.code,\n map: result.map,\n };\n }\n return code;\n },\n handleHotUpdate(ctx: any) {\n for (const mod of ctx.modules) {\n const deps = mod.info?.meta?.deps;\n if (deps && deps.length > 0) {\n for (const dep of deps) {\n const mod = ctx.server.moduleGraph.getModuleById(dep);\n if (mod) {\n ctx.server.moduleGraph.invalidateModule(mod);\n }\n }\n } else if (\n mod.type === 'js' &&\n Array.from(mod.importers).every(\n (m: any) => m.type === 'css' || CSS_EXTENSIONS.some(ext => m.file?.endsWith(ext)),\n )\n ) {\n // invalidate all modules that import this module\n ctx.server.moduleGraph.invalidateAll();\n }\n }\n\n if (CSS_EXTENSIONS.some(ext => ctx.file.endsWith(ext))) {\n ctx.server.ws.send({\n type: 'full-reload',\n });\n return [];\n }\n },\n };\n};\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory);\n\nexport default unplugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,sBAAsB;AAC/B,YAAY,WAAW;AACvB,OAAO,sBAAsB;AAC7B,SAAS,oBAAoB;AAI7B,IAAM,iBAAiB,CAAC,QAAQ,SAAS,OAAO;AAEhD,IAAM,kBAAkB;AAAA,EACtB,QAAQ;AACV;AAEO,IAAM,kBAAwD,CAAC,UAAU,CAAC,MAAM;AACrF,QAAM,SAAS,aAAa,QAAQ,SAAS,QAAQ,OAAO;AAE5D,SAAO;AAAA,IACL,MAAM;AAAA;AAAA,IAEN,SAAS;AACP,aAAO;AAAA,QACL,SAAS;AAAA,UACP,KAAK;AAAA,QACP;AAAA,MACF;AAAA,IACF;AAAA,IAEA,UAAU,MAAM,IAAI;AAClB,UAAI,CAAC,gBAAgB,QAAQ,QAAQ,EAAE,KAAK,OAAK,GAAG,SAAS,CAAC,CAAC,GAAG;AAChE;AAAA,MACF;AAEA,UAAI,CAAC,OAAO,EAAE,KAAK,CAAC,kBAAkB,KAAK,EAAE,GAAG;AAC9C,eAAO;AAAA,MACT;AAEA,YAAM,SAAe,oBAAc,MAAM;AAAA,QACvC,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,SAAS,CAAC,CAAC,kBAAkB,kCAAK,kBAAoB,QAAS,CAAC;AAAA,MAClE,CAAC;AACD,UAAI,iCAAQ,MAAM;AAChB,eAAO;AAAA,UACL,MAAM,OAAO;AAAA,UACb,KAAK,OAAO;AAAA,QACd;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,IACA,gBAAgB,KAAU;AAlD9B;AAmDM,iBAAW,OAAO,IAAI,SAAS;AAC7B,cAAM,QAAO,eAAI,SAAJ,mBAAU,SAAV,mBAAgB;AAC7B,YAAI,QAAQ,KAAK,SAAS,GAAG;AAC3B,qBAAW,OAAO,MAAM;AACtB,kBAAMA,OAAM,IAAI,OAAO,YAAY,cAAc,GAAG;AACpD,gBAAIA,MAAK;AACP,kBAAI,OAAO,YAAY,iBAAiBA,IAAG;AAAA,YAC7C;AAAA,UACF;AAAA,QACF,WACE,IAAI,SAAS,QACb,MAAM,KAAK,IAAI,SAAS,EAAE;AAAA,UACxB,CAAC,MAAW,EAAE,SAAS,SAAS,eAAe,KAAK,SAAI;AA/DpE,gBAAAC;AA+DuE,oBAAAA,MAAA,EAAE,SAAF,gBAAAA,IAAQ,SAAS;AAAA,WAAI;AAAA,QAClF,GACA;AAEA,cAAI,OAAO,YAAY,cAAc;AAAA,QACvC;AAAA,MACF;AAEA,UAAI,eAAe,KAAK,SAAO,IAAI,KAAK,SAAS,GAAG,CAAC,GAAG;AACtD,YAAI,OAAO,GAAG,KAAK;AAAA,UACjB,MAAM;AAAA,QACR,CAAC;AACD,eAAO,CAAC;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,WAA2B,+BAAe,eAAe;AAEtE,IAAO,cAAQ;","names":["mod","_a"]}
|
package/dist/esbuild.cjs
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
42
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
+
|
|
44
|
+
// src/esbuild.ts
|
|
45
|
+
var esbuild_exports = {};
|
|
46
|
+
__export(esbuild_exports, {
|
|
47
|
+
default: () => esbuild_default
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(esbuild_exports);
|
|
50
|
+
var import_unplugin2 = require("unplugin");
|
|
51
|
+
|
|
52
|
+
// src/index.ts
|
|
53
|
+
var import_unplugin = require("unplugin");
|
|
54
|
+
var babel = __toESM(require("@babel/core"), 1);
|
|
55
|
+
var import_babel_plugin_essor = __toESM(require("babel-plugin-essor"), 1);
|
|
56
|
+
var import_vite = require("vite");
|
|
57
|
+
var CSS_EXTENSIONS = [".css", ".scss", ".sass"];
|
|
58
|
+
var DEFAULT_OPTIONS = {
|
|
59
|
+
symbol: "$"
|
|
60
|
+
};
|
|
61
|
+
var unpluginFactory = (options = {}) => {
|
|
62
|
+
const filter = (0, import_vite.createFilter)(options.include, options.exclude);
|
|
63
|
+
return {
|
|
64
|
+
name: "unplugin-essor",
|
|
65
|
+
// enforce: 'pre',
|
|
66
|
+
config() {
|
|
67
|
+
return {
|
|
68
|
+
esbuild: {
|
|
69
|
+
jsx: "preserve"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
transform(code, id) {
|
|
74
|
+
if (["node_modules", "dist", "public"].some((p) => id.includes(p))) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const result = babel.transformSync(code, {
|
|
81
|
+
filename: id,
|
|
82
|
+
sourceMaps: true,
|
|
83
|
+
sourceType: "module",
|
|
84
|
+
plugins: [[import_babel_plugin_essor.default, __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), options)]]
|
|
85
|
+
});
|
|
86
|
+
if (result == null ? void 0 : result.code) {
|
|
87
|
+
return {
|
|
88
|
+
code: result.code,
|
|
89
|
+
map: result.map
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return code;
|
|
93
|
+
},
|
|
94
|
+
handleHotUpdate(ctx) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
for (const mod of ctx.modules) {
|
|
97
|
+
const deps = (_b = (_a = mod.info) == null ? void 0 : _a.meta) == null ? void 0 : _b.deps;
|
|
98
|
+
if (deps && deps.length > 0) {
|
|
99
|
+
for (const dep of deps) {
|
|
100
|
+
const mod2 = ctx.server.moduleGraph.getModuleById(dep);
|
|
101
|
+
if (mod2) {
|
|
102
|
+
ctx.server.moduleGraph.invalidateModule(mod2);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} else if (mod.type === "js" && Array.from(mod.importers).every(
|
|
106
|
+
(m) => m.type === "css" || CSS_EXTENSIONS.some((ext) => {
|
|
107
|
+
var _a2;
|
|
108
|
+
return (_a2 = m.file) == null ? void 0 : _a2.endsWith(ext);
|
|
109
|
+
})
|
|
110
|
+
)) {
|
|
111
|
+
ctx.server.moduleGraph.invalidateAll();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (CSS_EXTENSIONS.some((ext) => ctx.file.endsWith(ext))) {
|
|
115
|
+
ctx.server.ws.send({
|
|
116
|
+
type: "full-reload"
|
|
117
|
+
});
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// src/esbuild.ts
|
|
125
|
+
var esbuild_default = (0, import_unplugin2.createEsbuildPlugin)(unpluginFactory);
|
|
126
|
+
//# sourceMappingURL=esbuild.cjs.mapexports.default = module.exports;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/esbuild.ts","../src/index.ts"],"sourcesContent":["import { createEsbuildPlugin } from 'unplugin';\nimport { unpluginFactory } from '.';\n\nexport default createEsbuildPlugin(unpluginFactory);\n","import { createUnplugin } from 'unplugin';\nimport * as babel from '@babel/core';\nimport essorBabelPlugin from 'babel-plugin-essor';\nimport { createFilter } from 'vite';\nimport type { UnpluginFactory } from 'unplugin';\nimport type { Options } from './types';\n\nconst CSS_EXTENSIONS = ['.css', '.scss', '.sass'];\n\nconst DEFAULT_OPTIONS = {\n symbol: '$',\n};\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options = {}) => {\n const filter = createFilter(options.include, options.exclude);\n\n return {\n name: 'unplugin-essor',\n // enforce: 'pre',\n config() {\n return {\n esbuild: {\n jsx: 'preserve',\n },\n };\n },\n\n transform(code, id) {\n if (['node_modules', 'dist', 'public'].some(p => id.includes(p))) {\n return;\n }\n //\n if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {\n return null;\n }\n\n const result = babel.transformSync(code, {\n filename: id,\n sourceMaps: true,\n sourceType: 'module',\n plugins: [[essorBabelPlugin, { ...DEFAULT_OPTIONS, ...options }]],\n });\n if (result?.code) {\n return {\n code: result.code,\n map: result.map,\n };\n }\n return code;\n },\n handleHotUpdate(ctx: any) {\n for (const mod of ctx.modules) {\n const deps = mod.info?.meta?.deps;\n if (deps && deps.length > 0) {\n for (const dep of deps) {\n const mod = ctx.server.moduleGraph.getModuleById(dep);\n if (mod) {\n ctx.server.moduleGraph.invalidateModule(mod);\n }\n }\n } else if (\n mod.type === 'js' &&\n Array.from(mod.importers).every(\n (m: any) => m.type === 'css' || CSS_EXTENSIONS.some(ext => m.file?.endsWith(ext)),\n )\n ) {\n // invalidate all modules that import this module\n ctx.server.moduleGraph.invalidateAll();\n }\n }\n\n if (CSS_EXTENSIONS.some(ext => ctx.file.endsWith(ext))) {\n ctx.server.ws.send({\n type: 'full-reload',\n });\n return [];\n }\n },\n };\n};\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory);\n\nexport default unplugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAAoC;;;ACApC,sBAA+B;AAC/B,YAAuB;AACvB,gCAA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K,IAAI,SAAS,EAAE;AAAA,UACxB,CAAC,MAAW,EAAE,SAAS,SAAS,eAAe,KAAK,SAAI;AA/DpE,gBAAAC;AA+DuE,oBAAAA,MAAA,EAAE,SAAF,gBAAAA,IAAQ,SAAS;AAAA,WAAI;AAAA,QAClF,GACA;AAEA,cAAI,OAAO,YAAY,cAAc;AAAA,QACvC;AAAA,MACF;AAEA,UAAI,eAAe,KAAK,SAAO,IAAI,KAAK,SAAS,GAAG,CAAC,GAAG;AACtD,YAAI,OAAO,GAAG,KAAK;AAAA,UACjB,MAAM;AAAA,QACR,CAAC;AACD,eAAO,CAAC;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACF;;;AD5EA,IAAO,sBAAQ,sCAAoB,eAAe;","names":["import_unplugin","essorBabelPlugin","mod","_a"]}
|
package/dist/esbuild.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-IVXV4IDU.js";
|
|
4
|
+
|
|
5
|
+
// src/esbuild.ts
|
|
6
|
+
import { createEsbuildPlugin } from "unplugin";
|
|
7
|
+
var esbuild_default = createEsbuildPlugin(unpluginFactory);
|
|
8
|
+
export {
|
|
9
|
+
esbuild_default as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=esbuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/esbuild.ts"],"sourcesContent":["import { createEsbuildPlugin } from 'unplugin';\nimport { unpluginFactory } from '.';\n\nexport default createEsbuildPlugin(unpluginFactory);\n"],"mappings":";;;;;AAAA,SAAS,2BAA2B;AAGpC,IAAO,kBAAQ,oBAAoB,eAAe;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
6
22
|
var __export = (target, all) => {
|
|
7
23
|
for (var name in all)
|
|
8
24
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,20 +31,99 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
31
|
}
|
|
16
32
|
return to;
|
|
17
33
|
};
|
|
34
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
18
42
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
43
|
|
|
20
44
|
// src/index.ts
|
|
21
45
|
var src_exports = {};
|
|
22
46
|
__export(src_exports, {
|
|
23
|
-
|
|
24
|
-
|
|
47
|
+
default: () => src_default,
|
|
48
|
+
unplugin: () => unplugin,
|
|
49
|
+
unpluginFactory: () => unpluginFactory
|
|
25
50
|
});
|
|
26
51
|
module.exports = __toCommonJS(src_exports);
|
|
27
|
-
var
|
|
28
|
-
var
|
|
52
|
+
var import_unplugin = require("unplugin");
|
|
53
|
+
var babel = __toESM(require("@babel/core"), 1);
|
|
54
|
+
var import_babel_plugin_essor = __toESM(require("babel-plugin-essor"), 1);
|
|
55
|
+
var import_vite = require("vite");
|
|
56
|
+
var CSS_EXTENSIONS = [".css", ".scss", ".sass"];
|
|
57
|
+
var DEFAULT_OPTIONS = {
|
|
58
|
+
symbol: "$"
|
|
59
|
+
};
|
|
60
|
+
var unpluginFactory = (options = {}) => {
|
|
61
|
+
const filter = (0, import_vite.createFilter)(options.include, options.exclude);
|
|
62
|
+
return {
|
|
63
|
+
name: "unplugin-essor",
|
|
64
|
+
// enforce: 'pre',
|
|
65
|
+
config() {
|
|
66
|
+
return {
|
|
67
|
+
esbuild: {
|
|
68
|
+
jsx: "preserve"
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
transform(code, id) {
|
|
73
|
+
if (["node_modules", "dist", "public"].some((p) => id.includes(p))) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const result = babel.transformSync(code, {
|
|
80
|
+
filename: id,
|
|
81
|
+
sourceMaps: true,
|
|
82
|
+
sourceType: "module",
|
|
83
|
+
plugins: [[import_babel_plugin_essor.default, __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), options)]]
|
|
84
|
+
});
|
|
85
|
+
if (result == null ? void 0 : result.code) {
|
|
86
|
+
return {
|
|
87
|
+
code: result.code,
|
|
88
|
+
map: result.map
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return code;
|
|
92
|
+
},
|
|
93
|
+
handleHotUpdate(ctx) {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
for (const mod of ctx.modules) {
|
|
96
|
+
const deps = (_b = (_a = mod.info) == null ? void 0 : _a.meta) == null ? void 0 : _b.deps;
|
|
97
|
+
if (deps && deps.length > 0) {
|
|
98
|
+
for (const dep of deps) {
|
|
99
|
+
const mod2 = ctx.server.moduleGraph.getModuleById(dep);
|
|
100
|
+
if (mod2) {
|
|
101
|
+
ctx.server.moduleGraph.invalidateModule(mod2);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
} else if (mod.type === "js" && Array.from(mod.importers).every(
|
|
105
|
+
(m) => m.type === "css" || CSS_EXTENSIONS.some((ext) => {
|
|
106
|
+
var _a2;
|
|
107
|
+
return (_a2 = m.file) == null ? void 0 : _a2.endsWith(ext);
|
|
108
|
+
})
|
|
109
|
+
)) {
|
|
110
|
+
ctx.server.moduleGraph.invalidateAll();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (CSS_EXTENSIONS.some((ext) => ctx.file.endsWith(ext))) {
|
|
114
|
+
ctx.server.ws.send({
|
|
115
|
+
type: "full-reload"
|
|
116
|
+
});
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
var unplugin = /* @__PURE__ */ (0, import_unplugin.createUnplugin)(unpluginFactory);
|
|
123
|
+
var src_default = unplugin;
|
|
29
124
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
125
|
0 && (module.exports = {
|
|
31
|
-
|
|
32
|
-
|
|
126
|
+
unplugin,
|
|
127
|
+
unpluginFactory
|
|
33
128
|
});
|
|
34
|
-
//# sourceMappingURL=index.cjs.
|
|
129
|
+
//# sourceMappingURL=index.cjs.mapexports.default = module.exports;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createUnplugin } from 'unplugin';\nimport * as babel from '@babel/core';\nimport essorBabelPlugin from 'babel-plugin-essor';\nimport { createFilter } from 'vite';\nimport type { UnpluginFactory } from 'unplugin';\nimport type { Options } from './types';\n\nconst CSS_EXTENSIONS = ['.css', '.scss', '.sass'];\n\nconst DEFAULT_OPTIONS = {\n symbol: '$',\n};\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options = {}) => {\n const filter = createFilter(options.include, options.exclude);\n\n return {\n name: 'unplugin-essor',\n // enforce: 'pre',\n config() {\n return {\n esbuild: {\n jsx: 'preserve',\n },\n };\n },\n\n transform(code, id) {\n if (['node_modules', 'dist', 'public'].some(p => id.includes(p))) {\n return;\n }\n //\n if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {\n return null;\n }\n\n const result = babel.transformSync(code, {\n filename: id,\n sourceMaps: true,\n sourceType: 'module',\n plugins: [[essorBabelPlugin, { ...DEFAULT_OPTIONS, ...options }]],\n });\n if (result?.code) {\n return {\n code: result.code,\n map: result.map,\n };\n }\n return code;\n },\n handleHotUpdate(ctx: any) {\n for (const mod of ctx.modules) {\n const deps = mod.info?.meta?.deps;\n if (deps && deps.length > 0) {\n for (const dep of deps) {\n const mod = ctx.server.moduleGraph.getModuleById(dep);\n if (mod) {\n ctx.server.moduleGraph.invalidateModule(mod);\n }\n }\n } else if (\n mod.type === 'js' &&\n Array.from(mod.importers).every(\n (m: any) => m.type === 'css' || CSS_EXTENSIONS.some(ext => m.file?.endsWith(ext)),\n )\n ) {\n // invalidate all modules that import this module\n ctx.server.moduleGraph.invalidateAll();\n }\n }\n\n if (CSS_EXTENSIONS.some(ext => ctx.file.endsWith(ext))) {\n ctx.server.ws.send({\n type: 'full-reload',\n });\n return [];\n }\n },\n };\n};\n\nexport const unplugin = /* #__PURE__ */ create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AACtB,kBAAMC,OAAM,IAAI,OAAO,YAAY,cAAc,GAAG;AACpD,gBAAIA,MAAK;AACP,kBAAI,OAAO,YAAY,iBAAiBA,IAAG;AAAA,YAC7C;AAAA,UACF;AAAA,QACF,WACE,IAAI,SAAS,QACb,MAAM,KAAK,IAAI,SAAS,EAAE;AAAA,UACxB,CAAC,MAAW,EAAE,SAAS,SAAS,eAAe,KAAK,SAAI;AA/DpE,gBAAAC;AA+DuE,oBAAAA,MAAA,EAAE,SAAF,gBAAAA,IAAQ,SAAS;AAAA,WAAI;AAAA,QAClF,GACA;AAEA,cAAI,OAAO,YAAY,cAAc;AAAA,QACvC;AAAA,MACF;AAEA,UAAI,eAAe,KAAK,SAAO,IAAI,KAAK,SAAS,GAAG,CAAC,GAAG;AACtD,YAAI,OAAO,GAAG,KAAK;AAAA,UACjB,MAAM;AAAA,QACR,CAAC;AACD,eAAO,CAAC;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,WAA2B,oDAAe,eAAe;AAEtE,IAAO,cAAQ;","names":["essorBabelPlugin","mod","_a"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as _unplugin from 'unplugin';
|
|
2
|
+
import { UnpluginFactory } from 'unplugin';
|
|
3
|
+
import { Options } from './types.cjs';
|
|
4
|
+
import 'vite';
|
|
5
|
+
|
|
6
|
+
declare const unpluginFactory: UnpluginFactory<Options | undefined>;
|
|
7
|
+
declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
|
|
8
|
+
|
|
9
|
+
export { unplugin as default, unplugin, unpluginFactory };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as _unplugin from 'unplugin';
|
|
2
|
+
import { UnpluginFactory } from 'unplugin';
|
|
3
|
+
import { Options } from './types.js';
|
|
4
|
+
import 'vite';
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
declare const unpluginFactory: UnpluginFactory<Options | undefined>;
|
|
7
|
+
declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
|
|
8
|
+
|
|
9
|
+
export { unplugin as default, unplugin, unpluginFactory };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
src_default,
|
|
3
|
+
unplugin,
|
|
4
|
+
unpluginFactory
|
|
5
|
+
} from "./chunk-IVXV4IDU.js";
|
|
4
6
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
src_default as default,
|
|
8
|
+
unplugin,
|
|
9
|
+
unpluginFactory
|
|
7
10
|
};
|
|
8
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/rollup.cjs
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
42
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
+
|
|
44
|
+
// src/rollup.ts
|
|
45
|
+
var rollup_exports = {};
|
|
46
|
+
__export(rollup_exports, {
|
|
47
|
+
default: () => rollup_default
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(rollup_exports);
|
|
50
|
+
var import_unplugin2 = require("unplugin");
|
|
51
|
+
|
|
52
|
+
// src/index.ts
|
|
53
|
+
var import_unplugin = require("unplugin");
|
|
54
|
+
var babel = __toESM(require("@babel/core"), 1);
|
|
55
|
+
var import_babel_plugin_essor = __toESM(require("babel-plugin-essor"), 1);
|
|
56
|
+
var import_vite = require("vite");
|
|
57
|
+
var CSS_EXTENSIONS = [".css", ".scss", ".sass"];
|
|
58
|
+
var DEFAULT_OPTIONS = {
|
|
59
|
+
symbol: "$"
|
|
60
|
+
};
|
|
61
|
+
var unpluginFactory = (options = {}) => {
|
|
62
|
+
const filter = (0, import_vite.createFilter)(options.include, options.exclude);
|
|
63
|
+
return {
|
|
64
|
+
name: "unplugin-essor",
|
|
65
|
+
// enforce: 'pre',
|
|
66
|
+
config() {
|
|
67
|
+
return {
|
|
68
|
+
esbuild: {
|
|
69
|
+
jsx: "preserve"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
transform(code, id) {
|
|
74
|
+
if (["node_modules", "dist", "public"].some((p) => id.includes(p))) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const result = babel.transformSync(code, {
|
|
81
|
+
filename: id,
|
|
82
|
+
sourceMaps: true,
|
|
83
|
+
sourceType: "module",
|
|
84
|
+
plugins: [[import_babel_plugin_essor.default, __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), options)]]
|
|
85
|
+
});
|
|
86
|
+
if (result == null ? void 0 : result.code) {
|
|
87
|
+
return {
|
|
88
|
+
code: result.code,
|
|
89
|
+
map: result.map
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return code;
|
|
93
|
+
},
|
|
94
|
+
handleHotUpdate(ctx) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
for (const mod of ctx.modules) {
|
|
97
|
+
const deps = (_b = (_a = mod.info) == null ? void 0 : _a.meta) == null ? void 0 : _b.deps;
|
|
98
|
+
if (deps && deps.length > 0) {
|
|
99
|
+
for (const dep of deps) {
|
|
100
|
+
const mod2 = ctx.server.moduleGraph.getModuleById(dep);
|
|
101
|
+
if (mod2) {
|
|
102
|
+
ctx.server.moduleGraph.invalidateModule(mod2);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} else if (mod.type === "js" && Array.from(mod.importers).every(
|
|
106
|
+
(m) => m.type === "css" || CSS_EXTENSIONS.some((ext) => {
|
|
107
|
+
var _a2;
|
|
108
|
+
return (_a2 = m.file) == null ? void 0 : _a2.endsWith(ext);
|
|
109
|
+
})
|
|
110
|
+
)) {
|
|
111
|
+
ctx.server.moduleGraph.invalidateAll();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (CSS_EXTENSIONS.some((ext) => ctx.file.endsWith(ext))) {
|
|
115
|
+
ctx.server.ws.send({
|
|
116
|
+
type: "full-reload"
|
|
117
|
+
});
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// src/rollup.ts
|
|
125
|
+
var rollup_default = (0, import_unplugin2.createRollupPlugin)(unpluginFactory);
|
|
126
|
+
//# sourceMappingURL=rollup.cjs.mapexports.default = module.exports;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rollup.ts","../src/index.ts"],"sourcesContent":["import { createRollupPlugin } from 'unplugin';\nimport { unpluginFactory } from '.';\n\nexport default createRollupPlugin(unpluginFactory);\n","import { createUnplugin } from 'unplugin';\nimport * as babel from '@babel/core';\nimport essorBabelPlugin from 'babel-plugin-essor';\nimport { createFilter } from 'vite';\nimport type { UnpluginFactory } from 'unplugin';\nimport type { Options } from './types';\n\nconst CSS_EXTENSIONS = ['.css', '.scss', '.sass'];\n\nconst DEFAULT_OPTIONS = {\n symbol: '$',\n};\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options = {}) => {\n const filter = createFilter(options.include, options.exclude);\n\n return {\n name: 'unplugin-essor',\n // enforce: 'pre',\n config() {\n return {\n esbuild: {\n jsx: 'preserve',\n },\n };\n },\n\n transform(code, id) {\n if (['node_modules', 'dist', 'public'].some(p => id.includes(p))) {\n return;\n }\n //\n if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {\n return null;\n }\n\n const result = babel.transformSync(code, {\n filename: id,\n sourceMaps: true,\n sourceType: 'module',\n plugins: [[essorBabelPlugin, { ...DEFAULT_OPTIONS, ...options }]],\n });\n if (result?.code) {\n return {\n code: result.code,\n map: result.map,\n };\n }\n return code;\n },\n handleHotUpdate(ctx: any) {\n for (const mod of ctx.modules) {\n const deps = mod.info?.meta?.deps;\n if (deps && deps.length > 0) {\n for (const dep of deps) {\n const mod = ctx.server.moduleGraph.getModuleById(dep);\n if (mod) {\n ctx.server.moduleGraph.invalidateModule(mod);\n }\n }\n } else if (\n mod.type === 'js' &&\n Array.from(mod.importers).every(\n (m: any) => m.type === 'css' || CSS_EXTENSIONS.some(ext => m.file?.endsWith(ext)),\n )\n ) {\n // invalidate all modules that import this module\n ctx.server.moduleGraph.invalidateAll();\n }\n }\n\n if (CSS_EXTENSIONS.some(ext => ctx.file.endsWith(ext))) {\n ctx.server.ws.send({\n type: 'full-reload',\n });\n return [];\n }\n },\n };\n};\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory);\n\nexport default unplugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAAmC;;;ACAnC,sBAA+B;AAC/B,YAAuB;AACvB,gCAA6B;AAC7B,kBAA6B;AAI7B,IAAM,iBAAiB,CAAC,QAAQ,SAAS,OAAO;AAEhD,IAAM,kBAAkB;AAAA,EACtB,QAAQ;AACV;AAEO,IAAM,kBAAwD,CAAC,UAAU,CAAC,MAAM;AACrF,QAAM,aAAS,0BAAa,QAAQ,SAAS,QAAQ,OAAO;AAE5D,SAAO;AAAA,IACL,MAAM;AAAA;AAAA,IAEN,SA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,SAAO,IAAI,KAAK,SAAS,GAAG,CAAC,GAAG;AACtD,YAAI,OAAO,GAAG,KAAK;AAAA,UACjB,MAAM;AAAA,QACR,CAAC;AACD,eAAO,CAAC;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACF;;;AD5EA,IAAO,qBAAQ,qCAAmB,eAAe;","names":["import_unplugin","essorBabelPlugin","mod","_a"]}
|
package/dist/rollup.d.ts
ADDED
package/dist/rollup.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-IVXV4IDU.js";
|
|
4
|
+
|
|
5
|
+
// src/rollup.ts
|
|
6
|
+
import { createRollupPlugin } from "unplugin";
|
|
7
|
+
var rollup_default = createRollupPlugin(unpluginFactory);
|
|
8
|
+
export {
|
|
9
|
+
rollup_default as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=rollup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rollup.ts"],"sourcesContent":["import { createRollupPlugin } from 'unplugin';\nimport { unpluginFactory } from '.';\n\nexport default createRollupPlugin(unpluginFactory);\n"],"mappings":";;;;;AAAA,SAAS,0BAA0B;AAGnC,IAAO,iBAAQ,mBAAmB,eAAe;","names":[]}
|
package/dist/types.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/types.ts
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
|
19
|
+
//# sourceMappingURL=types.cjs.mapexports.default = module.exports;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { FilterPattern } from 'vite';\nexport interface Options {\n include?: FilterPattern;\n exclude?: FilterPattern;\n ssr?: boolean;\n symbol?: '$';\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/types.d.cts
ADDED
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/vite.cjs
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
42
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
+
|
|
44
|
+
// src/vite.ts
|
|
45
|
+
var vite_exports = {};
|
|
46
|
+
__export(vite_exports, {
|
|
47
|
+
default: () => vite_default
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(vite_exports);
|
|
50
|
+
var import_unplugin2 = require("unplugin");
|
|
51
|
+
|
|
52
|
+
// src/index.ts
|
|
53
|
+
var import_unplugin = require("unplugin");
|
|
54
|
+
var babel = __toESM(require("@babel/core"), 1);
|
|
55
|
+
var import_babel_plugin_essor = __toESM(require("babel-plugin-essor"), 1);
|
|
56
|
+
var import_vite = require("vite");
|
|
57
|
+
var CSS_EXTENSIONS = [".css", ".scss", ".sass"];
|
|
58
|
+
var DEFAULT_OPTIONS = {
|
|
59
|
+
symbol: "$"
|
|
60
|
+
};
|
|
61
|
+
var unpluginFactory = (options = {}) => {
|
|
62
|
+
const filter = (0, import_vite.createFilter)(options.include, options.exclude);
|
|
63
|
+
return {
|
|
64
|
+
name: "unplugin-essor",
|
|
65
|
+
// enforce: 'pre',
|
|
66
|
+
config() {
|
|
67
|
+
return {
|
|
68
|
+
esbuild: {
|
|
69
|
+
jsx: "preserve"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
transform(code, id) {
|
|
74
|
+
if (["node_modules", "dist", "public"].some((p) => id.includes(p))) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const result = babel.transformSync(code, {
|
|
81
|
+
filename: id,
|
|
82
|
+
sourceMaps: true,
|
|
83
|
+
sourceType: "module",
|
|
84
|
+
plugins: [[import_babel_plugin_essor.default, __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), options)]]
|
|
85
|
+
});
|
|
86
|
+
if (result == null ? void 0 : result.code) {
|
|
87
|
+
return {
|
|
88
|
+
code: result.code,
|
|
89
|
+
map: result.map
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return code;
|
|
93
|
+
},
|
|
94
|
+
handleHotUpdate(ctx) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
for (const mod of ctx.modules) {
|
|
97
|
+
const deps = (_b = (_a = mod.info) == null ? void 0 : _a.meta) == null ? void 0 : _b.deps;
|
|
98
|
+
if (deps && deps.length > 0) {
|
|
99
|
+
for (const dep of deps) {
|
|
100
|
+
const mod2 = ctx.server.moduleGraph.getModuleById(dep);
|
|
101
|
+
if (mod2) {
|
|
102
|
+
ctx.server.moduleGraph.invalidateModule(mod2);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} else if (mod.type === "js" && Array.from(mod.importers).every(
|
|
106
|
+
(m) => m.type === "css" || CSS_EXTENSIONS.some((ext) => {
|
|
107
|
+
var _a2;
|
|
108
|
+
return (_a2 = m.file) == null ? void 0 : _a2.endsWith(ext);
|
|
109
|
+
})
|
|
110
|
+
)) {
|
|
111
|
+
ctx.server.moduleGraph.invalidateAll();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (CSS_EXTENSIONS.some((ext) => ctx.file.endsWith(ext))) {
|
|
115
|
+
ctx.server.ws.send({
|
|
116
|
+
type: "full-reload"
|
|
117
|
+
});
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// src/vite.ts
|
|
125
|
+
var vite_default = (0, import_unplugin2.createVitePlugin)(unpluginFactory);
|
|
126
|
+
//# sourceMappingURL=vite.cjs.mapexports.default = module.exports;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vite.ts","../src/index.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin';\nimport { unpluginFactory } from '.';\n\nexport default createVitePlugin(unpluginFactory);\n","import { createUnplugin } from 'unplugin';\nimport * as babel from '@babel/core';\nimport essorBabelPlugin from 'babel-plugin-essor';\nimport { createFilter } from 'vite';\nimport type { UnpluginFactory } from 'unplugin';\nimport type { Options } from './types';\n\nconst CSS_EXTENSIONS = ['.css', '.scss', '.sass'];\n\nconst DEFAULT_OPTIONS = {\n symbol: '$',\n};\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options = {}) => {\n const filter = createFilter(options.include, options.exclude);\n\n return {\n name: 'unplugin-essor',\n // enforce: 'pre',\n config() {\n return {\n esbuild: {\n jsx: 'preserve',\n },\n };\n },\n\n transform(code, id) {\n if (['node_modules', 'dist', 'public'].some(p => id.includes(p))) {\n return;\n }\n //\n if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {\n return null;\n }\n\n const result = babel.transformSync(code, {\n filename: id,\n sourceMaps: true,\n sourceType: 'module',\n plugins: [[essorBabelPlugin, { ...DEFAULT_OPTIONS, ...options }]],\n });\n if (result?.code) {\n return {\n code: result.code,\n map: result.map,\n };\n }\n return code;\n },\n handleHotUpdate(ctx: any) {\n for (const mod of ctx.modules) {\n const deps = mod.info?.meta?.deps;\n if (deps && deps.length > 0) {\n for (const dep of deps) {\n const mod = ctx.server.moduleGraph.getModuleById(dep);\n if (mod) {\n ctx.server.moduleGraph.invalidateModule(mod);\n }\n }\n } else if (\n mod.type === 'js' &&\n Array.from(mod.importers).every(\n (m: any) => m.type === 'css' || CSS_EXTENSIONS.some(ext => m.file?.endsWith(ext)),\n )\n ) {\n // invalidate all modules that import this module\n ctx.server.moduleGraph.invalidateAll();\n }\n }\n\n if (CSS_EXTENSIONS.some(ext => ctx.file.endsWith(ext))) {\n ctx.server.ws.send({\n type: 'full-reload',\n });\n return [];\n }\n },\n };\n};\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory);\n\nexport default unplugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAAiC;;;ACAjC,sBAA+B;AAC/B,YAAuB;AACvB,gCAA6B;AAC7B,kBAA6B;AAI7B,IAAM,iBAAiB,CAAC,QAAQ,SAAS,OAAO;AAEhD,IAAM,kBAAkB;AAAA,EACtB,QAAQ;AACV;AAEO,IAAM,kBAAwD,CAAC,UAAU,CAAC,MAAM;AACrF,QAAM,aAAS,0BAAa,QAAQ,SA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AI,OAAO,YAAY,cAAc;AAAA,QACvC;AAAA,MACF;AAEA,UAAI,eAAe,KAAK,SAAO,IAAI,KAAK,SAAS,GAAG,CAAC,GAAG;AACtD,YAAI,OAAO,GAAG,KAAK;AAAA,UACjB,MAAM;AAAA,QACR,CAAC;AACD,eAAO,CAAC;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACF;;;AD5EA,IAAO,mBAAQ,mCAAiB,eAAe;","names":["import_unplugin","essorBabelPlugin","mod","_a"]}
|
package/dist/vite.d.cts
ADDED
package/dist/vite.d.ts
ADDED
package/dist/vite.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-IVXV4IDU.js";
|
|
4
|
+
|
|
5
|
+
// src/vite.ts
|
|
6
|
+
import { createVitePlugin } from "unplugin";
|
|
7
|
+
var vite_default = createVitePlugin(unpluginFactory);
|
|
8
|
+
export {
|
|
9
|
+
vite_default as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin';\nimport { unpluginFactory } from '.';\n\nexport default createVitePlugin(unpluginFactory);\n"],"mappings":";;;;;AAAA,SAAS,wBAAwB;AAGjC,IAAO,eAAQ,iBAAiB,eAAe;","names":[]}
|
package/dist/webpack.cjs
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
42
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
+
|
|
44
|
+
// src/webpack.ts
|
|
45
|
+
var webpack_exports = {};
|
|
46
|
+
__export(webpack_exports, {
|
|
47
|
+
default: () => webpack_default
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(webpack_exports);
|
|
50
|
+
var import_unplugin2 = require("unplugin");
|
|
51
|
+
|
|
52
|
+
// src/index.ts
|
|
53
|
+
var import_unplugin = require("unplugin");
|
|
54
|
+
var babel = __toESM(require("@babel/core"), 1);
|
|
55
|
+
var import_babel_plugin_essor = __toESM(require("babel-plugin-essor"), 1);
|
|
56
|
+
var import_vite = require("vite");
|
|
57
|
+
var CSS_EXTENSIONS = [".css", ".scss", ".sass"];
|
|
58
|
+
var DEFAULT_OPTIONS = {
|
|
59
|
+
symbol: "$"
|
|
60
|
+
};
|
|
61
|
+
var unpluginFactory = (options = {}) => {
|
|
62
|
+
const filter = (0, import_vite.createFilter)(options.include, options.exclude);
|
|
63
|
+
return {
|
|
64
|
+
name: "unplugin-essor",
|
|
65
|
+
// enforce: 'pre',
|
|
66
|
+
config() {
|
|
67
|
+
return {
|
|
68
|
+
esbuild: {
|
|
69
|
+
jsx: "preserve"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
transform(code, id) {
|
|
74
|
+
if (["node_modules", "dist", "public"].some((p) => id.includes(p))) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const result = babel.transformSync(code, {
|
|
81
|
+
filename: id,
|
|
82
|
+
sourceMaps: true,
|
|
83
|
+
sourceType: "module",
|
|
84
|
+
plugins: [[import_babel_plugin_essor.default, __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), options)]]
|
|
85
|
+
});
|
|
86
|
+
if (result == null ? void 0 : result.code) {
|
|
87
|
+
return {
|
|
88
|
+
code: result.code,
|
|
89
|
+
map: result.map
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return code;
|
|
93
|
+
},
|
|
94
|
+
handleHotUpdate(ctx) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
for (const mod of ctx.modules) {
|
|
97
|
+
const deps = (_b = (_a = mod.info) == null ? void 0 : _a.meta) == null ? void 0 : _b.deps;
|
|
98
|
+
if (deps && deps.length > 0) {
|
|
99
|
+
for (const dep of deps) {
|
|
100
|
+
const mod2 = ctx.server.moduleGraph.getModuleById(dep);
|
|
101
|
+
if (mod2) {
|
|
102
|
+
ctx.server.moduleGraph.invalidateModule(mod2);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} else if (mod.type === "js" && Array.from(mod.importers).every(
|
|
106
|
+
(m) => m.type === "css" || CSS_EXTENSIONS.some((ext) => {
|
|
107
|
+
var _a2;
|
|
108
|
+
return (_a2 = m.file) == null ? void 0 : _a2.endsWith(ext);
|
|
109
|
+
})
|
|
110
|
+
)) {
|
|
111
|
+
ctx.server.moduleGraph.invalidateAll();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (CSS_EXTENSIONS.some((ext) => ctx.file.endsWith(ext))) {
|
|
115
|
+
ctx.server.ws.send({
|
|
116
|
+
type: "full-reload"
|
|
117
|
+
});
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// src/webpack.ts
|
|
125
|
+
var webpack_default = (0, import_unplugin2.createWebpackPlugin)(unpluginFactory);
|
|
126
|
+
//# sourceMappingURL=webpack.cjs.mapexports.default = module.exports;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/webpack.ts","../src/index.ts"],"sourcesContent":["import { createWebpackPlugin } from 'unplugin';\nimport { unpluginFactory } from '.';\n\nexport default createWebpackPlugin(unpluginFactory);\n","import { createUnplugin } from 'unplugin';\nimport * as babel from '@babel/core';\nimport essorBabelPlugin from 'babel-plugin-essor';\nimport { createFilter } from 'vite';\nimport type { UnpluginFactory } from 'unplugin';\nimport type { Options } from './types';\n\nconst CSS_EXTENSIONS = ['.css', '.scss', '.sass'];\n\nconst DEFAULT_OPTIONS = {\n symbol: '$',\n};\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options = {}) => {\n const filter = createFilter(options.include, options.exclude);\n\n return {\n name: 'unplugin-essor',\n // enforce: 'pre',\n config() {\n return {\n esbuild: {\n jsx: 'preserve',\n },\n };\n },\n\n transform(code, id) {\n if (['node_modules', 'dist', 'public'].some(p => id.includes(p))) {\n return;\n }\n //\n if (!filter(id) || !/.[cm]?[jt]sx?$/i.test(id)) {\n return null;\n }\n\n const result = babel.transformSync(code, {\n filename: id,\n sourceMaps: true,\n sourceType: 'module',\n plugins: [[essorBabelPlugin, { ...DEFAULT_OPTIONS, ...options }]],\n });\n if (result?.code) {\n return {\n code: result.code,\n map: result.map,\n };\n }\n return code;\n },\n handleHotUpdate(ctx: any) {\n for (const mod of ctx.modules) {\n const deps = mod.info?.meta?.deps;\n if (deps && deps.length > 0) {\n for (const dep of deps) {\n const mod = ctx.server.moduleGraph.getModuleById(dep);\n if (mod) {\n ctx.server.moduleGraph.invalidateModule(mod);\n }\n }\n } else if (\n mod.type === 'js' &&\n Array.from(mod.importers).every(\n (m: any) => m.type === 'css' || CSS_EXTENSIONS.some(ext => m.file?.endsWith(ext)),\n )\n ) {\n // invalidate all modules that import this module\n ctx.server.moduleGraph.invalidateAll();\n }\n }\n\n if (CSS_EXTENSIONS.some(ext => ctx.file.endsWith(ext))) {\n ctx.server.ws.send({\n type: 'full-reload',\n });\n return [];\n }\n },\n };\n};\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory);\n\nexport default unplugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAAoC;;;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AA,QACF,WACE,IAAI,SAAS,QACb,MAAM,KAAK,IAAI,SAAS,EAAE;AAAA,UACxB,CAAC,MAAW,EAAE,SAAS,SAAS,eAAe,KAAK,SAAI;AA/DpE,gBAAAC;AA+DuE,oBAAAA,MAAA,EAAE,SAAF,gBAAAA,IAAQ,SAAS;AAAA,WAAI;AAAA,QAClF,GACA;AAEA,cAAI,OAAO,YAAY,cAAc;AAAA,QACvC;AAAA,MACF;AAEA,UAAI,eAAe,KAAK,SAAO,IAAI,KAAK,SAAS,GAAG,CAAC,GAAG;AACtD,YAAI,OAAO,GAAG,KAAK;AAAA,UACjB,MAAM;AAAA,QACR,CAAC;AACD,eAAO,CAAC;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACF;;;AD5EA,IAAO,sBAAQ,sCAAoB,eAAe;","names":["import_unplugin","essorBabelPlugin","mod","_a"]}
|
package/dist/webpack.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-IVXV4IDU.js";
|
|
4
|
+
|
|
5
|
+
// src/webpack.ts
|
|
6
|
+
import { createWebpackPlugin } from "unplugin";
|
|
7
|
+
var webpack_default = createWebpackPlugin(unpluginFactory);
|
|
8
|
+
export {
|
|
9
|
+
webpack_default as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=webpack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/webpack.ts"],"sourcesContent":["import { createWebpackPlugin } from 'unplugin';\nimport { unpluginFactory } from '.';\n\nexport default createWebpackPlugin(unpluginFactory);\n"],"mappings":";;;;;AAAA,SAAS,2BAA2B;AAGpC,IAAO,kBAAQ,oBAAoB,eAAe;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,63 +1,101 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-essor",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.0.5",
|
|
5
|
-
"packageManager": "pnpm@7.2.1",
|
|
3
|
+
"version": "0.0.6-beta.10",
|
|
6
4
|
"description": "",
|
|
7
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"unplugin",
|
|
8
|
+
"vite",
|
|
9
|
+
"webpack",
|
|
10
|
+
"rollup",
|
|
11
|
+
"transform"
|
|
12
|
+
],
|
|
8
13
|
"license": "MIT",
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"bugs": "https://github.com/estjs/vipassana/issues",
|
|
16
|
-
"keywords": [],
|
|
17
|
-
"sideEffects": false,
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"main": "dist/index.cjs",
|
|
18
|
+
"module": "dist/index.js",
|
|
19
|
+
"types": "dist/index.d.ts",
|
|
18
20
|
"exports": {
|
|
19
21
|
".": {
|
|
20
22
|
"types": "./dist/index.d.ts",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
}
|
|
23
|
+
"require": "./dist/index.cjs",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./vite": {
|
|
27
|
+
"types": "./dist/vite.d.ts",
|
|
28
|
+
"require": "./dist/vite.cjs",
|
|
29
|
+
"import": "./dist/vite.js"
|
|
30
|
+
},
|
|
31
|
+
"./webpack": {
|
|
32
|
+
"types": "./dist/webpack.d.ts",
|
|
33
|
+
"require": "./dist/webpack.cjs",
|
|
34
|
+
"import": "./dist/webpack.js"
|
|
35
|
+
},
|
|
36
|
+
"./rollup": {
|
|
37
|
+
"types": "./dist/rollup.d.ts",
|
|
38
|
+
"require": "./dist/rollup.cjs",
|
|
39
|
+
"import": "./dist/rollup.js"
|
|
40
|
+
},
|
|
41
|
+
"./esbuild": {
|
|
42
|
+
"types": "./dist/esbuild.d.ts",
|
|
43
|
+
"require": "./dist/esbuild.cjs",
|
|
44
|
+
"import": "./dist/esbuild.js"
|
|
45
|
+
},
|
|
46
|
+
"./types": {
|
|
47
|
+
"types": "./dist/types.d.ts",
|
|
48
|
+
"require": "./dist/types.cjs",
|
|
49
|
+
"import": "./dist/types.js"
|
|
50
|
+
},
|
|
51
|
+
"./*": "./*"
|
|
24
52
|
},
|
|
25
|
-
"main": "./dist/index.mjs",
|
|
26
|
-
"module": "./dist/index.mjs",
|
|
27
|
-
"types": "./dist/index.d.ts",
|
|
28
53
|
"typesVersions": {
|
|
29
54
|
"*": {
|
|
30
55
|
"*": [
|
|
31
56
|
"./dist/*",
|
|
32
|
-
"
|
|
57
|
+
"./*"
|
|
33
58
|
]
|
|
34
59
|
}
|
|
35
60
|
},
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"esbuild": "*",
|
|
63
|
+
"rollup": "^4",
|
|
64
|
+
"vite": ">=3",
|
|
65
|
+
"webpack": "^4 || ^5"
|
|
66
|
+
},
|
|
67
|
+
"peerDependenciesMeta": {
|
|
68
|
+
"esbuild": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"rollup": {
|
|
72
|
+
"optional": true
|
|
73
|
+
},
|
|
74
|
+
"vite": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"webpack": {
|
|
78
|
+
"optional": true
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"dependencies": {
|
|
82
|
+
"@babel/core": "^7.24.6",
|
|
83
|
+
"unplugin": "^1.10.1",
|
|
84
|
+
"babel-plugin-essor": "0.0.6-beta.10"
|
|
85
|
+
},
|
|
39
86
|
"devDependencies": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"vitest": "^0.30.1"
|
|
87
|
+
"fast-glob": "^3.3.2",
|
|
88
|
+
"nodemon": "^3.1.3",
|
|
89
|
+
"rimraf": "^5.0.7",
|
|
90
|
+
"rollup": "^4.18.0",
|
|
91
|
+
"tsup": "^8.1.0",
|
|
92
|
+
"typescript": "^5.4.5",
|
|
93
|
+
"vite": "^5.2.12",
|
|
94
|
+
"webpack": "^5.91.0"
|
|
49
95
|
},
|
|
50
96
|
"scripts": {
|
|
51
|
-
"dev": "tsup --watch",
|
|
52
97
|
"build": "tsup",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"play": "pnpm run -C playground dev",
|
|
56
|
-
"play:build": "pnpm run -C playground build",
|
|
57
|
-
"play:test": "pnpm run -C playground test -u",
|
|
58
|
-
"play:preview": "pnpm run -C playground preview",
|
|
59
|
-
"typecheck": "tsc --noEmit",
|
|
60
|
-
"coverage": "vitest run --coverage",
|
|
61
|
-
"release": " pnpm publish --access public"
|
|
98
|
+
"build:fix": "node ./scripts/postbuild.js",
|
|
99
|
+
"dev": "cross-env NODE_ENV=production tsup --watch"
|
|
62
100
|
}
|
|
63
101
|
}
|