fortiplugin-bundle-adapter 0.0.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 +674 -0
- package/README.md +405 -0
- package/dist/index.cjs +346 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +52 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.mjs +309 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +52 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
// src/vite/prep.ts
|
|
2
|
+
import { transformSync } from "@babel/core";
|
|
3
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
4
|
+
import { dirname, resolve as resolvePath } from "path";
|
|
5
|
+
|
|
6
|
+
// src/babel/transform.ts
|
|
7
|
+
import * as t from "@babel/types";
|
|
8
|
+
var DEFAULTS = {
|
|
9
|
+
runtimeKey: "imports",
|
|
10
|
+
depsParam: "deps"
|
|
11
|
+
};
|
|
12
|
+
var DEFAULT_EXPORT_ERROR = "PROBLEM!!, No known default function was found, your code either possesses NO named default export or this export format is currently not supported.";
|
|
13
|
+
function shouldInject(id, opts) {
|
|
14
|
+
const ids = opts.injectedIds ?? [];
|
|
15
|
+
const prefixes = opts.injectedPrefixes ?? [];
|
|
16
|
+
if (ids.includes(id)) return true;
|
|
17
|
+
for (const p of prefixes) if (id.startsWith(p)) return true;
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
function getImportedName(spec) {
|
|
21
|
+
return t.isIdentifier(spec.imported) ? spec.imported.name : spec.imported.value;
|
|
22
|
+
}
|
|
23
|
+
function makeImportMapExpr(depsIdent, runtimeKey) {
|
|
24
|
+
const hasKey = t.binaryExpression(
|
|
25
|
+
"in",
|
|
26
|
+
t.stringLiteral(runtimeKey),
|
|
27
|
+
depsIdent
|
|
28
|
+
);
|
|
29
|
+
const isObj = t.logicalExpression(
|
|
30
|
+
"&&",
|
|
31
|
+
t.binaryExpression("!==", depsIdent, t.nullLiteral()),
|
|
32
|
+
t.binaryExpression("===", t.unaryExpression("typeof", depsIdent), t.stringLiteral("object"))
|
|
33
|
+
);
|
|
34
|
+
const test = t.logicalExpression("&&", isObj, hasKey);
|
|
35
|
+
const depsKey = t.memberExpression(depsIdent, t.identifier(runtimeKey));
|
|
36
|
+
const fallback = t.logicalExpression("||", depsIdent, t.objectExpression([]));
|
|
37
|
+
return t.conditionalExpression(test, depsKey, fallback);
|
|
38
|
+
}
|
|
39
|
+
function fortiPrepTransform(_api, rawOpts = {}) {
|
|
40
|
+
const opts = {
|
|
41
|
+
...rawOpts,
|
|
42
|
+
runtimeKey: rawOpts.runtimeKey ?? DEFAULTS.runtimeKey,
|
|
43
|
+
depsParam: rawOpts.depsParam ?? DEFAULTS.depsParam
|
|
44
|
+
};
|
|
45
|
+
const keptImports = [];
|
|
46
|
+
const keptNamedExports = [];
|
|
47
|
+
const injectedImportsById = /* @__PURE__ */ new Map();
|
|
48
|
+
let defaultExportLocalName = null;
|
|
49
|
+
let returnDefaultProperty = false;
|
|
50
|
+
function captureImport(importId, entry) {
|
|
51
|
+
const list = injectedImportsById.get(importId) ?? [];
|
|
52
|
+
list.push(entry);
|
|
53
|
+
injectedImportsById.set(importId, list);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
name: "fortiplugin-prep/transform",
|
|
57
|
+
visitor: {
|
|
58
|
+
ImportDeclaration(path) {
|
|
59
|
+
const node = path.node;
|
|
60
|
+
const importId = node.source.value;
|
|
61
|
+
if (!shouldInject(importId, opts)) {
|
|
62
|
+
keptImports.push(node);
|
|
63
|
+
path.remove();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
for (const s of node.specifiers) {
|
|
67
|
+
if (t.isImportDefaultSpecifier(s)) {
|
|
68
|
+
captureImport(importId, { kind: "default", local: s.local.name });
|
|
69
|
+
} else if (t.isImportNamespaceSpecifier(s)) {
|
|
70
|
+
captureImport(importId, { kind: "namespace", local: s.local.name });
|
|
71
|
+
} else if (t.isImportSpecifier(s)) {
|
|
72
|
+
captureImport(importId, {
|
|
73
|
+
kind: "named",
|
|
74
|
+
imported: getImportedName(s),
|
|
75
|
+
local: s.local.name
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
path.remove();
|
|
80
|
+
},
|
|
81
|
+
ExportDefaultDeclaration(path) {
|
|
82
|
+
const decl = path.node.declaration;
|
|
83
|
+
if (t.isIdentifier(decl)) {
|
|
84
|
+
defaultExportLocalName = decl.name;
|
|
85
|
+
path.remove();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const id = path.scope.generateUidIdentifier("defaultExport");
|
|
89
|
+
path.replaceWith(
|
|
90
|
+
t.variableDeclaration("const", [t.variableDeclarator(id, decl)])
|
|
91
|
+
);
|
|
92
|
+
defaultExportLocalName = id.name;
|
|
93
|
+
},
|
|
94
|
+
ExportNamedDeclaration(path) {
|
|
95
|
+
const node = path.node;
|
|
96
|
+
keptNamedExports.push(node);
|
|
97
|
+
if (node.specifiers?.length) {
|
|
98
|
+
let foundExplicitDefault = false;
|
|
99
|
+
node.specifiers = node.specifiers.filter((spec) => {
|
|
100
|
+
const exported = t.isIdentifier(spec.exported) ? spec.exported.name : spec.exported.value;
|
|
101
|
+
if (exported === "default") {
|
|
102
|
+
const local = spec?.local?.name;
|
|
103
|
+
if (local) defaultExportLocalName = local;
|
|
104
|
+
foundExplicitDefault = true;
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
});
|
|
109
|
+
if (!foundExplicitDefault && !defaultExportLocalName && node.specifiers.length === 1) {
|
|
110
|
+
const only = node.specifiers[0];
|
|
111
|
+
if (only?.local?.name) {
|
|
112
|
+
defaultExportLocalName = only.local.name;
|
|
113
|
+
returnDefaultProperty = true;
|
|
114
|
+
node.specifiers = [];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
path.remove();
|
|
119
|
+
},
|
|
120
|
+
Program: {
|
|
121
|
+
exit(path) {
|
|
122
|
+
const program = path.node;
|
|
123
|
+
if (!defaultExportLocalName) {
|
|
124
|
+
throw path.buildCodeFrameError(DEFAULT_EXPORT_ERROR);
|
|
125
|
+
}
|
|
126
|
+
const depsIdent = t.identifier(opts.depsParam ?? DEFAULTS.depsParam);
|
|
127
|
+
const runtimeKey = opts.runtimeKey ?? DEFAULTS.runtimeKey;
|
|
128
|
+
const importsIdent = t.identifier("__imports");
|
|
129
|
+
const importsInit = makeImportMapExpr(depsIdent, runtimeKey);
|
|
130
|
+
const importsDecl = t.variableDeclaration("const", [
|
|
131
|
+
t.variableDeclarator(importsIdent, importsInit)
|
|
132
|
+
]);
|
|
133
|
+
const defaultHelperIdent = t.identifier("__default");
|
|
134
|
+
const defaultHelperDecl = t.variableDeclaration("const", [
|
|
135
|
+
t.variableDeclarator(
|
|
136
|
+
defaultHelperIdent,
|
|
137
|
+
t.arrowFunctionExpression(
|
|
138
|
+
[t.identifier("m")],
|
|
139
|
+
t.conditionalExpression(
|
|
140
|
+
t.logicalExpression(
|
|
141
|
+
"&&",
|
|
142
|
+
t.logicalExpression(
|
|
143
|
+
"&&",
|
|
144
|
+
t.identifier("m"),
|
|
145
|
+
t.binaryExpression(
|
|
146
|
+
"===",
|
|
147
|
+
t.unaryExpression("typeof", t.identifier("m")),
|
|
148
|
+
t.stringLiteral("object")
|
|
149
|
+
)
|
|
150
|
+
),
|
|
151
|
+
t.binaryExpression("in", t.stringLiteral("default"), t.identifier("m"))
|
|
152
|
+
),
|
|
153
|
+
t.memberExpression(t.identifier("m"), t.identifier("default")),
|
|
154
|
+
t.identifier("m")
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
)
|
|
158
|
+
]);
|
|
159
|
+
const injectedStmts = [importsDecl, defaultHelperDecl];
|
|
160
|
+
for (const [importId, specs] of injectedImportsById.entries()) {
|
|
161
|
+
const modIdent = t.identifier(
|
|
162
|
+
`__m_${importId.replace(/[^a-zA-Z0-9_$]/g, "_")}`
|
|
163
|
+
);
|
|
164
|
+
injectedStmts.push(
|
|
165
|
+
t.variableDeclaration("const", [
|
|
166
|
+
t.variableDeclarator(
|
|
167
|
+
modIdent,
|
|
168
|
+
t.memberExpression(importsIdent, t.stringLiteral(importId), true)
|
|
169
|
+
)
|
|
170
|
+
])
|
|
171
|
+
);
|
|
172
|
+
const named = [];
|
|
173
|
+
for (const s of specs) {
|
|
174
|
+
if (s.kind === "default") {
|
|
175
|
+
injectedStmts.push(
|
|
176
|
+
t.variableDeclaration("const", [
|
|
177
|
+
t.variableDeclarator(
|
|
178
|
+
t.identifier(s.local),
|
|
179
|
+
t.callExpression(defaultHelperIdent, [modIdent])
|
|
180
|
+
)
|
|
181
|
+
])
|
|
182
|
+
);
|
|
183
|
+
} else if (s.kind === "namespace") {
|
|
184
|
+
injectedStmts.push(
|
|
185
|
+
t.variableDeclaration("const", [
|
|
186
|
+
t.variableDeclarator(t.identifier(s.local), modIdent)
|
|
187
|
+
])
|
|
188
|
+
);
|
|
189
|
+
} else {
|
|
190
|
+
named.push({ imported: s.imported, local: s.local });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (named.length) {
|
|
194
|
+
injectedStmts.push(
|
|
195
|
+
t.variableDeclaration("const", [
|
|
196
|
+
t.variableDeclarator(
|
|
197
|
+
t.objectPattern(
|
|
198
|
+
named.map(
|
|
199
|
+
({ imported, local }) => t.objectProperty(
|
|
200
|
+
t.identifier(imported),
|
|
201
|
+
t.identifier(local),
|
|
202
|
+
false,
|
|
203
|
+
imported === local
|
|
204
|
+
)
|
|
205
|
+
)
|
|
206
|
+
),
|
|
207
|
+
t.logicalExpression("||", modIdent, t.objectExpression([]))
|
|
208
|
+
)
|
|
209
|
+
])
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const returnExpr = returnDefaultProperty ? t.memberExpression(
|
|
214
|
+
t.identifier(defaultExportLocalName),
|
|
215
|
+
t.identifier("default")
|
|
216
|
+
) : t.identifier(defaultExportLocalName);
|
|
217
|
+
const wrapperBody = [];
|
|
218
|
+
wrapperBody.push(...injectedStmts);
|
|
219
|
+
wrapperBody.push(...program.body);
|
|
220
|
+
wrapperBody.push(t.returnStatement(returnExpr));
|
|
221
|
+
const wrapper = t.exportDefaultDeclaration(
|
|
222
|
+
t.functionDeclaration(
|
|
223
|
+
null,
|
|
224
|
+
[depsIdent],
|
|
225
|
+
t.blockStatement(wrapperBody)
|
|
226
|
+
)
|
|
227
|
+
);
|
|
228
|
+
program.body = [...keptImports, wrapper, ...keptNamedExports];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// src/vite/prep.ts
|
|
236
|
+
var DEFAULT_INJECTED_IDS = ["react", "react/jsx-runtime"];
|
|
237
|
+
var DEFAULT_INJECTED_PREFIXES = ["@inertiajs/", "@host/"];
|
|
238
|
+
function resolveOutDir(outputOptions) {
|
|
239
|
+
if (outputOptions.dir) return outputOptions.dir;
|
|
240
|
+
if (outputOptions.file) return dirname(outputOptions.file);
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
function shouldInject2(id, opts) {
|
|
244
|
+
const ids = opts.injectedIds ?? [];
|
|
245
|
+
const prefixes = opts.injectedPrefixes ?? [];
|
|
246
|
+
if (ids.includes(id)) return true;
|
|
247
|
+
for (const p of prefixes) if (id.startsWith(p)) return true;
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
function prep(options = {}) {
|
|
251
|
+
const injectedIds = options.injectedIds ?? [...DEFAULT_INJECTED_IDS];
|
|
252
|
+
const injectedPrefixes = options.injectedPrefixes ?? [...DEFAULT_INJECTED_PREFIXES];
|
|
253
|
+
const runtimeKey = options.runtimeKey ?? "imports";
|
|
254
|
+
const depsParam = options.depsParam ?? "deps";
|
|
255
|
+
const entryExtensions = options.entryExtensions ?? [".js", ".mjs"];
|
|
256
|
+
const pluginName = options.pluginName ?? "fortiplugin-prep";
|
|
257
|
+
const transformOptions = {
|
|
258
|
+
injectedIds,
|
|
259
|
+
injectedPrefixes,
|
|
260
|
+
runtimeKey,
|
|
261
|
+
depsParam
|
|
262
|
+
};
|
|
263
|
+
return {
|
|
264
|
+
name: pluginName,
|
|
265
|
+
apply: "build",
|
|
266
|
+
config() {
|
|
267
|
+
return {
|
|
268
|
+
define: {
|
|
269
|
+
"process.env.NODE_ENV": '"production"'
|
|
270
|
+
},
|
|
271
|
+
build: {
|
|
272
|
+
rollupOptions: {
|
|
273
|
+
// Ensure virtual imports don't need to resolve.
|
|
274
|
+
external: (id) => shouldInject2(id, transformOptions)
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
},
|
|
279
|
+
writeBundle(outputOptions, bundle) {
|
|
280
|
+
const outDir = resolveOutDir(outputOptions);
|
|
281
|
+
if (!outDir) return;
|
|
282
|
+
for (const [fileName, item] of Object.entries(bundle)) {
|
|
283
|
+
if (item.type !== "chunk") continue;
|
|
284
|
+
if (!item.isEntry) continue;
|
|
285
|
+
if (!entryExtensions.some((ext) => fileName.endsWith(ext))) continue;
|
|
286
|
+
const absPath = resolvePath(outDir, fileName);
|
|
287
|
+
const input = readFileSync(absPath, "utf-8");
|
|
288
|
+
const result = transformSync(input, {
|
|
289
|
+
filename: absPath,
|
|
290
|
+
sourceType: "module",
|
|
291
|
+
// Fresh plugin instance per file (Babel calls plugin factory per file when passed as [fn, opts])
|
|
292
|
+
plugins: [[fortiPrepTransform, transformOptions]],
|
|
293
|
+
generatorOpts: {
|
|
294
|
+
compact: false,
|
|
295
|
+
comments: true,
|
|
296
|
+
retainLines: false
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
if (!result?.code) continue;
|
|
300
|
+
writeFileSync(absPath, result.code, "utf-8");
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
export {
|
|
306
|
+
prep as default,
|
|
307
|
+
fortiPrepTransform
|
|
308
|
+
};
|
|
309
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vite/prep.ts","../src/babel/transform.ts"],"sourcesContent":["import { transformSync } from \"@babel/core\";\r\nimport { readFileSync, writeFileSync } from \"node:fs\";\r\nimport { dirname, resolve as resolvePath } from \"node:path\";\r\nimport type {NormalizedOutputOptions, OutputBundle, OutputOptions} from \"rollup\";\r\nimport type { Plugin as VitePlugin } from \"vite\";\r\n\r\nimport fortiPrepTransform, {\r\n type FortiPrepTransformOptions,\r\n} from \"../babel/transform\";\r\n\r\nexport type FortiPrepOptions = FortiPrepTransformOptions & {\r\n /**\r\n * Which emitted entry file extensions should be rewritten.\r\n * Default: [\".js\", \".mjs\"]\r\n */\r\n entryExtensions?: string[];\r\n\r\n /**\r\n * Vite plugin name\r\n * Default: \"fortiplugin-prep\"\r\n */\r\n pluginName?: string;\r\n};\r\n\r\nconst DEFAULT_INJECTED_IDS = [\"react\", \"react/jsx-runtime\"] as const;\r\nconst DEFAULT_INJECTED_PREFIXES = [\"@inertiajs/\", \"@host/\"] as const;\r\n\r\nfunction resolveOutDir(outputOptions: OutputOptions): string | null {\r\n if (outputOptions.dir) return outputOptions.dir;\r\n if (outputOptions.file) return dirname(outputOptions.file);\r\n return null;\r\n}\r\n\r\nfunction shouldInject(id: string, opts: FortiPrepTransformOptions): boolean {\r\n const ids = opts.injectedIds ?? [];\r\n const prefixes = opts.injectedPrefixes ?? [];\r\n if (ids.includes(id)) return true;\r\n for (const p of prefixes) if (id.startsWith(p)) return true;\r\n return false;\r\n}\r\n\r\n/**\r\n * FortiPlugin bundle adapter:\r\n * - marks injected imports as Rollup externals (so they survive into output)\r\n * - rewrites built entry chunks to remove those imports and load them from runtime deps\r\n */\r\nexport default function prep(options: FortiPrepOptions = {}): VitePlugin {\r\n const injectedIds = options.injectedIds ?? [...DEFAULT_INJECTED_IDS];\r\n const injectedPrefixes = options.injectedPrefixes ?? [...DEFAULT_INJECTED_PREFIXES];\r\n\r\n const runtimeKey = options.runtimeKey ?? \"imports\";\r\n const depsParam = options.depsParam ?? \"deps\";\r\n\r\n const entryExtensions = options.entryExtensions ?? [\".js\", \".mjs\"];\r\n const pluginName = options.pluginName ?? \"fortiplugin-prep\";\r\n\r\n const transformOptions: FortiPrepTransformOptions = {\r\n injectedIds,\r\n injectedPrefixes,\r\n runtimeKey,\r\n depsParam,\r\n };\r\n\r\n return {\r\n name: pluginName,\r\n apply: \"build\",\r\n\r\n config() {\r\n return {\r\n define: {\r\n \"process.env.NODE_ENV\": '\"production\"',\r\n },\r\n build: {\r\n rollupOptions: {\r\n // Ensure virtual imports don't need to resolve.\r\n external: (id: string) => shouldInject(id, transformOptions),\r\n },\r\n },\r\n };\r\n },\r\n\r\n writeBundle(outputOptions: NormalizedOutputOptions, bundle: OutputBundle) {\r\n const outDir = resolveOutDir(outputOptions);\r\n if (!outDir) return;\r\n\r\n for (const [fileName, item] of Object.entries(bundle)) {\r\n if (item.type !== \"chunk\") continue;\r\n if (!item.isEntry) continue;\r\n\r\n if (!entryExtensions.some((ext) => fileName.endsWith(ext))) continue;\r\n\r\n const absPath = resolvePath(outDir, fileName);\r\n const input = readFileSync(absPath, \"utf-8\");\r\n\r\n const result = transformSync(input, {\r\n filename: absPath,\r\n sourceType: \"module\",\r\n // Fresh plugin instance per file (Babel calls plugin factory per file when passed as [fn, opts])\r\n plugins: [[fortiPrepTransform as any, transformOptions]],\r\n generatorOpts: {\r\n compact: false,\r\n comments: true,\r\n retainLines: false,\r\n },\r\n });\r\n\r\n if (!result?.code) continue;\r\n writeFileSync(absPath, result.code, \"utf-8\");\r\n }\r\n },\r\n };\r\n}","// noinspection JSUnusedGlobalSymbols,GrazieInspection\r\n\r\nimport type {PluginObj} from \"@babel/core\";\r\nimport * as t from \"@babel/types\";\r\nimport type {NodePath} from \"@babel/traverse\";\r\n\r\nexport type FortiPrepTransformOptions = {\r\n /**\r\n * Exact import ids to inject (removed from bundle and loaded from runtime deps).\r\n * Example: [\"react\", \"react/jsx-runtime\", \"@host/ui\"]\r\n */\r\n injectedIds?: string[];\r\n\r\n /**\r\n * Prefix import ids to inject.\r\n * Example: [\"@host/\", \"@inertiajs/\"]\r\n */\r\n injectedPrefixes?: string[];\r\n\r\n /**\r\n * The key on the deps object used as the import map.\r\n * Wrapper supports passing deps.imports OR passing the import map directly.\r\n *\r\n * Default: \"imports\"\r\n */\r\n runtimeKey?: string;\r\n\r\n /**\r\n * Wrapper function parameter name.\r\n * Default: \"deps\"\r\n */\r\n depsParam?: string;\r\n};\r\n\r\nconst DEFAULTS: Required<Pick<FortiPrepTransformOptions, \"runtimeKey\" | \"depsParam\">> = {\r\n runtimeKey: \"imports\",\r\n depsParam: \"deps\",\r\n};\r\n\r\nconst DEFAULT_EXPORT_ERROR =\r\n \"PROBLEM!!, No known default function was found, your code either possesses NO named default export or this export format is currently not supported.\";\r\n\r\nfunction shouldInject(id: string, opts: FortiPrepTransformOptions): boolean {\r\n const ids = opts.injectedIds ?? [];\r\n const prefixes = opts.injectedPrefixes ?? [];\r\n if (ids.includes(id)) return true;\r\n for (const p of prefixes) if (id.startsWith(p)) return true;\r\n return false;\r\n}\r\n\r\ntype CapturedImport =\r\n | { kind: \"default\"; local: string }\r\n | { kind: \"namespace\"; local: string }\r\n | { kind: \"named\"; imported: string; local: string };\r\n\r\nfunction getImportedName(spec: t.ImportSpecifier): string {\r\n return t.isIdentifier(spec.imported) ? spec.imported.name : spec.imported.value;\r\n}\r\n\r\nfunction makeImportMapExpr(\r\n depsIdent: t.Identifier,\r\n runtimeKey: string\r\n): t.Expression {\r\n // Support both:\r\n // factory({ imports: { ... } })\r\n // and:\r\n // factory({ ... }) // direct import map\r\n //\r\n // const __imports =\r\n // deps && typeof deps === \"object\" && \"imports\" in deps\r\n // ? deps.imports\r\n // : (deps ?? {});\r\n const hasKey = t.binaryExpression(\r\n \"in\",\r\n t.stringLiteral(runtimeKey),\r\n depsIdent\r\n );\r\n\r\n const isObj = t.logicalExpression(\r\n \"&&\",\r\n t.binaryExpression(\"!==\", depsIdent, t.nullLiteral()),\r\n t.binaryExpression(\"===\", t.unaryExpression(\"typeof\", depsIdent), t.stringLiteral(\"object\"))\r\n );\r\n\r\n const test = t.logicalExpression(\"&&\", isObj, hasKey);\r\n\r\n const depsKey = t.memberExpression(depsIdent, t.identifier(runtimeKey));\r\n const fallback = t.logicalExpression(\"||\", depsIdent, t.objectExpression([]));\r\n\r\n return t.conditionalExpression(test, depsKey, fallback);\r\n}\r\n\r\n/**\r\n * Babel plugin factory (Babel calls this per-file when used as `[plugin, options]`).\r\n */\r\nexport default function fortiPrepTransform(\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n _api: unknown,\r\n rawOpts: FortiPrepTransformOptions = {}\r\n): PluginObj {\r\n const opts: FortiPrepTransformOptions = {\r\n ...rawOpts,\r\n runtimeKey: rawOpts.runtimeKey ?? DEFAULTS.runtimeKey,\r\n depsParam: rawOpts.depsParam ?? DEFAULTS.depsParam,\r\n };\r\n\r\n // per-file state (because Babel calls the plugin per file)\r\n const keptImports: t.ImportDeclaration[] = [];\r\n const keptNamedExports: t.ExportNamedDeclaration[] = [];\r\n\r\n const injectedImportsById = new Map<string, CapturedImport[]>();\r\n\r\n let defaultExportLocalName: string | null = null;\r\n let returnDefaultProperty = false;\r\n\r\n function captureImport(importId: string, entry: CapturedImport) {\r\n const list = injectedImportsById.get(importId) ?? [];\r\n list.push(entry);\r\n injectedImportsById.set(importId, list);\r\n }\r\n\r\n return {\r\n name: \"fortiplugin-prep/transform\",\r\n visitor: {\r\n ImportDeclaration(path: NodePath<t.ImportDeclaration>) {\r\n const node = path.node;\r\n const importId = node.source.value;\r\n\r\n if (!shouldInject(importId, opts)) {\r\n keptImports.push(node);\r\n path.remove();\r\n return;\r\n }\r\n\r\n // Remove injected import and capture its specifiers to recreate inside wrapper.\r\n for (const s of node.specifiers) {\r\n if (t.isImportDefaultSpecifier(s)) {\r\n captureImport(importId, {kind: \"default\", local: s.local.name});\r\n } else if (t.isImportNamespaceSpecifier(s)) {\r\n captureImport(importId, {kind: \"namespace\", local: s.local.name});\r\n } else if (t.isImportSpecifier(s)) {\r\n captureImport(importId, {\r\n kind: \"named\",\r\n imported: getImportedName(s),\r\n local: s.local.name,\r\n });\r\n }\r\n }\r\n\r\n // side-effect only imports (import \"@host/ui\") become no-ops at runtime\r\n path.remove();\r\n },\r\n\r\n ExportDefaultDeclaration(path: NodePath<t.ExportDefaultDeclaration>) {\r\n const decl = path.node.declaration;\r\n\r\n // export default Foo;\r\n if (t.isIdentifier(decl)) {\r\n defaultExportLocalName = decl.name;\r\n path.remove();\r\n return;\r\n }\r\n\r\n // export default (expr/anon fn/class)\r\n // Hoist into a const (inside wrapper) so we can `return <id>`\r\n const id = path.scope.generateUidIdentifier(\"defaultExport\");\r\n path.replaceWith(\r\n t.variableDeclaration(\"const\", [t.variableDeclarator(id, decl as any)])\r\n );\r\n defaultExportLocalName = id.name;\r\n },\r\n\r\n ExportNamedDeclaration(path: NodePath<t.ExportNamedDeclaration>) {\r\n const node = path.node;\r\n keptNamedExports.push(node);\r\n\r\n // Detect Rollup-style: export { Foo as default }\r\n if (node.specifiers?.length) {\r\n let foundExplicitDefault = false;\r\n\r\n node.specifiers = node.specifiers.filter((spec) => {\r\n const exported =\r\n t.isIdentifier(spec.exported) ? spec.exported.name : spec.exported.value;\r\n\r\n if (exported === \"default\") {\r\n const local = (spec as any)?.local?.name as string | undefined;\r\n if (local) defaultExportLocalName = local;\r\n foundExplicitDefault = true;\r\n return false; // remove\r\n }\r\n\r\n return true;\r\n });\r\n\r\n // Minified fallback behavior:\r\n // If no default specifier found and exactly one spec exists,\r\n // treat it as the container and return `<local>.default`.\r\n if (!foundExplicitDefault && !defaultExportLocalName && node.specifiers.length === 1) {\r\n const only = node.specifiers[0] as any;\r\n if (only?.local?.name) {\r\n defaultExportLocalName = only.local.name;\r\n returnDefaultProperty = true;\r\n node.specifiers = [];\r\n }\r\n }\r\n }\r\n\r\n path.remove();\r\n },\r\n\r\n Program: {\r\n exit(path: NodePath<t.Program>) {\r\n const program = path.node;\r\n\r\n if (!defaultExportLocalName) {\r\n throw path.buildCodeFrameError(DEFAULT_EXPORT_ERROR);\r\n }\r\n\r\n const depsIdent = t.identifier(opts.depsParam ?? DEFAULTS.depsParam);\r\n const runtimeKey = opts.runtimeKey ?? DEFAULTS.runtimeKey;\r\n\r\n // const __imports = (deps has runtimeKey) ? deps[runtimeKey] : (deps || {});\r\n const importsIdent = t.identifier(\"__imports\");\r\n const importsInit = makeImportMapExpr(depsIdent, runtimeKey);\r\n const importsDecl = t.variableDeclaration(\"const\", [\r\n t.variableDeclarator(importsIdent, importsInit),\r\n ]);\r\n\r\n // helper:\r\n // const __default = (m) => (m && typeof m === \"object\" && \"default\" in m ? m.default : m);\r\n const defaultHelperIdent = t.identifier(\"__default\");\r\n const defaultHelperDecl = t.variableDeclaration(\"const\", [\r\n t.variableDeclarator(\r\n defaultHelperIdent,\r\n t.arrowFunctionExpression(\r\n [t.identifier(\"m\")],\r\n t.conditionalExpression(\r\n t.logicalExpression(\r\n \"&&\",\r\n t.logicalExpression(\r\n \"&&\",\r\n t.identifier(\"m\"),\r\n t.binaryExpression(\r\n \"===\",\r\n t.unaryExpression(\"typeof\", t.identifier(\"m\")),\r\n t.stringLiteral(\"object\")\r\n )\r\n ),\r\n t.binaryExpression(\"in\", t.stringLiteral(\"default\"), t.identifier(\"m\"))\r\n ),\r\n t.memberExpression(t.identifier(\"m\"), t.identifier(\"default\")),\r\n t.identifier(\"m\")\r\n )\r\n )\r\n ),\r\n ]);\r\n\r\n // Build injected module locals inside wrapper\r\n const injectedStmts: t.Statement[] = [importsDecl, defaultHelperDecl];\r\n\r\n for (const [importId, specs] of injectedImportsById.entries()) {\r\n const modIdent = t.identifier(\r\n `__m_${importId.replace(/[^a-zA-Z0-9_$]/g, \"_\")}`\r\n );\r\n\r\n // const __m_xxx = __imports[\"<importId>\"];\r\n injectedStmts.push(\r\n t.variableDeclaration(\"const\", [\r\n t.variableDeclarator(\r\n modIdent,\r\n t.memberExpression(importsIdent, t.stringLiteral(importId), true)\r\n ),\r\n ])\r\n );\r\n\r\n const named: Array<{ imported: string; local: string }> = [];\r\n\r\n for (const s of specs) {\r\n if (s.kind === \"default\") {\r\n // const Local = __default(__m_xxx);\r\n injectedStmts.push(\r\n t.variableDeclaration(\"const\", [\r\n t.variableDeclarator(\r\n t.identifier(s.local),\r\n t.callExpression(defaultHelperIdent, [modIdent])\r\n ),\r\n ])\r\n );\r\n } else if (s.kind === \"namespace\") {\r\n // const Local = __m_xxx;\r\n injectedStmts.push(\r\n t.variableDeclaration(\"const\", [\r\n t.variableDeclarator(t.identifier(s.local), modIdent),\r\n ])\r\n );\r\n } else {\r\n named.push({imported: s.imported, local: s.local});\r\n }\r\n }\r\n\r\n if (named.length) {\r\n // const { A, B: C } = (__m_xxx ?? {});\r\n injectedStmts.push(\r\n t.variableDeclaration(\"const\", [\r\n t.variableDeclarator(\r\n t.objectPattern(\r\n named.map(({imported, local}) =>\r\n t.objectProperty(\r\n t.identifier(imported),\r\n t.identifier(local),\r\n false,\r\n imported === local\r\n )\r\n )\r\n ),\r\n t.logicalExpression(\"||\", modIdent, t.objectExpression([]))\r\n ),\r\n ])\r\n );\r\n }\r\n }\r\n\r\n const returnExpr = returnDefaultProperty\r\n ? t.memberExpression(\r\n t.identifier(defaultExportLocalName),\r\n t.identifier(\"default\")\r\n )\r\n : t.identifier(defaultExportLocalName);\r\n\r\n // Wrapper body:\r\n // injectedStmts...\r\n // <original body>\r\n // return <defaultExport>\r\n const wrapperBody: t.Statement[] = [];\r\n wrapperBody.push(...injectedStmts);\r\n wrapperBody.push(...program.body);\r\n wrapperBody.push(t.returnStatement(returnExpr));\r\n\r\n const wrapper = t.exportDefaultDeclaration(\r\n t.functionDeclaration(\r\n null,\r\n [depsIdent],\r\n t.blockStatement(wrapperBody)\r\n )\r\n );\r\n\r\n // Final program:\r\n // kept imports at module scope\r\n // export default function(deps) { ... }\r\n // kept named exports (same as your old behavior)\r\n program.body = [...keptImports, wrapper, ...keptNamedExports] as any;\r\n },\r\n },\r\n },\r\n };\r\n}"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,cAAc,qBAAqB;AAC5C,SAAS,SAAS,WAAW,mBAAmB;;;ACChD,YAAY,OAAO;AA+BnB,IAAM,WAAkF;AAAA,EACpF,YAAY;AAAA,EACZ,WAAW;AACf;AAEA,IAAM,uBACF;AAEJ,SAAS,aAAa,IAAY,MAA0C;AACxE,QAAM,MAAM,KAAK,eAAe,CAAC;AACjC,QAAM,WAAW,KAAK,oBAAoB,CAAC;AAC3C,MAAI,IAAI,SAAS,EAAE,EAAG,QAAO;AAC7B,aAAW,KAAK,SAAU,KAAI,GAAG,WAAW,CAAC,EAAG,QAAO;AACvD,SAAO;AACX;AAOA,SAAS,gBAAgB,MAAiC;AACtD,SAAS,eAAa,KAAK,QAAQ,IAAI,KAAK,SAAS,OAAO,KAAK,SAAS;AAC9E;AAEA,SAAS,kBACL,WACA,YACY;AAUZ,QAAM,SAAW;AAAA,IACb;AAAA,IACE,gBAAc,UAAU;AAAA,IAC1B;AAAA,EACJ;AAEA,QAAM,QAAU;AAAA,IACZ;AAAA,IACE,mBAAiB,OAAO,WAAa,cAAY,CAAC;AAAA,IAClD,mBAAiB,OAAS,kBAAgB,UAAU,SAAS,GAAK,gBAAc,QAAQ,CAAC;AAAA,EAC/F;AAEA,QAAM,OAAS,oBAAkB,MAAM,OAAO,MAAM;AAEpD,QAAM,UAAY,mBAAiB,WAAa,aAAW,UAAU,CAAC;AACtE,QAAM,WAAa,oBAAkB,MAAM,WAAa,mBAAiB,CAAC,CAAC,CAAC;AAE5E,SAAS,wBAAsB,MAAM,SAAS,QAAQ;AAC1D;AAKe,SAAR,mBAEH,MACA,UAAqC,CAAC,GAC7B;AACT,QAAM,OAAkC;AAAA,IACp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AY,QAAQ,QAAQ;AAC5C,cAAM,QAAQ,aAAa,SAAS,OAAO;AAE3C,cAAM,SAAS,cAAc,OAAO;AAAA,UAChC,UAAU;AAAA,UACV,YAAY;AAAA;AAAA,UAEZ,SAAS,CAAC,CAAC,oBAA2B,gBAAgB,CAAC;AAAA,UACvD,eAAe;AAAA,YACX,SAAS;AAAA,YACT,UAAU;AAAA,YACV,aAAa;AAAA,UACjB;AAAA,QACJ,CAAC;AAED,YAAI,CAAC,QAAQ,KAAM;AACnB,sBAAc,SAAS,OAAO,MAAM,OAAO;AAAA,MAC/C;AAAA,IACJ;AAAA,EACJ;AACJ;","names":["shouldInject"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fortiplugin-bundle-adapter",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"main": "./dist/index.cjs",
|
|
10
|
+
"module": "./dist/index.mjs",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.mjs",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup",
|
|
21
|
+
"dev": "tsup --watch",
|
|
22
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
23
|
+
"test:transform": "node tests/run-transform.mjs"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@babel/core": "^7.28.5",
|
|
27
|
+
"@babel/types": "^7.28.5"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"vite": "^6.4.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/babel__core": "^7.20.5",
|
|
34
|
+
"@types/node": "^25.0.3",
|
|
35
|
+
"react": "^19.2.3",
|
|
36
|
+
"rollup": "^4.55.1",
|
|
37
|
+
"tsup": "^8.5.1",
|
|
38
|
+
"typescript": "^5.9.3"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/timeax/fortiplugin-bundle-adapter.git"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [],
|
|
45
|
+
"author": "",
|
|
46
|
+
"license": "ISC",
|
|
47
|
+
"type": "commonjs",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/timeax/fortiplugin-bundle-adapter/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/timeax/fortiplugin-bundle-adapter#readme"
|
|
52
|
+
}
|