unplugin-essor 0.0.1-beta.1
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 +20 -0
- package/README.md +0 -0
- package/dist/chunk-JHCDFX62.js +97 -0
- package/dist/chunk-JHCDFX62.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 +129 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- 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 +33 -0
- package/dist/types.d.ts +33 -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 +102 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
File without changes
|
|
@@ -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-JHCDFX62.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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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,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,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;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
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-JHCDFX62.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
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
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/index.ts
|
|
45
|
+
var src_exports = {};
|
|
46
|
+
__export(src_exports, {
|
|
47
|
+
default: () => src_default,
|
|
48
|
+
unplugin: () => unplugin,
|
|
49
|
+
unpluginFactory: () => unpluginFactory
|
|
50
|
+
});
|
|
51
|
+
module.exports = __toCommonJS(src_exports);
|
|
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;
|
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
+
0 && (module.exports = {
|
|
126
|
+
unplugin,
|
|
127
|
+
unpluginFactory
|
|
128
|
+
});
|
|
129
|
+
//# sourceMappingURL=index.cjs.mapexports.default = module.exports;
|
|
@@ -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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,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,SAAS;AACP,aAAO;AAAA,QACL,SAAS;AAAA,UACP,KAAK;AAAA,QACP;AAAA,MACF;AAAA,IACF;AAAA,IAEA,UAAU,MAAM,IAAI;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D,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
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as _unplugin from 'unplugin';
|
|
2
|
+
import { UnpluginFactory } from 'unplugin';
|
|
3
|
+
import { Options } from './types.js';
|
|
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.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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;AA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I,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,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-JHCDFX62.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 /**\n * A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, which specifies the files\n * the plugin should operate on.\n */\n include?: FilterPattern;\n /**\n * A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, which specifies the files\n * to be ignored by the plugin.\n */\n exclude?: FilterPattern;\n\n /**\n * This will force SSR code in the produced files. This is experiemental\n * and mostly not working yet.\n *\n * @default false\n */\n ssr?: boolean;\n\n /**\n * This will inject HMR runtime in dev mode. Has no effect in prod. If\n * set to `false`, it won't inject the runtime in dev.\n * @todo\n * @deprecated use `refresh` instead\n * @default true\n */\n hot?: boolean;\n\n symbol?: '$';\n shallowSymbol?: '$$';\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { FilterPattern } from 'vite';
|
|
2
|
+
|
|
3
|
+
interface Options {
|
|
4
|
+
/**
|
|
5
|
+
* A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, which specifies the files
|
|
6
|
+
* the plugin should operate on.
|
|
7
|
+
*/
|
|
8
|
+
include?: FilterPattern;
|
|
9
|
+
/**
|
|
10
|
+
* A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, which specifies the files
|
|
11
|
+
* to be ignored by the plugin.
|
|
12
|
+
*/
|
|
13
|
+
exclude?: FilterPattern;
|
|
14
|
+
/**
|
|
15
|
+
* This will force SSR code in the produced files. This is experiemental
|
|
16
|
+
* and mostly not working yet.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
ssr?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* This will inject HMR runtime in dev mode. Has no effect in prod. If
|
|
23
|
+
* set to `false`, it won't inject the runtime in dev.
|
|
24
|
+
* @todo
|
|
25
|
+
* @deprecated use `refresh` instead
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
hot?: boolean;
|
|
29
|
+
symbol?: '$';
|
|
30
|
+
shallowSymbol?: '$$';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type { Options };
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { FilterPattern } from 'vite';
|
|
2
|
+
|
|
3
|
+
interface Options {
|
|
4
|
+
/**
|
|
5
|
+
* A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, which specifies the files
|
|
6
|
+
* the plugin should operate on.
|
|
7
|
+
*/
|
|
8
|
+
include?: FilterPattern;
|
|
9
|
+
/**
|
|
10
|
+
* A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, which specifies the files
|
|
11
|
+
* to be ignored by the plugin.
|
|
12
|
+
*/
|
|
13
|
+
exclude?: FilterPattern;
|
|
14
|
+
/**
|
|
15
|
+
* This will force SSR code in the produced files. This is experiemental
|
|
16
|
+
* and mostly not working yet.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
ssr?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* This will inject HMR runtime in dev mode. Has no effect in prod. If
|
|
23
|
+
* set to `false`, it won't inject the runtime in dev.
|
|
24
|
+
* @todo
|
|
25
|
+
* @deprecated use `refresh` instead
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
hot?: boolean;
|
|
29
|
+
symbol?: '$';
|
|
30
|
+
shallowSymbol?: '$$';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type { Options };
|
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,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,U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AA,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-JHCDFX62.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;;;ACApC,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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AE,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-JHCDFX62.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
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "unplugin-essor",
|
|
3
|
+
"version": "0.0.1-beta.1",
|
|
4
|
+
"packageManager": "pnpm@8.15.6",
|
|
5
|
+
"description": "",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"unplugin",
|
|
9
|
+
"vite",
|
|
10
|
+
"webpack",
|
|
11
|
+
"rollup",
|
|
12
|
+
"transform"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"main": "dist/index.cjs",
|
|
19
|
+
"module": "dist/index.js",
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"require": "./dist/index.cjs",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./vite": {
|
|
28
|
+
"types": "./dist/vite.d.ts",
|
|
29
|
+
"require": "./dist/vite.cjs",
|
|
30
|
+
"import": "./dist/vite.js"
|
|
31
|
+
},
|
|
32
|
+
"./webpack": {
|
|
33
|
+
"types": "./dist/webpack.d.ts",
|
|
34
|
+
"require": "./dist/webpack.cjs",
|
|
35
|
+
"import": "./dist/webpack.js"
|
|
36
|
+
},
|
|
37
|
+
"./rollup": {
|
|
38
|
+
"types": "./dist/rollup.d.ts",
|
|
39
|
+
"require": "./dist/rollup.cjs",
|
|
40
|
+
"import": "./dist/rollup.js"
|
|
41
|
+
},
|
|
42
|
+
"./esbuild": {
|
|
43
|
+
"types": "./dist/esbuild.d.ts",
|
|
44
|
+
"require": "./dist/esbuild.cjs",
|
|
45
|
+
"import": "./dist/esbuild.js"
|
|
46
|
+
},
|
|
47
|
+
"./types": {
|
|
48
|
+
"types": "./dist/types.d.ts",
|
|
49
|
+
"require": "./dist/types.cjs",
|
|
50
|
+
"import": "./dist/types.js"
|
|
51
|
+
},
|
|
52
|
+
"./*": "./*"
|
|
53
|
+
},
|
|
54
|
+
"typesVersions": {
|
|
55
|
+
"*": {
|
|
56
|
+
"*": [
|
|
57
|
+
"./dist/*",
|
|
58
|
+
"./*"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"esbuild": "*",
|
|
64
|
+
"rollup": "^4",
|
|
65
|
+
"vite": ">=3",
|
|
66
|
+
"webpack": "^4 || ^5"
|
|
67
|
+
},
|
|
68
|
+
"peerDependenciesMeta": {
|
|
69
|
+
"esbuild": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"rollup": {
|
|
73
|
+
"optional": true
|
|
74
|
+
},
|
|
75
|
+
"vite": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"webpack": {
|
|
79
|
+
"optional": true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"@babel/core": "^7.24.3",
|
|
84
|
+
"unplugin": "^1.10.1",
|
|
85
|
+
"babel-plugin-essor": "0.0.1-beta.1"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"fast-glob": "^3.3.2",
|
|
89
|
+
"nodemon": "^3.1.0",
|
|
90
|
+
"rimraf": "^5.0.5",
|
|
91
|
+
"rollup": "^4.13.2",
|
|
92
|
+
"tsup": "^8.0.2",
|
|
93
|
+
"typescript": "^5.4.3",
|
|
94
|
+
"vite": "^5.2.7",
|
|
95
|
+
"webpack": "^5.91.0"
|
|
96
|
+
},
|
|
97
|
+
"scripts": {
|
|
98
|
+
"build": "tsup",
|
|
99
|
+
"build:fix": "node ./scripts/postbuild.js",
|
|
100
|
+
"dev": "cross-env NODE_ENV=production tsup --watch"
|
|
101
|
+
}
|
|
102
|
+
}
|