unplugin-isolated-decl 0.6.8 → 0.7.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/README.md +20 -2
- package/dist/api.cjs +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +1 -1
- package/dist/core/ast.d.cts +7 -0
- package/dist/core/ast.d.ts +7 -0
- package/dist/core/options.d.cts +3 -0
- package/dist/core/options.d.ts +3 -0
- package/dist/core/transformer.d.cts +9 -0
- package/dist/core/transformer.d.ts +9 -0
- package/dist/core/utils.d.cts +8 -0
- package/dist/core/utils.d.ts +8 -0
- package/dist/esbuild.cjs +3 -3
- package/dist/esbuild.d.cts +18 -1
- package/dist/esbuild.d.ts +18 -1
- package/dist/esbuild.js +2 -2
- package/dist/farm.cjs +9 -0
- package/dist/farm.d.cts +21 -0
- package/dist/farm.d.ts +21 -0
- package/dist/farm.js +8 -0
- package/dist/index.cjs +3 -4
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +3 -3
- package/dist/rolldown.cjs +3 -3
- package/dist/rolldown.d.cts +19 -1
- package/dist/rolldown.d.ts +19 -1
- package/dist/rolldown.js +2 -2
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.d.cts +19 -1
- package/dist/rollup.d.ts +19 -1
- package/dist/rollup.js +2 -2
- package/dist/{src_index-2WEAOr05.js → src-BatylriB.js} +194 -90
- package/dist/{src_index-NKcZyc90.cjs → src-lcwrBdQD.cjs} +193 -94
- package/dist/vite.cjs +3 -3
- package/dist/vite.d.cts +19 -1
- package/dist/vite.d.ts +19 -1
- package/dist/vite.js +2 -2
- package/package.json +21 -14
- /package/dist/{transformer-uKy0L3Za.cjs → transformer-C4rLQvdl.cjs} +0 -0
- /package/dist/{transformer-w7XvOpWe.js → transformer-DDte86lZ.js} +0 -0
|
@@ -22,14 +22,65 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
|
-
const require_transformer = require('./transformer-
|
|
25
|
+
const require_transformer = require('./transformer-C4rLQvdl.cjs');
|
|
26
26
|
const { mkdir, readFile, writeFile } = __toESM(require("node:fs/promises"));
|
|
27
|
-
const { default: path } = __toESM(require("node:path"));
|
|
27
|
+
const { default: path, default: path$1, default: path$2 } = __toESM(require("node:path"));
|
|
28
28
|
const { createFilter } = __toESM(require("@rollup/pluginutils"));
|
|
29
|
-
const { default: MagicString } = __toESM(require("magic-string"));
|
|
29
|
+
const { default: MagicString, default: MagicString$1 } = __toESM(require("magic-string"));
|
|
30
30
|
const { parseAsync } = __toESM(require("oxc-parser"));
|
|
31
31
|
const { createUnplugin } = __toESM(require("unplugin"));
|
|
32
|
+
const { default: Debug } = __toESM(require("debug"));
|
|
32
33
|
|
|
34
|
+
//#region src/core/utils.ts
|
|
35
|
+
const debug = Debug("unplugin-isolated-decl");
|
|
36
|
+
function lowestCommonAncestor(...filepaths) {
|
|
37
|
+
if (filepaths.length === 0) return "";
|
|
38
|
+
if (filepaths.length === 1) return path$2.dirname(filepaths[0]);
|
|
39
|
+
filepaths = filepaths.map((p) => p.replaceAll("\\", "/"));
|
|
40
|
+
const [first, ...rest] = filepaths;
|
|
41
|
+
let ancestor = first.split("/");
|
|
42
|
+
for (const filepath of rest) {
|
|
43
|
+
const directories = filepath.split("/", ancestor.length);
|
|
44
|
+
let index = 0;
|
|
45
|
+
for (const directory of directories) if (directory === ancestor[index]) index += 1;
|
|
46
|
+
else {
|
|
47
|
+
ancestor = ancestor.slice(0, index);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
ancestor = ancestor.slice(0, index);
|
|
51
|
+
}
|
|
52
|
+
return ancestor.length <= 1 && ancestor[0] === "" ? `/${ancestor[0]}` : ancestor.join("/");
|
|
53
|
+
}
|
|
54
|
+
function stripExt(filename) {
|
|
55
|
+
return filename.replace(/\.(.?)[jt]sx?$/, "");
|
|
56
|
+
}
|
|
57
|
+
function resolveEntry(input) {
|
|
58
|
+
const map = !Array.isArray(input) ? Object.fromEntries(Object.entries(input).map(([k, v]) => [path$2.resolve(stripExt(v)), k])) : undefined;
|
|
59
|
+
const arr = Array.isArray(input) && input ? input : Object.values(input);
|
|
60
|
+
const outBase = lowestCommonAncestor(...arr);
|
|
61
|
+
return {
|
|
62
|
+
map,
|
|
63
|
+
outBase
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/core/ast.ts
|
|
69
|
+
function filterImports(program) {
|
|
70
|
+
return program.body.filter((node) => (node.type === "ImportDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportNamedDeclaration") && !!node.source);
|
|
71
|
+
}
|
|
72
|
+
function patchEntryAlias(source, s, imports, outname, offset) {
|
|
73
|
+
debug("Patching entry alias:", outname, "offset:", offset);
|
|
74
|
+
s ||= new MagicString$1(source);
|
|
75
|
+
for (const i of imports) if (i.source.value[0] === ".") s.overwrite(i.source.start + 1, i.source.end - 1, `./${path$1.join(offset, i.source.value).replaceAll("\\", "/")}`);
|
|
76
|
+
if (s.hasChanged()) {
|
|
77
|
+
debug("Patched entry alias:", outname);
|
|
78
|
+
return s.toString();
|
|
79
|
+
}
|
|
80
|
+
return source;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
33
84
|
//#region src/core/options.ts
|
|
34
85
|
function resolveOptions(options) {
|
|
35
86
|
return {
|
|
@@ -49,34 +100,21 @@ function resolveOptions(options) {
|
|
|
49
100
|
const IsolatedDecl = createUnplugin((rawOptions = {}) => {
|
|
50
101
|
const options = resolveOptions(rawOptions);
|
|
51
102
|
const filter = createFilter(options.include, options.exclude);
|
|
103
|
+
let farmPluginContext;
|
|
52
104
|
const outputFiles = {};
|
|
53
|
-
function addOutput(filename,
|
|
54
|
-
|
|
105
|
+
function addOutput(filename, output) {
|
|
106
|
+
const name = stripExt(filename);
|
|
107
|
+
debug("Add output:", name);
|
|
108
|
+
outputFiles[name] = output;
|
|
55
109
|
}
|
|
56
|
-
const rollup = { renderStart
|
|
57
|
-
|
|
58
|
-
const inputMap = !Array.isArray(input) ? Object.fromEntries(Object.entries(input).map(([k, v]) => [path.resolve(stripExt(v)), k])) : undefined;
|
|
59
|
-
const normalizedInput = Array.isArray(input) ? input : Object.values(input);
|
|
60
|
-
const outBase = lowestCommonAncestor(...normalizedInput);
|
|
61
|
-
if (typeof outputOptions.entryFileNames !== "string") return this.error("entryFileNames must be a string");
|
|
62
|
-
let entryFileNames = outputOptions.entryFileNames.replace(/\.(.)?[jt]sx?$/, (_, s) => `.d.${s || ""}ts`);
|
|
63
|
-
if (options.extraOutdir) entryFileNames = path.join(options.extraOutdir, entryFileNames);
|
|
64
|
-
for (let [outname, source] of Object.entries(outputFiles)) {
|
|
65
|
-
const name = inputMap?.[outname] || path.relative(outBase, outname);
|
|
66
|
-
const fileName = entryFileNames.replace("[name]", name);
|
|
67
|
-
if (options.patchCjsDefaultExport && fileName.endsWith(".d.cts")) source = patchCjsDefaultExport(source);
|
|
68
|
-
this.emitFile({
|
|
69
|
-
type: "asset",
|
|
70
|
-
fileName,
|
|
71
|
-
source
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
} };
|
|
110
|
+
const rollup = { renderStart: rollupRenderStart };
|
|
111
|
+
const farm = { renderStart: { executor: farmRenderStart } };
|
|
75
112
|
return {
|
|
76
113
|
name: "unplugin-isolated-decl",
|
|
77
|
-
|
|
78
|
-
|
|
114
|
+
buildStart() {
|
|
115
|
+
farmPluginContext = this;
|
|
79
116
|
},
|
|
117
|
+
transformInclude: (id) => filter(id),
|
|
80
118
|
transform(code, id) {
|
|
81
119
|
return transform(this, code, id);
|
|
82
120
|
},
|
|
@@ -87,24 +125,12 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
|
|
|
87
125
|
apply: "build",
|
|
88
126
|
enforce: "pre",
|
|
89
127
|
...rollup
|
|
90
|
-
}
|
|
128
|
+
},
|
|
129
|
+
farm
|
|
91
130
|
};
|
|
92
131
|
async function transform(context, code, id) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
program = (await parseAsync(code, { sourceFilename: id })).program;
|
|
96
|
-
} catch {}
|
|
97
|
-
if (options.autoAddExts && program) {
|
|
98
|
-
const imports = program.body.filter((node) => node.type === "ImportDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportNamedDeclaration");
|
|
99
|
-
const s = new MagicString(code);
|
|
100
|
-
for (const i of imports) {
|
|
101
|
-
if (!i.source || path.basename(i.source.value).includes(".")) continue;
|
|
102
|
-
const resolved = await resolve(context, i.source.value, id);
|
|
103
|
-
if (!resolved || resolved.external) continue;
|
|
104
|
-
if (resolved.id.endsWith(".ts") || resolved.id.endsWith(".tsx")) s.overwrite(i.source.start, i.source.end, JSON.stringify(`${i.source.value}.js`));
|
|
105
|
-
}
|
|
106
|
-
code = s.toString();
|
|
107
|
-
}
|
|
132
|
+
const label = debug.enabled && `[${options.transformer}]`;
|
|
133
|
+
debug(label, "transform", id);
|
|
108
134
|
let result;
|
|
109
135
|
switch (options.transformer) {
|
|
110
136
|
case "oxc":
|
|
@@ -115,14 +141,34 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
|
|
|
115
141
|
break;
|
|
116
142
|
case "typescript": result = await require_transformer.tsTransform(id, code, options.transformOptions);
|
|
117
143
|
}
|
|
118
|
-
|
|
144
|
+
let { code: dts, errors } = result;
|
|
145
|
+
debug(label, "transformed", id, errors.length ? "with errors" : "successfully");
|
|
119
146
|
if (errors.length) if (options.ignoreErrors) context.warn(errors[0]);
|
|
120
147
|
else {
|
|
121
148
|
context.error(errors[0]);
|
|
122
149
|
return;
|
|
123
150
|
}
|
|
124
|
-
|
|
125
|
-
|
|
151
|
+
const { program } = await parseAsync(dts, { sourceFilename: id });
|
|
152
|
+
const imports = filterImports(program);
|
|
153
|
+
let s;
|
|
154
|
+
if (options.autoAddExts) {
|
|
155
|
+
s = new MagicString(dts);
|
|
156
|
+
for (const i of imports) {
|
|
157
|
+
if (path.basename(i.source.value).includes(".")) continue;
|
|
158
|
+
const resolved = await resolve(context, i.source.value, id);
|
|
159
|
+
if (!resolved || resolved.external) continue;
|
|
160
|
+
if (resolved.id.endsWith(".ts") || resolved.id.endsWith(".tsx")) {
|
|
161
|
+
i.source.value = `${i.source.value}.js`;
|
|
162
|
+
s.overwrite(i.source.start + 1, i.source.end - 1, i.source.value);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
dts = s.toString();
|
|
166
|
+
}
|
|
167
|
+
addOutput(id, {
|
|
168
|
+
source: dts,
|
|
169
|
+
s,
|
|
170
|
+
imports
|
|
171
|
+
});
|
|
126
172
|
const typeImports = program.body.filter((node) => {
|
|
127
173
|
if (node.type === "ImportDeclaration") {
|
|
128
174
|
if (node.importKind === "type") return true;
|
|
@@ -144,16 +190,73 @@ else {
|
|
|
144
190
|
} catch {
|
|
145
191
|
continue;
|
|
146
192
|
}
|
|
193
|
+
debug("transform type import:", resolved);
|
|
147
194
|
await transform(context, source, resolved);
|
|
148
195
|
}
|
|
149
196
|
}
|
|
150
197
|
}
|
|
198
|
+
function rollupRenderStart(outputOptions, inputOptions) {
|
|
199
|
+
const { input } = inputOptions;
|
|
200
|
+
const { outBase, map } = resolveEntry(input);
|
|
201
|
+
debug("[rollup] out base:", outBase);
|
|
202
|
+
if (typeof outputOptions.entryFileNames !== "string") return this.error("entryFileNames must be a string");
|
|
203
|
+
let entryFileNames = outputOptions.entryFileNames.replace(/\.(.)?[jt]sx?$/, (_, s) => `.d.${s || ""}ts`);
|
|
204
|
+
if (options.extraOutdir) entryFileNames = path.join(options.extraOutdir, entryFileNames);
|
|
205
|
+
for (let [outname, { source, s, imports }] of Object.entries(outputFiles)) {
|
|
206
|
+
const entryAlias = map?.[outname];
|
|
207
|
+
const relativeName = path.relative(outBase, outname);
|
|
208
|
+
const fileName = entryFileNames.replace("[name]", entryAlias || relativeName);
|
|
209
|
+
if (entryAlias && entryAlias !== relativeName) {
|
|
210
|
+
const offset = path.relative(path.dirname(path.resolve(outBase, fileName)), path.dirname(outname));
|
|
211
|
+
source = patchEntryAlias(source, s, imports, outname, offset);
|
|
212
|
+
}
|
|
213
|
+
if (options.patchCjsDefaultExport && fileName.endsWith(".d.cts")) source = patchCjsDefaultExport(source);
|
|
214
|
+
debug("[rollup] emit dts file:", fileName);
|
|
215
|
+
this.emitFile({
|
|
216
|
+
type: "asset",
|
|
217
|
+
fileName,
|
|
218
|
+
source
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function farmRenderStart(config) {
|
|
223
|
+
const { input = {}, output = {} } = config;
|
|
224
|
+
const { outBase, map } = resolveEntry(input);
|
|
225
|
+
debug("[farm] out base:", outBase);
|
|
226
|
+
if (output && typeof output.entryFilename !== "string") return console.error("entryFileName must be a string");
|
|
227
|
+
const extFormatMap = new Map([
|
|
228
|
+
["cjs", "cjs"],
|
|
229
|
+
["esm", "js"],
|
|
230
|
+
["mjs", "js"]
|
|
231
|
+
]);
|
|
232
|
+
output.entryFilename = "[entryName].[ext]";
|
|
233
|
+
output.entryFilename = output.entryFilename.replace("[ext]", extFormatMap.get(output.format || "esm") || "js");
|
|
234
|
+
let entryFileNames = output.entryFilename.replace(/\.(.)?[jt]sx?$/, (_, s) => `.d.${s || ""}ts`);
|
|
235
|
+
if (options.extraOutdir) entryFileNames = path.join(options.extraOutdir, entryFileNames);
|
|
236
|
+
for (let [outname, { source, s, imports }] of Object.entries(outputFiles)) {
|
|
237
|
+
const entryAlias = map?.[outname];
|
|
238
|
+
const relativeName = path.relative(outBase, outname);
|
|
239
|
+
const fileName = entryFileNames.replace("[name]", entryAlias || relativeName);
|
|
240
|
+
if (entryAlias && entryAlias !== relativeName) {
|
|
241
|
+
const offset = path.relative(path.dirname(path.resolve(outBase, fileName)), path.dirname(outname));
|
|
242
|
+
source = patchEntryAlias(source, s, imports, outname, offset);
|
|
243
|
+
}
|
|
244
|
+
if (options.patchCjsDefaultExport && fileName.endsWith(".d.cts")) source = patchCjsDefaultExport(source);
|
|
245
|
+
debug("[farm] emit dts file:", fileName);
|
|
246
|
+
farmPluginContext.emitFile({
|
|
247
|
+
type: "asset",
|
|
248
|
+
fileName,
|
|
249
|
+
source
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
151
253
|
function esbuildSetup(build) {
|
|
152
254
|
build.onEnd(async (result) => {
|
|
153
255
|
const esbuildOptions = build.initialOptions;
|
|
154
256
|
const entries = esbuildOptions.entryPoints;
|
|
155
257
|
if (!(entries && Array.isArray(entries) && entries.every((entry) => typeof entry === "string"))) throw new Error("unsupported entryPoints, must be an string[]");
|
|
156
258
|
const outBase = lowestCommonAncestor(...entries);
|
|
259
|
+
debug("[esbuild] out base:", outBase);
|
|
157
260
|
const jsExt = esbuildOptions.outExtension?.[".js"];
|
|
158
261
|
let outExt;
|
|
159
262
|
switch (jsExt) {
|
|
@@ -172,7 +275,7 @@ else {
|
|
|
172
275
|
if (!build.initialOptions.outdir) throw new Error("outdir is required when write is true");
|
|
173
276
|
} else result.outputFiles ||= [];
|
|
174
277
|
const textEncoder = new TextEncoder();
|
|
175
|
-
for (let [filename, source] of Object.entries(outputFiles)) {
|
|
278
|
+
for (let [filename, { source }] of Object.entries(outputFiles)) {
|
|
176
279
|
const outDir = build.initialOptions.outdir;
|
|
177
280
|
let outFile = `${path.relative(outBase, filename)}.d.${outExt}`;
|
|
178
281
|
if (options.extraOutdir) outFile = path.join(options.extraOutdir, outFile);
|
|
@@ -181,60 +284,61 @@ else {
|
|
|
181
284
|
if (write) {
|
|
182
285
|
await mkdir(path.dirname(filePath), { recursive: true });
|
|
183
286
|
await writeFile(filePath, source);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
287
|
+
debug("[esbuild] write dts file:", filePath);
|
|
288
|
+
} else {
|
|
289
|
+
debug("[esbuild] emit dts file:", filePath);
|
|
290
|
+
result.outputFiles.push({
|
|
291
|
+
path: filePath,
|
|
292
|
+
contents: textEncoder.encode(source),
|
|
293
|
+
hash: "",
|
|
294
|
+
text: source
|
|
295
|
+
});
|
|
296
|
+
}
|
|
190
297
|
}
|
|
191
298
|
});
|
|
192
299
|
}
|
|
193
300
|
});
|
|
194
301
|
async function resolve(context, id, importer) {
|
|
195
302
|
const nativeContext = context.getNativeBuildContext?.();
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
303
|
+
switch (nativeContext?.framework) {
|
|
304
|
+
case "esbuild": {
|
|
305
|
+
const resolved = await nativeContext?.build.resolve(id, {
|
|
306
|
+
importer,
|
|
307
|
+
resolveDir: path.dirname(importer),
|
|
308
|
+
kind: "import-statement"
|
|
309
|
+
});
|
|
310
|
+
return {
|
|
311
|
+
id: resolved?.path,
|
|
312
|
+
external: resolved?.external
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
case "farm": {
|
|
316
|
+
const resolved = await nativeContext?.context.resolve({
|
|
317
|
+
source: id,
|
|
318
|
+
importer,
|
|
319
|
+
kind: "import"
|
|
320
|
+
}, {
|
|
321
|
+
meta: {},
|
|
322
|
+
caller: "unplugin-isolated-decl"
|
|
323
|
+
});
|
|
324
|
+
return {
|
|
325
|
+
id: resolved.resolvedPath,
|
|
326
|
+
external: !!resolved.external
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
default: {
|
|
330
|
+
const resolved = await context.resolve(id, importer);
|
|
331
|
+
if (!resolved) return;
|
|
332
|
+
return {
|
|
333
|
+
id: resolved.id,
|
|
334
|
+
external: !!resolved.external
|
|
335
|
+
};
|
|
336
|
+
}
|
|
206
337
|
}
|
|
207
|
-
const resolved = await context.resolve(id, importer);
|
|
208
|
-
if (!resolved) return;
|
|
209
|
-
return {
|
|
210
|
-
id: resolved.id,
|
|
211
|
-
external: !!resolved.external
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
function stripExt(filename) {
|
|
215
|
-
return filename.replace(/\.(.?)[jt]sx?$/, "");
|
|
216
338
|
}
|
|
217
339
|
function patchCjsDefaultExport(source) {
|
|
218
340
|
return source.replace(/(?<=(?:[;}]|^)\s*export\s*)(?:\{\s*([\w$]+)\s*as\s+default\s*\}|default\s+([\w$]+))/, (_, s1, s2) => `= ${s1 || s2}`);
|
|
219
341
|
}
|
|
220
|
-
function lowestCommonAncestor(...filepaths) {
|
|
221
|
-
if (filepaths.length === 0) return "";
|
|
222
|
-
if (filepaths.length === 1) return path.dirname(filepaths[0]);
|
|
223
|
-
filepaths = filepaths.map((p) => p.replaceAll("\\", "/"));
|
|
224
|
-
const [first, ...rest] = filepaths;
|
|
225
|
-
let ancestor = first.split("/");
|
|
226
|
-
for (const filepath of rest) {
|
|
227
|
-
const directories = filepath.split("/", ancestor.length);
|
|
228
|
-
let index = 0;
|
|
229
|
-
for (const directory of directories) if (directory === ancestor[index]) index += 1;
|
|
230
|
-
else {
|
|
231
|
-
ancestor = ancestor.slice(0, index);
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
ancestor = ancestor.slice(0, index);
|
|
235
|
-
}
|
|
236
|
-
return ancestor.length <= 1 && ancestor[0] === "" ? `/${ancestor[0]}` : ancestor.join("/");
|
|
237
|
-
}
|
|
238
342
|
|
|
239
343
|
//#endregion
|
|
240
344
|
Object.defineProperty(exports, 'IsolatedDecl', {
|
|
@@ -242,9 +346,4 @@ Object.defineProperty(exports, 'IsolatedDecl', {
|
|
|
242
346
|
get: function () {
|
|
243
347
|
return IsolatedDecl;
|
|
244
348
|
}
|
|
245
|
-
});Object.defineProperty(exports, 'lowestCommonAncestor', {
|
|
246
|
-
enumerable: true,
|
|
247
|
-
get: function () {
|
|
248
|
-
return lowestCommonAncestor;
|
|
249
|
-
}
|
|
250
349
|
});
|
package/dist/vite.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
3
|
-
require('./transformer-
|
|
2
|
+
const require_src = require('./src-lcwrBdQD.cjs');
|
|
3
|
+
require('./transformer-C4rLQvdl.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/vite.ts
|
|
6
|
-
var vite_default =
|
|
6
|
+
var vite_default = require_src.IsolatedDecl.vite;
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
module.exports = vite_default;
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This entry file is for Vite plugin.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { IsolatedDecl } from './index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Vite plugin
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // vite.config.js
|
|
13
|
+
* import IsolatedDecl from 'unplugin-isolated-decl/vite'
|
|
14
|
+
*
|
|
15
|
+
* export default {
|
|
16
|
+
* plugins: [IsolatedDecl()],
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
2
20
|
declare const _default: typeof IsolatedDecl.vite;
|
|
3
21
|
export = _default;
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This entry file is for Vite plugin.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { IsolatedDecl } from './index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Vite plugin
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // vite.config.js
|
|
13
|
+
* import IsolatedDecl from 'unplugin-isolated-decl/vite'
|
|
14
|
+
*
|
|
15
|
+
* export default {
|
|
16
|
+
* plugins: [IsolatedDecl()],
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
2
20
|
declare const _default: typeof IsolatedDecl.vite;
|
|
3
21
|
export default _default;
|
package/dist/vite.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-isolated-decl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "A blazing-fast tool for generating isolated declarations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"require": "./dist/esbuild.cjs",
|
|
48
48
|
"import": "./dist/esbuild.js"
|
|
49
49
|
},
|
|
50
|
+
"./farm": {
|
|
51
|
+
"require": "./dist/farm.cjs",
|
|
52
|
+
"import": "./dist/farm.js"
|
|
53
|
+
},
|
|
50
54
|
"./api": {
|
|
51
55
|
"require": "./dist/api.cjs",
|
|
52
56
|
"import": "./dist/api.js"
|
|
@@ -85,30 +89,33 @@
|
|
|
85
89
|
},
|
|
86
90
|
"dependencies": {
|
|
87
91
|
"@rollup/pluginutils": "^5.1.3",
|
|
92
|
+
"debug": "^4.3.7",
|
|
88
93
|
"magic-string": "^0.30.12",
|
|
89
|
-
"oxc-parser": "^0.
|
|
90
|
-
"unplugin": "^1.
|
|
94
|
+
"oxc-parser": "^0.36.0",
|
|
95
|
+
"unplugin": "^1.16.0"
|
|
91
96
|
},
|
|
92
97
|
"devDependencies": {
|
|
93
|
-
"@
|
|
94
|
-
"@
|
|
95
|
-
"@
|
|
98
|
+
"@farmfe/core": "^1.4.1",
|
|
99
|
+
"@oxc-project/types": "^0.36.0",
|
|
100
|
+
"@swc/core": "^1.9.2",
|
|
101
|
+
"@sxzz/eslint-config": "^4.4.1",
|
|
96
102
|
"@sxzz/prettier-config": "^2.0.2",
|
|
97
|
-
"@types/
|
|
98
|
-
"
|
|
103
|
+
"@types/debug": "^4.1.12",
|
|
104
|
+
"@types/node": "^22.9.0",
|
|
105
|
+
"bumpp": "^9.8.1",
|
|
99
106
|
"esbuild": "^0.24.0",
|
|
100
|
-
"eslint": "^9.
|
|
107
|
+
"eslint": "^9.15.0",
|
|
101
108
|
"fast-glob": "^3.3.2",
|
|
102
|
-
"oxc-transform": "^0.
|
|
109
|
+
"oxc-transform": "^0.36.0",
|
|
103
110
|
"prettier": "^3.3.3",
|
|
104
111
|
"rolldown": "nightly",
|
|
105
|
-
"rollup": "^4.
|
|
112
|
+
"rollup": "^4.27.2",
|
|
106
113
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
107
|
-
"tsdown": "^0.
|
|
114
|
+
"tsdown": "^0.3.0",
|
|
108
115
|
"tsx": "^4.19.2",
|
|
109
116
|
"typescript": "^5.6.3",
|
|
110
|
-
"vite": "^5.4.
|
|
111
|
-
"vitest": "^2.1.
|
|
117
|
+
"vite": "^5.4.11",
|
|
118
|
+
"vitest": "^2.1.5"
|
|
112
119
|
},
|
|
113
120
|
"engines": {
|
|
114
121
|
"node": ">=18.12.0"
|
|
File without changes
|
|
File without changes
|