vite-plugin-solid 2.11.9 → 3.0.0-next.0
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/dist/cjs/index.cjs +146 -16
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +143 -16
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/src/index.d.ts +28 -0
- package/dist/types/src/lazy-module-url.d.ts +8 -0
- package/package.json +7 -7
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var babel = require('@babel/core');
|
|
4
6
|
var solid = require('babel-preset-solid');
|
|
5
7
|
var fs = require('fs');
|
|
6
8
|
var mergeAnything = require('merge-anything');
|
|
7
9
|
var module$1 = require('module');
|
|
8
10
|
var solidRefresh = require('solid-refresh/babel');
|
|
11
|
+
var path = require('path');
|
|
9
12
|
var vite = require('vite');
|
|
10
13
|
var vitefu = require('vitefu');
|
|
11
14
|
|
|
@@ -29,6 +32,62 @@ function _interopNamespaceDefault(e) {
|
|
|
29
32
|
|
|
30
33
|
var babel__namespace = /*#__PURE__*/_interopNamespaceDefault(babel);
|
|
31
34
|
|
|
35
|
+
const LAZY_PLACEHOLDER_PREFIX = '__SOLID_LAZY_MODULE__:';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Detects whether a CallExpression argument is `() => import("specifier")`
|
|
39
|
+
* and returns the specifier string if so.
|
|
40
|
+
*/
|
|
41
|
+
function extractDynamicImportSpecifier(node) {
|
|
42
|
+
if (node.type !== 'ArrowFunctionExpression' && node.type !== 'FunctionExpression') return null;
|
|
43
|
+
let callExpr = null;
|
|
44
|
+
if (node.body.type === 'CallExpression') {
|
|
45
|
+
callExpr = node.body;
|
|
46
|
+
} else if (node.body.type === 'BlockStatement' && node.body.body.length === 1 && node.body.body[0].type === 'ReturnStatement' && node.body.body[0].argument?.type === 'CallExpression') {
|
|
47
|
+
callExpr = node.body.body[0].argument;
|
|
48
|
+
}
|
|
49
|
+
if (!callExpr) return null;
|
|
50
|
+
if (callExpr.callee.type !== 'Import') return null;
|
|
51
|
+
if (callExpr.arguments.length !== 1) return null;
|
|
52
|
+
const arg = callExpr.arguments[0];
|
|
53
|
+
if (arg.type !== 'StringLiteral') return null;
|
|
54
|
+
return arg.value;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Babel plugin that detects `lazy(() => import("specifier"))` calls
|
|
59
|
+
* and injects a placeholder as the second argument. The placeholder
|
|
60
|
+
* is resolved to a real path by the Vite transform hook using this.resolve().
|
|
61
|
+
*/
|
|
62
|
+
function lazyModuleUrlPlugin() {
|
|
63
|
+
return {
|
|
64
|
+
name: 'solid-lazy-module-url',
|
|
65
|
+
visitor: {
|
|
66
|
+
CallExpression(nodePath, state) {
|
|
67
|
+
if (!state.filename) return;
|
|
68
|
+
const {
|
|
69
|
+
node
|
|
70
|
+
} = nodePath;
|
|
71
|
+
if (node.callee.type !== 'Identifier' || node.callee.name !== 'lazy') return;
|
|
72
|
+
const binding = nodePath.scope.getBinding('lazy');
|
|
73
|
+
if (!binding || binding.kind !== 'module') return;
|
|
74
|
+
const bindingPath = binding.path;
|
|
75
|
+
if (bindingPath.type !== 'ImportSpecifier' || bindingPath.parent.type !== 'ImportDeclaration') return;
|
|
76
|
+
const source = bindingPath.parent.source.value;
|
|
77
|
+
if (source !== 'solid-js') return;
|
|
78
|
+
if (node.arguments.length >= 2) return;
|
|
79
|
+
if (node.arguments.length !== 1) return;
|
|
80
|
+
const specifier = extractDynamicImportSpecifier(node.arguments[0]);
|
|
81
|
+
if (!specifier) return;
|
|
82
|
+
node.arguments.push({
|
|
83
|
+
type: 'StringLiteral',
|
|
84
|
+
value: LAZY_PLACEHOLDER_PREFIX + specifier
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
32
91
|
const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
33
92
|
const runtimePublicPath = '/@solid-refresh';
|
|
34
93
|
const runtimeFilePath = require$1.resolve('solid-refresh/dist/solid-refresh.mjs');
|
|
@@ -68,6 +127,7 @@ function solidPlugin(options = {}) {
|
|
|
68
127
|
let replaceDev = false;
|
|
69
128
|
let projectRoot = process.cwd();
|
|
70
129
|
let isTestMode = false;
|
|
130
|
+
let solidPkgsConfig;
|
|
71
131
|
return {
|
|
72
132
|
name: 'solid',
|
|
73
133
|
enforce: 'pre',
|
|
@@ -76,11 +136,11 @@ function solidPlugin(options = {}) {
|
|
|
76
136
|
}) {
|
|
77
137
|
// We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode
|
|
78
138
|
replaceDev = options.dev === true || options.dev !== false && command === 'serve';
|
|
79
|
-
projectRoot = userConfig.root;
|
|
139
|
+
projectRoot = userConfig.root || projectRoot;
|
|
80
140
|
isTestMode = userConfig.mode === 'test';
|
|
81
141
|
if (!userConfig.resolve) userConfig.resolve = {};
|
|
82
142
|
userConfig.resolve.alias = normalizeAliases(userConfig.resolve && userConfig.resolve.alias);
|
|
83
|
-
|
|
143
|
+
solidPkgsConfig = await vitefu.crawlFrameworkPkgs({
|
|
84
144
|
viteUserConfig: userConfig,
|
|
85
145
|
root: projectRoot || process.cwd(),
|
|
86
146
|
isBuild: command === 'build',
|
|
@@ -90,7 +150,7 @@ function solidPlugin(options = {}) {
|
|
|
90
150
|
});
|
|
91
151
|
|
|
92
152
|
// fix for bundling dev in production
|
|
93
|
-
const nestedDeps = replaceDev ? ['solid-js', '
|
|
153
|
+
const nestedDeps = replaceDev ? ['solid-js', '@solidjs/web'] : [];
|
|
94
154
|
const userTest = userConfig.test ?? {};
|
|
95
155
|
const test = {};
|
|
96
156
|
if (userConfig.mode === 'test') {
|
|
@@ -133,7 +193,9 @@ function solidPlugin(options = {}) {
|
|
|
133
193
|
include: [...nestedDeps, ...solidPkgsConfig.optimizeDeps.include],
|
|
134
194
|
exclude: solidPkgsConfig.optimizeDeps.exclude
|
|
135
195
|
},
|
|
136
|
-
|
|
196
|
+
...(!isVite6 ? {
|
|
197
|
+
ssr: solidPkgsConfig.ssr
|
|
198
|
+
} : {}),
|
|
137
199
|
...(test.server ? {
|
|
138
200
|
test
|
|
139
201
|
} : {})
|
|
@@ -156,9 +218,18 @@ function solidPlugin(options = {}) {
|
|
|
156
218
|
}
|
|
157
219
|
}
|
|
158
220
|
config.resolve.conditions = ['solid', ...(replaceDev ? ['development'] : []), ...(isTestMode && !opts.isSsrTargetWebworker && !options.ssr ? ['browser'] : []), ...config.resolve.conditions];
|
|
221
|
+
|
|
222
|
+
// Set resolve.noExternal and resolve.external for SSR environment (Vite 6+)
|
|
223
|
+
// Only set resolve.external if noExternal is not true (to avoid conflicts with plugins like Cloudflare)
|
|
224
|
+
if (isVite6 && name === 'ssr' && solidPkgsConfig) {
|
|
225
|
+
if (config.resolve.noExternal !== true) {
|
|
226
|
+
config.resolve.noExternal = [...(Array.isArray(config.resolve.noExternal) ? config.resolve.noExternal : []), ...solidPkgsConfig.ssr.noExternal];
|
|
227
|
+
config.resolve.external = [...(Array.isArray(config.resolve.external) ? config.resolve.external : []), ...solidPkgsConfig.ssr.external];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
159
230
|
},
|
|
160
231
|
configResolved(config) {
|
|
161
|
-
needHmr = config.command === 'serve' && config.mode !== 'production' && options.hot !== false;
|
|
232
|
+
needHmr = config.command === 'serve' && config.mode !== 'production' && options.hot !== false && !options.refresh?.disabled;
|
|
162
233
|
},
|
|
163
234
|
resolveId(id) {
|
|
164
235
|
if (id === runtimePublicPath) return id;
|
|
@@ -210,7 +281,7 @@ function solidPlugin(options = {}) {
|
|
|
210
281
|
if (extensionName !== currentFileExtension) return false;
|
|
211
282
|
return extensionOptions.typescript;
|
|
212
283
|
});
|
|
213
|
-
const plugins = ['jsx'];
|
|
284
|
+
const plugins = ['jsx', 'decorators'];
|
|
214
285
|
if (shouldBeProcessedWithTypescript) {
|
|
215
286
|
plugins.push('typescript');
|
|
216
287
|
}
|
|
@@ -220,11 +291,18 @@ function solidPlugin(options = {}) {
|
|
|
220
291
|
sourceFileName: id,
|
|
221
292
|
presets: [[solid, {
|
|
222
293
|
...solidOptions,
|
|
294
|
+
dev: replaceDev,
|
|
223
295
|
...(options.solid || {})
|
|
224
296
|
}]],
|
|
225
|
-
plugins: needHmr && !isSsr && !inNodeModules ? [[solidRefresh, {
|
|
226
|
-
|
|
227
|
-
|
|
297
|
+
plugins: [[lazyModuleUrlPlugin], ...(needHmr && !isSsr && !inNodeModules ? [[solidRefresh, {
|
|
298
|
+
...(options.refresh || {}),
|
|
299
|
+
bundler: 'vite',
|
|
300
|
+
fixRender: true,
|
|
301
|
+
// TODO unfortunately, even with SSR enabled for refresh
|
|
302
|
+
// it still doesn't work, so now we have to disable
|
|
303
|
+
// this config
|
|
304
|
+
jsx: false
|
|
305
|
+
}]] : [])],
|
|
228
306
|
ast: false,
|
|
229
307
|
sourceMaps: true,
|
|
230
308
|
configFile: false,
|
|
@@ -238,20 +316,43 @@ function solidPlugin(options = {}) {
|
|
|
238
316
|
let babelUserOptions = {};
|
|
239
317
|
if (options.babel) {
|
|
240
318
|
if (typeof options.babel === 'function') {
|
|
241
|
-
const babelOptions = options.babel(source, id, isSsr);
|
|
319
|
+
const babelOptions = options.babel(source, id, !!isSsr);
|
|
242
320
|
babelUserOptions = babelOptions instanceof Promise ? await babelOptions : babelOptions;
|
|
243
321
|
} else {
|
|
244
322
|
babelUserOptions = options.babel;
|
|
245
323
|
}
|
|
246
324
|
}
|
|
247
325
|
const babelOptions = mergeAnything.mergeAndConcat(babelUserOptions, opts);
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
326
|
+
const result = await babel__namespace.transformAsync(source, babelOptions);
|
|
327
|
+
if (!result) {
|
|
328
|
+
return undefined;
|
|
329
|
+
}
|
|
330
|
+
let code = result.code || '';
|
|
331
|
+
|
|
332
|
+
// Resolve lazy() moduleUrl placeholders using Vite's resolver
|
|
333
|
+
const placeholderRe = new RegExp('"' + LAZY_PLACEHOLDER_PREFIX + '([^"]+)"', 'g');
|
|
334
|
+
let match;
|
|
335
|
+
const resolutions = [];
|
|
336
|
+
while ((match = placeholderRe.exec(code)) !== null) {
|
|
337
|
+
const specifier = match[1];
|
|
338
|
+
const resolved = await this.resolve(specifier, id);
|
|
339
|
+
if (resolved) {
|
|
340
|
+
const cleanId = resolved.id.split('?')[0];
|
|
341
|
+
resolutions.push({
|
|
342
|
+
placeholder: match[0],
|
|
343
|
+
resolved: '"' + path.relative(projectRoot, cleanId) + '"'
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
for (const {
|
|
348
|
+
placeholder,
|
|
349
|
+
resolved
|
|
350
|
+
} of resolutions) {
|
|
351
|
+
code = code.replace(placeholder, resolved);
|
|
352
|
+
}
|
|
252
353
|
return {
|
|
253
354
|
code,
|
|
254
|
-
map
|
|
355
|
+
map: result.map
|
|
255
356
|
};
|
|
256
357
|
}
|
|
257
358
|
};
|
|
@@ -269,6 +370,35 @@ function normalizeAliases(alias = []) {
|
|
|
269
370
|
replacement
|
|
270
371
|
}));
|
|
271
372
|
}
|
|
373
|
+
let _manifest;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Returns the Vite asset manifest for SSR.
|
|
377
|
+
* In production, reads and caches the manifest JSON from `manifestPath`.
|
|
378
|
+
* In development (file not found), returns a proxy that maps each moduleUrl
|
|
379
|
+
* to its dev server path, so lazy() asset resolution works without a build.
|
|
380
|
+
*/
|
|
381
|
+
function getManifest(manifestPath) {
|
|
382
|
+
if (_manifest) return _manifest;
|
|
383
|
+
if (manifestPath) {
|
|
384
|
+
try {
|
|
385
|
+
_manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
386
|
+
return _manifest;
|
|
387
|
+
} catch {
|
|
388
|
+
// File doesn't exist — dev mode, fall through
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
_manifest = new Proxy({}, {
|
|
392
|
+
get(_, key) {
|
|
393
|
+
if (typeof key !== 'string') return undefined;
|
|
394
|
+
return {
|
|
395
|
+
file: '/' + key
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
return _manifest;
|
|
400
|
+
}
|
|
272
401
|
|
|
273
|
-
|
|
402
|
+
exports.default = solidPlugin;
|
|
403
|
+
exports.getManifest = getManifest;
|
|
274
404
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import * as babel from '@babel/core';\nimport solid from 'babel-preset-solid';\nimport { readFileSync } from 'fs';\nimport { mergeAndConcat } from 'merge-anything';\nimport { createRequire } from 'module';\nimport solidRefresh from 'solid-refresh/babel';\nimport type { Alias, AliasOptions, FilterPattern, Plugin } from 'vite';\nimport { createFilter, version } from 'vite';\nimport { crawlFrameworkPkgs } from 'vitefu';\n\nconst require = createRequire(import.meta.url);\n\nconst runtimePublicPath = '/@solid-refresh';\nconst runtimeFilePath = require.resolve('solid-refresh/dist/solid-refresh.mjs');\nconst runtimeCode = readFileSync(runtimeFilePath, 'utf-8');\n\nconst isVite6 = +version.split('.')[0] >= 6;\n\n/** Possible options for the extensions property */\nexport interface ExtensionOptions {\n typescript?: boolean;\n}\n\n/** Configuration options for vite-plugin-solid. */\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 * This will inject solid-js/dev in place of solid-js in dev mode. Has no\n * effect in prod. If set to `false`, it won't inject it in dev. This is\n * useful for extra logs and debugging.\n *\n * @default true\n */\n dev?: boolean;\n /**\n * This will force SSR code in the produced files.\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 *\n * @default true\n */\n hot?: boolean;\n /**\n * This registers additional extensions that should be processed by\n * vite-plugin-solid.\n *\n * @default undefined\n */\n extensions?: (string | [string, ExtensionOptions])[];\n /**\n * Pass any additional babel transform options. They will be merged with\n * the transformations required by Solid.\n *\n * @default {}\n */\n babel?:\n | babel.TransformOptions\n | ((source: string, id: string, ssr: boolean) => babel.TransformOptions)\n | ((source: string, id: string, ssr: boolean) => Promise<babel.TransformOptions>);\n /**\n * Pass any additional [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/tree/main/packages/babel-plugin-jsx-dom-expressions#plugin-options).\n * They will be merged with the defaults sets by [babel-preset-solid](https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js#L8-L25).\n *\n * @default {}\n */\n solid?: {\n /**\n * Remove unnecessary closing tags from template strings. More info here:\n * https://github.com/solidjs/solid/blob/main/CHANGELOG.md#smaller-templates\n *\n * @default false\n */\n omitNestedClosingTags?: boolean;\n\n /**\n * Remove the last closing tag from template strings. Enabled by default even when `omitNestedClosingTags` is disabled.\n * Can be disabled for compatibility for some browser-like environments.\n *\n * @default true\n */\n omitLastClosingTag?: boolean;\n\n /**\n * Remove unnecessary quotes from template strings.\n * Can be disabled for compatibility for some browser-like environments.\n *\n * @default true\n */\n omitQuotes?: boolean;\n\n /**\n * The name of the runtime module to import the methods from.\n *\n * @default \"solid-js/web\"\n */\n moduleName?: string;\n\n /**\n * The output mode of the compiler.\n * Can be:\n * - \"dom\" is standard output\n * - \"ssr\" is for server side rendering of strings.\n * - \"universal\" is for using custom renderers from solid-js/universal\n *\n * @default \"dom\"\n */\n generate?: 'ssr' | 'dom' | 'universal';\n\n /**\n * Indicate whether the output should contain hydratable markers.\n *\n * @default false\n */\n hydratable?: boolean;\n\n /**\n * Boolean to indicate whether to enable automatic event delegation on camelCase.\n *\n * @default true\n */\n delegateEvents?: boolean;\n\n /**\n * Boolean indicates whether smart conditional detection should be used.\n * This optimizes simple boolean expressions and ternaries in JSX.\n *\n * @default true\n */\n wrapConditionals?: boolean;\n\n /**\n * Boolean indicates whether to set current render context on Custom Elements and slots.\n * Useful for seemless Context API with Web Components.\n *\n * @default true\n */\n contextToCustomElements?: boolean;\n\n /**\n * Array of Component exports from module, that aren't included by default with the library.\n * This plugin will automatically import them if it comes across them in the JSX.\n *\n * @default [\"For\",\"Show\",\"Switch\",\"Match\",\"Suspense\",\"SuspenseList\",\"Portal\",\"Index\",\"Dynamic\",\"ErrorBoundary\"]\n */\n builtIns?: string[];\n };\n}\n\nfunction getExtension(filename: string): string {\n const index = filename.lastIndexOf('.');\n return index < 0 ? '' : filename.substring(index).replace(/\\?.+$/, '');\n}\nfunction containsSolidField(fields: Record<string, any>) {\n const keys = Object.keys(fields);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (key === 'solid') return true;\n if (typeof fields[key] === 'object' && fields[key] != null && containsSolidField(fields[key]))\n return true;\n }\n return false;\n}\n\nfunction getJestDomExport(setupFiles: string[]) {\n return setupFiles?.some((path) => /jest-dom/.test(path))\n ? undefined\n : ['@testing-library/jest-dom/vitest', '@testing-library/jest-dom/extend-expect'].find(\n (path) => {\n try {\n require.resolve(path);\n return true;\n } catch (e) {\n return false;\n }\n },\n );\n}\n\nexport default function solidPlugin(options: Partial<Options> = {}): Plugin {\n const filter = createFilter(options.include, options.exclude);\n\n let needHmr = false;\n let replaceDev = false;\n let projectRoot = process.cwd();\n let isTestMode = false;\n\n return {\n name: 'solid',\n enforce: 'pre',\n\n async config(userConfig, { command }) {\n // We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode\n replaceDev = options.dev === true || (options.dev !== false && command === 'serve');\n projectRoot = userConfig.root;\n isTestMode = userConfig.mode === 'test';\n\n if (!userConfig.resolve) userConfig.resolve = {};\n userConfig.resolve.alias = normalizeAliases(userConfig.resolve && userConfig.resolve.alias);\n\n const solidPkgsConfig = await crawlFrameworkPkgs({\n viteUserConfig: userConfig,\n root: projectRoot || process.cwd(),\n isBuild: command === 'build',\n isFrameworkPkgByJson(pkgJson) {\n return containsSolidField(pkgJson.exports || {});\n },\n });\n\n // fix for bundling dev in production\n const nestedDeps = replaceDev\n ? ['solid-js', 'solid-js/web', 'solid-js/store', 'solid-js/html', 'solid-js/h']\n : [];\n\n const userTest = (userConfig as any).test ?? {};\n const test = {} as any;\n if (userConfig.mode === 'test') {\n // to simplify the processing of the config, we normalize the setupFiles to an array\n const userSetupFiles: string[] =\n typeof userTest.setupFiles === 'string'\n ? [userTest.setupFiles]\n : userTest.setupFiles || [];\n\n if (!userTest.environment && !options.ssr) {\n test.environment = 'jsdom';\n }\n\n if (\n !userTest.server?.deps?.external?.find((item: string | RegExp) =>\n /solid-js/.test(item.toString()),\n )\n ) {\n test.server = { deps: { external: [/solid-js/] } };\n }\n if (!userTest.browser?.enabled) {\n // vitest browser mode already has bundled jest-dom assertions\n // https://main.vitest.dev/guide/browser/assertion-api.html#assertion-api\n const jestDomImport = getJestDomExport(userSetupFiles);\n if (jestDomImport) {\n test.setupFiles = [jestDomImport];\n }\n }\n }\n\n return {\n /**\n * We only need esbuild on .ts or .js files.\n * .tsx & .jsx files are handled by us\n */\n // esbuild: { include: /\\.ts$/ },\n resolve: {\n conditions: isVite6\n ? undefined\n : [\n 'solid',\n ...(replaceDev ? ['development'] : []),\n ...(userConfig.mode === 'test' && !options.ssr ? ['browser'] : []),\n ],\n dedupe: nestedDeps,\n alias: [{ find: /^solid-refresh$/, replacement: runtimePublicPath }],\n },\n optimizeDeps: {\n include: [...nestedDeps, ...solidPkgsConfig.optimizeDeps.include],\n exclude: solidPkgsConfig.optimizeDeps.exclude,\n },\n ssr: solidPkgsConfig.ssr,\n ...(test.server ? { test } : {}),\n };\n },\n\n // @ts-ignore This hook only works in Vite 6\n async configEnvironment(name, config, opts) {\n config.resolve ??= {};\n // Emulate Vite default fallback for `resolve.conditions` if not set\n if (config.resolve.conditions == null) {\n // @ts-ignore These exports only exist in Vite 6\n const { defaultClientConditions, defaultServerConditions } = await import('vite');\n if (config.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) {\n config.resolve.conditions = [...defaultClientConditions];\n } else {\n config.resolve.conditions = [...defaultServerConditions];\n }\n }\n config.resolve.conditions = [\n 'solid',\n ...(replaceDev ? ['development'] : []),\n ...(isTestMode && !opts.isSsrTargetWebworker && !options.ssr ? ['browser'] : []),\n ...config.resolve.conditions,\n ];\n },\n\n configResolved(config) {\n needHmr = config.command === 'serve' && config.mode !== 'production' && options.hot !== false;\n },\n\n resolveId(id) {\n if (id === runtimePublicPath) return id;\n },\n\n load(id) {\n if (id === runtimePublicPath) return runtimeCode;\n },\n\n async transform(source, id, transformOptions) {\n const isSsr = transformOptions && transformOptions.ssr;\n const currentFileExtension = getExtension(id);\n\n const extensionsToWatch = options.extensions || [];\n const allExtensions = extensionsToWatch.map((extension) =>\n // An extension can be a string or a tuple [extension, options]\n typeof extension === 'string' ? extension : extension[0],\n );\n\n if (!filter(id)) {\n return null;\n }\n\n id = id.replace(/\\?.*$/, '');\n\n if (!(/\\.[mc]?[tj]sx$/i.test(id) || allExtensions.includes(currentFileExtension))) {\n return null;\n }\n\n const inNodeModules = /node_modules/.test(id);\n\n let solidOptions: { generate: 'ssr' | 'dom'; hydratable: boolean };\n\n if (options.ssr) {\n if (isSsr) {\n solidOptions = { generate: 'ssr', hydratable: true };\n } else {\n solidOptions = { generate: 'dom', hydratable: true };\n }\n } else {\n solidOptions = { generate: 'dom', hydratable: false };\n }\n\n // We need to know if the current file extension has a typescript options tied to it\n const shouldBeProcessedWithTypescript =\n /\\.[mc]?tsx$/i.test(id) ||\n extensionsToWatch.some((extension) => {\n if (typeof extension === 'string') {\n return extension.includes('tsx');\n }\n\n const [extensionName, extensionOptions] = extension;\n if (extensionName !== currentFileExtension) return false;\n\n return extensionOptions.typescript;\n });\n const plugins: NonNullable<NonNullable<babel.TransformOptions['parserOpts']>['plugins']> = [\n 'jsx',\n ];\n\n if (shouldBeProcessedWithTypescript) {\n plugins.push('typescript');\n }\n\n const opts: babel.TransformOptions = {\n root: projectRoot,\n filename: id,\n sourceFileName: id,\n presets: [[solid, { ...solidOptions, ...(options.solid || {}) }]],\n plugins: needHmr && !isSsr && !inNodeModules ? [[solidRefresh, { bundler: 'vite' }]] : [],\n ast: false,\n sourceMaps: true,\n configFile: false,\n babelrc: false,\n parserOpts: {\n plugins,\n },\n };\n\n // Default value for babel user options\n let babelUserOptions: babel.TransformOptions = {};\n\n if (options.babel) {\n if (typeof options.babel === 'function') {\n const babelOptions = options.babel(source, id, isSsr);\n babelUserOptions = babelOptions instanceof Promise ? await babelOptions : babelOptions;\n } else {\n babelUserOptions = options.babel;\n }\n }\n\n const babelOptions = mergeAndConcat(babelUserOptions, opts) as babel.TransformOptions;\n\n const { code, map } = await babel.transformAsync(source, babelOptions);\n\n return { code, map };\n },\n };\n}\n\n/**\n * This basically normalize all aliases of the config into\n * the array format of the alias.\n *\n * eg: alias: { '@': 'src/' } => [{ find: '@', replacement: 'src/' }]\n */\nfunction normalizeAliases(alias: AliasOptions = []): Alias[] {\n return Array.isArray(alias)\n ? alias\n : Object.entries(alias).map(([find, replacement]) => ({ find, replacement }));\n}\n"],"names":["require","createRequire","import","runtimePublicPath","runtimeFilePath","resolve","runtimeCode","readFileSync","isVite6","version","split","getExtension","filename","index","lastIndexOf","substring","replace","containsSolidField","fields","keys","Object","i","length","key","getJestDomExport","setupFiles","some","path","test","undefined","find","e","solidPlugin","options","filter","createFilter","include","exclude","needHmr","replaceDev","projectRoot","process","cwd","isTestMode","name","enforce","config","userConfig","command","dev","root","mode","alias","normalizeAliases","solidPkgsConfig","crawlFrameworkPkgs","viteUserConfig","isBuild","isFrameworkPkgByJson","pkgJson","exports","nestedDeps","userTest","userSetupFiles","environment","ssr","server","deps","external","item","toString","browser","enabled","jestDomImport","conditions","dedupe","replacement","optimizeDeps","configEnvironment","opts","defaultClientConditions","defaultServerConditions","consumer","isSsrTargetWebworker","configResolved","hot","resolveId","id","load","transform","source","transformOptions","isSsr","currentFileExtension","extensionsToWatch","extensions","allExtensions","map","extension","includes","inNodeModules","solidOptions","generate","hydratable","shouldBeProcessedWithTypescript","extensionName","extensionOptions","typescript","plugins","push","sourceFileName","presets","solid","solidRefresh","bundler","ast","sourceMaps","configFile","babelrc","parserOpts","babelUserOptions","babel","babelOptions","Promise","mergeAndConcat","code","transformAsync","Array","isArray","entries"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAMA,SAAO,GAAGC,sBAAa,CAACC,2PAAe,CAAC;AAE9C,MAAMC,iBAAiB,GAAG,iBAAiB;AAC3C,MAAMC,eAAe,GAAGJ,SAAO,CAACK,OAAO,CAAC,sCAAsC,CAAC;AAC/E,MAAMC,WAAW,GAAGC,eAAY,CAACH,eAAe,EAAE,OAAO,CAAC;AAE1D,MAAMI,OAAO,GAAG,CAACC,YAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;;AAE3C;;AAKA;;AA4IA,SAASC,YAAYA,CAACC,QAAgB,EAAU;AAC9C,EAAA,MAAMC,KAAK,GAAGD,QAAQ,CAACE,WAAW,CAAC,GAAG,CAAC;AACvC,EAAA,OAAOD,KAAK,GAAG,CAAC,GAAG,EAAE,GAAGD,QAAQ,CAACG,SAAS,CAACF,KAAK,CAAC,CAACG,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;AACxE;AACA,SAASC,kBAAkBA,CAACC,MAA2B,EAAE;AACvD,EAAA,MAAMC,IAA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module-url.ts","../../src/index.ts"],"sourcesContent":["import type { PluginObj, types as t } from '@babel/core';\n\nexport const LAZY_PLACEHOLDER_PREFIX = '__SOLID_LAZY_MODULE__:';\n\n/**\n * Detects whether a CallExpression argument is `() => import(\"specifier\")`\n * and returns the specifier string if so.\n */\nfunction extractDynamicImportSpecifier(node: t.Node): string | null {\n if (node.type !== 'ArrowFunctionExpression' && node.type !== 'FunctionExpression') return null;\n\n let callExpr: t.CallExpression | null = null;\n if (node.body.type === 'CallExpression') {\n callExpr = node.body;\n } else if (\n node.body.type === 'BlockStatement' &&\n node.body.body.length === 1 &&\n node.body.body[0].type === 'ReturnStatement' &&\n node.body.body[0].argument?.type === 'CallExpression'\n ) {\n callExpr = node.body.body[0].argument;\n }\n if (!callExpr) return null;\n\n if (callExpr.callee.type !== 'Import') return null;\n if (callExpr.arguments.length !== 1) return null;\n\n const arg = callExpr.arguments[0];\n if (arg.type !== 'StringLiteral') return null;\n\n return arg.value;\n}\n\n/**\n * Babel plugin that detects `lazy(() => import(\"specifier\"))` calls\n * and injects a placeholder as the second argument. The placeholder\n * is resolved to a real path by the Vite transform hook using this.resolve().\n */\nexport default function lazyModuleUrlPlugin(): PluginObj {\n return {\n name: 'solid-lazy-module-url',\n visitor: {\n CallExpression(nodePath, state) {\n if (!state.filename) return;\n const { node } = nodePath;\n\n if (node.callee.type !== 'Identifier' || node.callee.name !== 'lazy') return;\n\n const binding = nodePath.scope.getBinding('lazy');\n if (!binding || binding.kind !== 'module') return;\n const bindingPath = binding.path;\n if (\n bindingPath.type !== 'ImportSpecifier' ||\n bindingPath.parent.type !== 'ImportDeclaration'\n )\n return;\n const source = (bindingPath.parent as t.ImportDeclaration).source.value;\n if (source !== 'solid-js') return;\n\n if (node.arguments.length >= 2) return;\n if (node.arguments.length !== 1) return;\n\n const specifier = extractDynamicImportSpecifier(node.arguments[0] as t.Node);\n if (!specifier) return;\n\n node.arguments.push({\n type: 'StringLiteral',\n value: LAZY_PLACEHOLDER_PREFIX + specifier,\n } as t.StringLiteral);\n },\n },\n };\n}\n","import * as babel from '@babel/core';\nimport solid from 'babel-preset-solid';\nimport { readFileSync } from 'fs';\nimport { mergeAndConcat } from 'merge-anything';\nimport { createRequire } from 'module';\nimport solidRefresh from 'solid-refresh/babel';\n// TODO use proper path\nimport type { Options as RefreshOptions } from 'solid-refresh/babel';\nimport lazyModuleUrl, { LAZY_PLACEHOLDER_PREFIX } from './lazy-module-url.js';\nimport path from 'path';\nimport type { Alias, AliasOptions, FilterPattern, Plugin } from 'vite';\nimport { createFilter, version } from 'vite';\nimport { crawlFrameworkPkgs } from 'vitefu';\n\nconst require = createRequire(import.meta.url);\n\nconst runtimePublicPath = '/@solid-refresh';\nconst runtimeFilePath = require.resolve('solid-refresh/dist/solid-refresh.mjs');\nconst runtimeCode = readFileSync(runtimeFilePath, 'utf-8');\n\nconst isVite6 = +version.split('.')[0] >= 6;\n\n/** Possible options for the extensions property */\nexport interface ExtensionOptions {\n typescript?: boolean;\n}\n\n/** Configuration options for vite-plugin-solid. */\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 * This will inject solid-js/dev in place of solid-js in dev mode. Has no\n * effect in prod. If set to `false`, it won't inject it in dev. This is\n * useful for extra logs and debugging.\n *\n * @default true\n */\n dev?: boolean;\n /**\n * This will force SSR code in the produced files.\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 *\n * @default true\n * @deprecated use `refresh` instead\n */\n hot?: boolean;\n /**\n * This registers additional extensions that should be processed by\n * vite-plugin-solid.\n *\n * @default undefined\n */\n extensions?: (string | [string, ExtensionOptions])[];\n /**\n * Pass any additional babel transform options. They will be merged with\n * the transformations required by Solid.\n *\n * @default {}\n */\n babel?:\n | babel.TransformOptions\n | ((source: string, id: string, ssr: boolean) => babel.TransformOptions)\n | ((source: string, id: string, ssr: boolean) => Promise<babel.TransformOptions>);\n /**\n * Pass any additional [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/tree/main/packages/babel-plugin-jsx-dom-expressions#plugin-options).\n * They will be merged with the defaults sets by [babel-preset-solid](https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js#L8-L25).\n *\n * @default {}\n */\n solid?: {\n /**\n * Remove unnecessary closing tags from template strings. More info here:\n * https://github.com/solidjs/solid/blob/main/CHANGELOG.md#smaller-templates\n *\n * @default false\n */\n omitNestedClosingTags?: boolean;\n\n /**\n * Remove the last closing tag from template strings. Enabled by default even when `omitNestedClosingTags` is disabled.\n * Can be disabled for compatibility for some browser-like environments.\n *\n * @default true\n */\n omitLastClosingTag?: boolean;\n\n /**\n * Remove unnecessary quotes from template strings.\n * Can be disabled for compatibility for some browser-like environments.\n *\n * @default true\n */\n omitQuotes?: boolean;\n\n /**\n * The name of the runtime module to import the methods from.\n *\n * @default \"solid-js/web\"\n */\n moduleName?: string;\n\n /**\n * The output mode of the compiler.\n * Can be:\n * - \"dom\" is standard output\n * - \"ssr\" is for server side rendering of strings.\n * - \"universal\" is for using custom renderers from solid-js/universal\n *\n * @default \"dom\"\n */\n generate?: 'ssr' | 'dom' | 'universal';\n\n /**\n * Indicate whether the output should contain hydratable markers.\n *\n * @default false\n */\n hydratable?: boolean;\n\n /**\n * Boolean to indicate whether to enable automatic event delegation on camelCase.\n *\n * @default true\n */\n delegateEvents?: boolean;\n\n /**\n * Boolean indicates whether smart conditional detection should be used.\n * This optimizes simple boolean expressions and ternaries in JSX.\n *\n * @default true\n */\n wrapConditionals?: boolean;\n\n /**\n * Boolean indicates whether to set current render context on Custom Elements and slots.\n * Useful for seemless Context API with Web Components.\n *\n * @default true\n */\n contextToCustomElements?: boolean;\n\n /**\n * Array of Component exports from module, that aren't included by default with the library.\n * This plugin will automatically import them if it comes across them in the JSX.\n *\n * @default [\"For\",\"Show\",\"Switch\",\"Match\",\"Suspense\",\"SuspenseList\",\"Portal\",\"Index\",\"Dynamic\",\"ErrorBoundary\"]\n */\n builtIns?: string[];\n\n /**\n * Enable dev-mode compilation output. When true, the compiler emits\n * additional runtime checks (e.g. hydration mismatch assertions).\n * Automatically set to true during `vite dev` — override here to\n * force on or off.\n *\n * @default auto (true in dev, false in build)\n */\n dev?: boolean;\n };\n\n\n refresh: Omit<RefreshOptions & { disabled: boolean }, 'bundler' | 'fixRender' | 'jsx'>;\n}\n\nfunction getExtension(filename: string): string {\n const index = filename.lastIndexOf('.');\n return index < 0 ? '' : filename.substring(index).replace(/\\?.+$/, '');\n}\nfunction containsSolidField(fields: Record<string, any>) {\n const keys = Object.keys(fields);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (key === 'solid') return true;\n if (typeof fields[key] === 'object' && fields[key] != null && containsSolidField(fields[key]))\n return true;\n }\n return false;\n}\n\nfunction getJestDomExport(setupFiles: string[]) {\n return setupFiles?.some((path) => /jest-dom/.test(path))\n ? undefined\n : ['@testing-library/jest-dom/vitest', '@testing-library/jest-dom/extend-expect'].find(\n (path) => {\n try {\n require.resolve(path);\n return true;\n } catch (e) {\n return false;\n }\n },\n );\n}\n\nexport default function solidPlugin(options: Partial<Options> = {}): Plugin {\n const filter = createFilter(options.include, options.exclude);\n\n let needHmr = false;\n let replaceDev = false;\n let projectRoot = process.cwd();\n let isTestMode = false;\n let solidPkgsConfig: Awaited<ReturnType<typeof crawlFrameworkPkgs>>;\n\n return {\n name: 'solid',\n enforce: 'pre',\n\n async config(userConfig, { command }) {\n // We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode\n replaceDev = options.dev === true || (options.dev !== false && command === 'serve');\n projectRoot = userConfig.root || projectRoot;\n isTestMode = userConfig.mode === 'test';\n\n if (!userConfig.resolve) userConfig.resolve = {};\n userConfig.resolve.alias = normalizeAliases(userConfig.resolve && userConfig.resolve.alias);\n\n solidPkgsConfig = await crawlFrameworkPkgs({\n viteUserConfig: userConfig,\n root: projectRoot || process.cwd(),\n isBuild: command === 'build',\n isFrameworkPkgByJson(pkgJson) {\n return containsSolidField(pkgJson.exports || {});\n },\n });\n\n // fix for bundling dev in production\n const nestedDeps = replaceDev\n ? ['solid-js', '@solidjs/web']\n : [];\n\n const userTest = (userConfig as any).test ?? {};\n const test = {} as any;\n if (userConfig.mode === 'test') {\n // to simplify the processing of the config, we normalize the setupFiles to an array\n const userSetupFiles: string[] =\n typeof userTest.setupFiles === 'string'\n ? [userTest.setupFiles]\n : userTest.setupFiles || [];\n\n if (!userTest.environment && !options.ssr) {\n test.environment = 'jsdom';\n }\n\n if (\n !userTest.server?.deps?.external?.find((item: string | RegExp) =>\n /solid-js/.test(item.toString()),\n )\n ) {\n test.server = { deps: { external: [/solid-js/] } };\n }\n if (!userTest.browser?.enabled) {\n // vitest browser mode already has bundled jest-dom assertions\n // https://main.vitest.dev/guide/browser/assertion-api.html#assertion-api\n const jestDomImport = getJestDomExport(userSetupFiles);\n if (jestDomImport) {\n test.setupFiles = [jestDomImport];\n }\n }\n }\n\n return {\n /**\n * We only need esbuild on .ts or .js files.\n * .tsx & .jsx files are handled by us\n */\n // esbuild: { include: /\\.ts$/ },\n resolve: {\n conditions: isVite6\n ? undefined\n : [\n 'solid',\n ...(replaceDev ? ['development'] : []),\n ...(userConfig.mode === 'test' && !options.ssr ? ['browser'] : []),\n ],\n dedupe: nestedDeps,\n alias: [{ find: /^solid-refresh$/, replacement: runtimePublicPath }],\n },\n optimizeDeps: {\n include: [...nestedDeps, ...solidPkgsConfig.optimizeDeps.include],\n exclude: solidPkgsConfig.optimizeDeps.exclude,\n },\n ...(!isVite6 ? { ssr: solidPkgsConfig.ssr } : {}),\n ...(test.server ? { test } : {}),\n };\n },\n\n // @ts-ignore This hook only works in Vite 6\n async configEnvironment(name, config, opts) {\n config.resolve ??= {};\n // Emulate Vite default fallback for `resolve.conditions` if not set\n if (config.resolve.conditions == null) {\n // @ts-ignore These exports only exist in Vite 6\n const { defaultClientConditions, defaultServerConditions } = await import('vite');\n if (config.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) {\n config.resolve.conditions = [...defaultClientConditions];\n } else {\n config.resolve.conditions = [...defaultServerConditions];\n }\n }\n config.resolve.conditions = [\n 'solid',\n ...(replaceDev ? ['development'] : []),\n ...(isTestMode && !opts.isSsrTargetWebworker && !options.ssr ? ['browser'] : []),\n ...config.resolve.conditions,\n ];\n\n // Set resolve.noExternal and resolve.external for SSR environment (Vite 6+)\n // Only set resolve.external if noExternal is not true (to avoid conflicts with plugins like Cloudflare)\n if (isVite6 && name === 'ssr' && solidPkgsConfig) {\n if (config.resolve.noExternal !== true) {\n config.resolve.noExternal = [\n ...(Array.isArray(config.resolve.noExternal) ? config.resolve.noExternal : []),\n ...solidPkgsConfig.ssr.noExternal,\n ];\n config.resolve.external = [\n ...(Array.isArray(config.resolve.external) ? config.resolve.external : []),\n ...solidPkgsConfig.ssr.external,\n ];\n }\n }\n },\n\n configResolved(config) {\n needHmr = config.command === 'serve' && config.mode !== 'production' && (options.hot !== false && !options.refresh?.disabled);\n },\n\n resolveId(id) {\n if (id === runtimePublicPath) return id;\n },\n\n load(id) {\n if (id === runtimePublicPath) return runtimeCode;\n },\n\n async transform(source, id, transformOptions) {\n const isSsr = transformOptions && transformOptions.ssr;\n const currentFileExtension = getExtension(id);\n\n const extensionsToWatch = options.extensions || [];\n const allExtensions = extensionsToWatch.map((extension) =>\n // An extension can be a string or a tuple [extension, options]\n typeof extension === 'string' ? extension : extension[0],\n );\n\n if (!filter(id)) {\n return null;\n }\n\n id = id.replace(/\\?.*$/, '');\n\n if (!(/\\.[mc]?[tj]sx$/i.test(id) || allExtensions.includes(currentFileExtension))) {\n return null;\n }\n\n const inNodeModules = /node_modules/.test(id);\n\n let solidOptions: { generate: 'ssr' | 'dom'; hydratable: boolean };\n\n if (options.ssr) {\n if (isSsr) {\n solidOptions = { generate: 'ssr', hydratable: true };\n } else {\n solidOptions = { generate: 'dom', hydratable: true };\n }\n } else {\n solidOptions = { generate: 'dom', hydratable: false };\n }\n\n // We need to know if the current file extension has a typescript options tied to it\n const shouldBeProcessedWithTypescript =\n /\\.[mc]?tsx$/i.test(id) ||\n extensionsToWatch.some((extension) => {\n if (typeof extension === 'string') {\n return extension.includes('tsx');\n }\n\n const [extensionName, extensionOptions] = extension;\n if (extensionName !== currentFileExtension) return false;\n\n return extensionOptions.typescript;\n });\n const plugins: NonNullable<NonNullable<babel.TransformOptions['parserOpts']>['plugins']> = [\n 'jsx',\n 'decorators',\n ];\n\n if (shouldBeProcessedWithTypescript) {\n plugins.push('typescript');\n }\n\n const opts: babel.TransformOptions = {\n root: projectRoot,\n filename: id,\n sourceFileName: id,\n presets: [[solid, { ...solidOptions, dev: replaceDev, ...(options.solid || {}) }]],\n plugins: [\n [lazyModuleUrl],\n ...(needHmr && !isSsr && !inNodeModules ? [[solidRefresh, {\n ...(options.refresh || {}),\n bundler: 'vite',\n fixRender: true,\n // TODO unfortunately, even with SSR enabled for refresh\n // it still doesn't work, so now we have to disable\n // this config\n jsx: false,\n }]] : []),\n ],\n ast: false,\n sourceMaps: true,\n configFile: false,\n babelrc: false,\n parserOpts: {\n plugins,\n },\n };\n\n // Default value for babel user options\n let babelUserOptions: babel.TransformOptions = {};\n\n if (options.babel) {\n if (typeof options.babel === 'function') {\n const babelOptions = options.babel(source, id, !!isSsr);\n babelUserOptions = babelOptions instanceof Promise ? await babelOptions : babelOptions;\n } else {\n babelUserOptions = options.babel;\n }\n }\n\n const babelOptions = mergeAndConcat(babelUserOptions, opts) as babel.TransformOptions;\n\n const result = await babel.transformAsync(source, babelOptions);\n if (!result) {\n return undefined;\n }\n\n let code = result.code || '';\n\n // Resolve lazy() moduleUrl placeholders using Vite's resolver\n const placeholderRe = new RegExp(\n '\"' + LAZY_PLACEHOLDER_PREFIX + '([^\"]+)\"',\n 'g',\n );\n let match;\n const resolutions: Array<{ placeholder: string; resolved: string }> = [];\n while ((match = placeholderRe.exec(code)) !== null) {\n const specifier = match[1];\n const resolved = await this.resolve(specifier, id);\n if (resolved) {\n const cleanId = resolved.id.split('?')[0];\n resolutions.push({\n placeholder: match[0],\n resolved: '\"' + path.relative(projectRoot, cleanId) + '\"',\n });\n }\n }\n for (const { placeholder, resolved } of resolutions) {\n code = code.replace(placeholder, resolved);\n }\n\n return { code, map: result.map };\n },\n };\n}\n\n/**\n * This basically normalize all aliases of the config into\n * the array format of the alias.\n *\n * eg: alias: { '@': 'src/' } => [{ find: '@', replacement: 'src/' }]\n */\nfunction normalizeAliases(alias: AliasOptions = []): Alias[] {\n return Array.isArray(alias)\n ? alias\n : Object.entries(alias).map(([find, replacement]) => ({ find, replacement }));\n}\n\nexport type ViteManifest = Record<\n string,\n {\n file: string;\n css?: string[];\n isEntry?: boolean;\n isDynamicEntry?: boolean;\n imports?: string[];\n }\n>;\n\nlet _manifest: ViteManifest | undefined;\n\n/**\n * Returns the Vite asset manifest for SSR.\n * In production, reads and caches the manifest JSON from `manifestPath`.\n * In development (file not found), returns a proxy that maps each moduleUrl\n * to its dev server path, so lazy() asset resolution works without a build.\n */\nexport function getManifest(manifestPath?: string): ViteManifest {\n if (_manifest) return _manifest;\n if (manifestPath) {\n try {\n _manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));\n return _manifest!;\n } catch {\n // File doesn't exist — dev mode, fall through\n }\n }\n _manifest = new Proxy(\n {},\n {\n get(_, key) {\n if (typeof key !== 'string') return undefined;\n return { file: '/' + key };\n },\n },\n ) as ViteManifest;\n return _manifest;\n}\n"],"names":["LAZY_PLACEHOLDER_PREFIX","extractDynamicImportSpecifier","node","type","callExpr","body","length","argument","callee","arguments","arg","value","lazyModuleUrlPlugin","name","visitor","CallExpression","nodePath","state","filename","binding","scope","getBinding","kind","bindingPath","path","parent","source","specifier","push","require","createRequire","import","runtimePublicPath","runtimeFilePath","resolve","runtimeCode","readFileSync","isVite6","version","split","getExtension","index","lastIndexOf","substring","replace","containsSolidField","fields","keys","Object","i","key","getJestDomExport","setupFiles","some","test","undefined","find","e","solidPlugin","options","filter","createFilter","include","exclude","needHmr","replaceDev","projectRoot","process","cwd","isTestMode","solidPkgsConfig","enforce","config","userConfig","command","dev","root","mode","alias","normalizeAliases","crawlFrameworkPkgs","viteUserConfig","isBuild","isFrameworkPkgByJson","pkgJson","exports","nestedDeps","userTest","userSetupFiles","environment","ssr","server","deps","external","item","toString","browser","enabled","jestDomImport","conditions","dedupe","replacement","optimizeDeps","configEnvironment","opts","defaultClientConditions","defaultServerConditions","consumer","isSsrTargetWebworker","noExternal","Array","isArray","configResolved","hot","refresh","disabled","resolveId","id","load","transform","transformOptions","isSsr","currentFileExtension","extensionsToWatch","extensions","allExtensions","map","extension","includes","inNodeModules","solidOptions","generate","hydratable","shouldBeProcessedWithTypescript","extensionName","extensionOptions","typescript","plugins","sourceFileName","presets","solid","lazyModuleUrl","solidRefresh","bundler","fixRender","jsx","ast","sourceMaps","configFile","babelrc","parserOpts","babelUserOptions","babel","babelOptions","Promise","mergeAndConcat","result","transformAsync","code","placeholderRe","RegExp","match","resolutions","exec","resolved","cleanId","placeholder","relative","entries","_manifest","getManifest","manifestPath","JSON","parse","Proxy","get","_","file"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,uBAAuB,GAAG,wBAAwB;;AAE/D;AACA;AACA;AACA;AACA,SAASC,6BAA6BA,CAACC,IAAY,EAAiB;AAClE,EAAA,IAAIA,IAAI,CAACC,IAAI,KAAK,yBAAyB,IAAID,IAAI,CAACC,IAAI,KAAK,oBAAoB,EAAE,OAAO,IAAI;EAE9F,IAAIC,QAAiC,GAAG,IAAI;AAC5C,EAAA,IAAIF,IAAI,CAACG,IAAI,CAACF,IAAI,KAAK,gBAAgB,EAAE;IACvCC,QAAQ,GAAGF,IAAI,CAACG,IAAI;GACrB,MAAM,IACLH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A,OAAOF,SAAS;AAClB,KAAC,CAAC,MAAM;AACN;AAAA;AAEJ;AACAA,EAAAA,SAAS,GAAG,IAAIK,KAAK,CACnB,EAAE,EACF;AACEC,IAAAA,GAAGA,CAACC,CAAC,EAAE9H,GAAG,EAAE;AACV,MAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE,OAAOK,SAAS;MAC7C,OAAO;QAAE0H,IAAI,EAAE,GAAG,GAAG/H;OAAK;AAC5B;AACF,GACF,CAAiB;AACjB,EAAA,OAAOuH,SAAS;AAClB;;;;;"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -4,9 +4,66 @@ import { readFileSync } from 'fs';
|
|
|
4
4
|
import { mergeAndConcat } from 'merge-anything';
|
|
5
5
|
import { createRequire } from 'module';
|
|
6
6
|
import solidRefresh from 'solid-refresh/babel';
|
|
7
|
+
import path from 'path';
|
|
7
8
|
import { version, createFilter } from 'vite';
|
|
8
9
|
import { crawlFrameworkPkgs } from 'vitefu';
|
|
9
10
|
|
|
11
|
+
const LAZY_PLACEHOLDER_PREFIX = '__SOLID_LAZY_MODULE__:';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Detects whether a CallExpression argument is `() => import("specifier")`
|
|
15
|
+
* and returns the specifier string if so.
|
|
16
|
+
*/
|
|
17
|
+
function extractDynamicImportSpecifier(node) {
|
|
18
|
+
if (node.type !== 'ArrowFunctionExpression' && node.type !== 'FunctionExpression') return null;
|
|
19
|
+
let callExpr = null;
|
|
20
|
+
if (node.body.type === 'CallExpression') {
|
|
21
|
+
callExpr = node.body;
|
|
22
|
+
} else if (node.body.type === 'BlockStatement' && node.body.body.length === 1 && node.body.body[0].type === 'ReturnStatement' && node.body.body[0].argument?.type === 'CallExpression') {
|
|
23
|
+
callExpr = node.body.body[0].argument;
|
|
24
|
+
}
|
|
25
|
+
if (!callExpr) return null;
|
|
26
|
+
if (callExpr.callee.type !== 'Import') return null;
|
|
27
|
+
if (callExpr.arguments.length !== 1) return null;
|
|
28
|
+
const arg = callExpr.arguments[0];
|
|
29
|
+
if (arg.type !== 'StringLiteral') return null;
|
|
30
|
+
return arg.value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Babel plugin that detects `lazy(() => import("specifier"))` calls
|
|
35
|
+
* and injects a placeholder as the second argument. The placeholder
|
|
36
|
+
* is resolved to a real path by the Vite transform hook using this.resolve().
|
|
37
|
+
*/
|
|
38
|
+
function lazyModuleUrlPlugin() {
|
|
39
|
+
return {
|
|
40
|
+
name: 'solid-lazy-module-url',
|
|
41
|
+
visitor: {
|
|
42
|
+
CallExpression(nodePath, state) {
|
|
43
|
+
if (!state.filename) return;
|
|
44
|
+
const {
|
|
45
|
+
node
|
|
46
|
+
} = nodePath;
|
|
47
|
+
if (node.callee.type !== 'Identifier' || node.callee.name !== 'lazy') return;
|
|
48
|
+
const binding = nodePath.scope.getBinding('lazy');
|
|
49
|
+
if (!binding || binding.kind !== 'module') return;
|
|
50
|
+
const bindingPath = binding.path;
|
|
51
|
+
if (bindingPath.type !== 'ImportSpecifier' || bindingPath.parent.type !== 'ImportDeclaration') return;
|
|
52
|
+
const source = bindingPath.parent.source.value;
|
|
53
|
+
if (source !== 'solid-js') return;
|
|
54
|
+
if (node.arguments.length >= 2) return;
|
|
55
|
+
if (node.arguments.length !== 1) return;
|
|
56
|
+
const specifier = extractDynamicImportSpecifier(node.arguments[0]);
|
|
57
|
+
if (!specifier) return;
|
|
58
|
+
node.arguments.push({
|
|
59
|
+
type: 'StringLiteral',
|
|
60
|
+
value: LAZY_PLACEHOLDER_PREFIX + specifier
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
10
67
|
const require = createRequire(import.meta.url);
|
|
11
68
|
const runtimePublicPath = '/@solid-refresh';
|
|
12
69
|
const runtimeFilePath = require.resolve('solid-refresh/dist/solid-refresh.mjs');
|
|
@@ -46,6 +103,7 @@ function solidPlugin(options = {}) {
|
|
|
46
103
|
let replaceDev = false;
|
|
47
104
|
let projectRoot = process.cwd();
|
|
48
105
|
let isTestMode = false;
|
|
106
|
+
let solidPkgsConfig;
|
|
49
107
|
return {
|
|
50
108
|
name: 'solid',
|
|
51
109
|
enforce: 'pre',
|
|
@@ -54,11 +112,11 @@ function solidPlugin(options = {}) {
|
|
|
54
112
|
}) {
|
|
55
113
|
// We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode
|
|
56
114
|
replaceDev = options.dev === true || options.dev !== false && command === 'serve';
|
|
57
|
-
projectRoot = userConfig.root;
|
|
115
|
+
projectRoot = userConfig.root || projectRoot;
|
|
58
116
|
isTestMode = userConfig.mode === 'test';
|
|
59
117
|
if (!userConfig.resolve) userConfig.resolve = {};
|
|
60
118
|
userConfig.resolve.alias = normalizeAliases(userConfig.resolve && userConfig.resolve.alias);
|
|
61
|
-
|
|
119
|
+
solidPkgsConfig = await crawlFrameworkPkgs({
|
|
62
120
|
viteUserConfig: userConfig,
|
|
63
121
|
root: projectRoot || process.cwd(),
|
|
64
122
|
isBuild: command === 'build',
|
|
@@ -68,7 +126,7 @@ function solidPlugin(options = {}) {
|
|
|
68
126
|
});
|
|
69
127
|
|
|
70
128
|
// fix for bundling dev in production
|
|
71
|
-
const nestedDeps = replaceDev ? ['solid-js', '
|
|
129
|
+
const nestedDeps = replaceDev ? ['solid-js', '@solidjs/web'] : [];
|
|
72
130
|
const userTest = userConfig.test ?? {};
|
|
73
131
|
const test = {};
|
|
74
132
|
if (userConfig.mode === 'test') {
|
|
@@ -111,7 +169,9 @@ function solidPlugin(options = {}) {
|
|
|
111
169
|
include: [...nestedDeps, ...solidPkgsConfig.optimizeDeps.include],
|
|
112
170
|
exclude: solidPkgsConfig.optimizeDeps.exclude
|
|
113
171
|
},
|
|
114
|
-
|
|
172
|
+
...(!isVite6 ? {
|
|
173
|
+
ssr: solidPkgsConfig.ssr
|
|
174
|
+
} : {}),
|
|
115
175
|
...(test.server ? {
|
|
116
176
|
test
|
|
117
177
|
} : {})
|
|
@@ -134,9 +194,18 @@ function solidPlugin(options = {}) {
|
|
|
134
194
|
}
|
|
135
195
|
}
|
|
136
196
|
config.resolve.conditions = ['solid', ...(replaceDev ? ['development'] : []), ...(isTestMode && !opts.isSsrTargetWebworker && !options.ssr ? ['browser'] : []), ...config.resolve.conditions];
|
|
197
|
+
|
|
198
|
+
// Set resolve.noExternal and resolve.external for SSR environment (Vite 6+)
|
|
199
|
+
// Only set resolve.external if noExternal is not true (to avoid conflicts with plugins like Cloudflare)
|
|
200
|
+
if (isVite6 && name === 'ssr' && solidPkgsConfig) {
|
|
201
|
+
if (config.resolve.noExternal !== true) {
|
|
202
|
+
config.resolve.noExternal = [...(Array.isArray(config.resolve.noExternal) ? config.resolve.noExternal : []), ...solidPkgsConfig.ssr.noExternal];
|
|
203
|
+
config.resolve.external = [...(Array.isArray(config.resolve.external) ? config.resolve.external : []), ...solidPkgsConfig.ssr.external];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
137
206
|
},
|
|
138
207
|
configResolved(config) {
|
|
139
|
-
needHmr = config.command === 'serve' && config.mode !== 'production' && options.hot !== false;
|
|
208
|
+
needHmr = config.command === 'serve' && config.mode !== 'production' && options.hot !== false && !options.refresh?.disabled;
|
|
140
209
|
},
|
|
141
210
|
resolveId(id) {
|
|
142
211
|
if (id === runtimePublicPath) return id;
|
|
@@ -188,7 +257,7 @@ function solidPlugin(options = {}) {
|
|
|
188
257
|
if (extensionName !== currentFileExtension) return false;
|
|
189
258
|
return extensionOptions.typescript;
|
|
190
259
|
});
|
|
191
|
-
const plugins = ['jsx'];
|
|
260
|
+
const plugins = ['jsx', 'decorators'];
|
|
192
261
|
if (shouldBeProcessedWithTypescript) {
|
|
193
262
|
plugins.push('typescript');
|
|
194
263
|
}
|
|
@@ -198,11 +267,18 @@ function solidPlugin(options = {}) {
|
|
|
198
267
|
sourceFileName: id,
|
|
199
268
|
presets: [[solid, {
|
|
200
269
|
...solidOptions,
|
|
270
|
+
dev: replaceDev,
|
|
201
271
|
...(options.solid || {})
|
|
202
272
|
}]],
|
|
203
|
-
plugins: needHmr && !isSsr && !inNodeModules ? [[solidRefresh, {
|
|
204
|
-
|
|
205
|
-
|
|
273
|
+
plugins: [[lazyModuleUrlPlugin], ...(needHmr && !isSsr && !inNodeModules ? [[solidRefresh, {
|
|
274
|
+
...(options.refresh || {}),
|
|
275
|
+
bundler: 'vite',
|
|
276
|
+
fixRender: true,
|
|
277
|
+
// TODO unfortunately, even with SSR enabled for refresh
|
|
278
|
+
// it still doesn't work, so now we have to disable
|
|
279
|
+
// this config
|
|
280
|
+
jsx: false
|
|
281
|
+
}]] : [])],
|
|
206
282
|
ast: false,
|
|
207
283
|
sourceMaps: true,
|
|
208
284
|
configFile: false,
|
|
@@ -216,20 +292,43 @@ function solidPlugin(options = {}) {
|
|
|
216
292
|
let babelUserOptions = {};
|
|
217
293
|
if (options.babel) {
|
|
218
294
|
if (typeof options.babel === 'function') {
|
|
219
|
-
const babelOptions = options.babel(source, id, isSsr);
|
|
295
|
+
const babelOptions = options.babel(source, id, !!isSsr);
|
|
220
296
|
babelUserOptions = babelOptions instanceof Promise ? await babelOptions : babelOptions;
|
|
221
297
|
} else {
|
|
222
298
|
babelUserOptions = options.babel;
|
|
223
299
|
}
|
|
224
300
|
}
|
|
225
301
|
const babelOptions = mergeAndConcat(babelUserOptions, opts);
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
302
|
+
const result = await babel.transformAsync(source, babelOptions);
|
|
303
|
+
if (!result) {
|
|
304
|
+
return undefined;
|
|
305
|
+
}
|
|
306
|
+
let code = result.code || '';
|
|
307
|
+
|
|
308
|
+
// Resolve lazy() moduleUrl placeholders using Vite's resolver
|
|
309
|
+
const placeholderRe = new RegExp('"' + LAZY_PLACEHOLDER_PREFIX + '([^"]+)"', 'g');
|
|
310
|
+
let match;
|
|
311
|
+
const resolutions = [];
|
|
312
|
+
while ((match = placeholderRe.exec(code)) !== null) {
|
|
313
|
+
const specifier = match[1];
|
|
314
|
+
const resolved = await this.resolve(specifier, id);
|
|
315
|
+
if (resolved) {
|
|
316
|
+
const cleanId = resolved.id.split('?')[0];
|
|
317
|
+
resolutions.push({
|
|
318
|
+
placeholder: match[0],
|
|
319
|
+
resolved: '"' + path.relative(projectRoot, cleanId) + '"'
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
for (const {
|
|
324
|
+
placeholder,
|
|
325
|
+
resolved
|
|
326
|
+
} of resolutions) {
|
|
327
|
+
code = code.replace(placeholder, resolved);
|
|
328
|
+
}
|
|
230
329
|
return {
|
|
231
330
|
code,
|
|
232
|
-
map
|
|
331
|
+
map: result.map
|
|
233
332
|
};
|
|
234
333
|
}
|
|
235
334
|
};
|
|
@@ -247,6 +346,34 @@ function normalizeAliases(alias = []) {
|
|
|
247
346
|
replacement
|
|
248
347
|
}));
|
|
249
348
|
}
|
|
349
|
+
let _manifest;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Returns the Vite asset manifest for SSR.
|
|
353
|
+
* In production, reads and caches the manifest JSON from `manifestPath`.
|
|
354
|
+
* In development (file not found), returns a proxy that maps each moduleUrl
|
|
355
|
+
* to its dev server path, so lazy() asset resolution works without a build.
|
|
356
|
+
*/
|
|
357
|
+
function getManifest(manifestPath) {
|
|
358
|
+
if (_manifest) return _manifest;
|
|
359
|
+
if (manifestPath) {
|
|
360
|
+
try {
|
|
361
|
+
_manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
|
|
362
|
+
return _manifest;
|
|
363
|
+
} catch {
|
|
364
|
+
// File doesn't exist — dev mode, fall through
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
_manifest = new Proxy({}, {
|
|
368
|
+
get(_, key) {
|
|
369
|
+
if (typeof key !== 'string') return undefined;
|
|
370
|
+
return {
|
|
371
|
+
file: '/' + key
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
return _manifest;
|
|
376
|
+
}
|
|
250
377
|
|
|
251
|
-
export { solidPlugin as default };
|
|
378
|
+
export { solidPlugin as default, getManifest };
|
|
252
379
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import * as babel from '@babel/core';\nimport solid from 'babel-preset-solid';\nimport { readFileSync } from 'fs';\nimport { mergeAndConcat } from 'merge-anything';\nimport { createRequire } from 'module';\nimport solidRefresh from 'solid-refresh/babel';\nimport type { Alias, AliasOptions, FilterPattern, Plugin } from 'vite';\nimport { createFilter, version } from 'vite';\nimport { crawlFrameworkPkgs } from 'vitefu';\n\nconst require = createRequire(import.meta.url);\n\nconst runtimePublicPath = '/@solid-refresh';\nconst runtimeFilePath = require.resolve('solid-refresh/dist/solid-refresh.mjs');\nconst runtimeCode = readFileSync(runtimeFilePath, 'utf-8');\n\nconst isVite6 = +version.split('.')[0] >= 6;\n\n/** Possible options for the extensions property */\nexport interface ExtensionOptions {\n typescript?: boolean;\n}\n\n/** Configuration options for vite-plugin-solid. */\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 * This will inject solid-js/dev in place of solid-js in dev mode. Has no\n * effect in prod. If set to `false`, it won't inject it in dev. This is\n * useful for extra logs and debugging.\n *\n * @default true\n */\n dev?: boolean;\n /**\n * This will force SSR code in the produced files.\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 *\n * @default true\n */\n hot?: boolean;\n /**\n * This registers additional extensions that should be processed by\n * vite-plugin-solid.\n *\n * @default undefined\n */\n extensions?: (string | [string, ExtensionOptions])[];\n /**\n * Pass any additional babel transform options. They will be merged with\n * the transformations required by Solid.\n *\n * @default {}\n */\n babel?:\n | babel.TransformOptions\n | ((source: string, id: string, ssr: boolean) => babel.TransformOptions)\n | ((source: string, id: string, ssr: boolean) => Promise<babel.TransformOptions>);\n /**\n * Pass any additional [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/tree/main/packages/babel-plugin-jsx-dom-expressions#plugin-options).\n * They will be merged with the defaults sets by [babel-preset-solid](https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js#L8-L25).\n *\n * @default {}\n */\n solid?: {\n /**\n * Remove unnecessary closing tags from template strings. More info here:\n * https://github.com/solidjs/solid/blob/main/CHANGELOG.md#smaller-templates\n *\n * @default false\n */\n omitNestedClosingTags?: boolean;\n\n /**\n * Remove the last closing tag from template strings. Enabled by default even when `omitNestedClosingTags` is disabled.\n * Can be disabled for compatibility for some browser-like environments.\n *\n * @default true\n */\n omitLastClosingTag?: boolean;\n\n /**\n * Remove unnecessary quotes from template strings.\n * Can be disabled for compatibility for some browser-like environments.\n *\n * @default true\n */\n omitQuotes?: boolean;\n\n /**\n * The name of the runtime module to import the methods from.\n *\n * @default \"solid-js/web\"\n */\n moduleName?: string;\n\n /**\n * The output mode of the compiler.\n * Can be:\n * - \"dom\" is standard output\n * - \"ssr\" is for server side rendering of strings.\n * - \"universal\" is for using custom renderers from solid-js/universal\n *\n * @default \"dom\"\n */\n generate?: 'ssr' | 'dom' | 'universal';\n\n /**\n * Indicate whether the output should contain hydratable markers.\n *\n * @default false\n */\n hydratable?: boolean;\n\n /**\n * Boolean to indicate whether to enable automatic event delegation on camelCase.\n *\n * @default true\n */\n delegateEvents?: boolean;\n\n /**\n * Boolean indicates whether smart conditional detection should be used.\n * This optimizes simple boolean expressions and ternaries in JSX.\n *\n * @default true\n */\n wrapConditionals?: boolean;\n\n /**\n * Boolean indicates whether to set current render context on Custom Elements and slots.\n * Useful for seemless Context API with Web Components.\n *\n * @default true\n */\n contextToCustomElements?: boolean;\n\n /**\n * Array of Component exports from module, that aren't included by default with the library.\n * This plugin will automatically import them if it comes across them in the JSX.\n *\n * @default [\"For\",\"Show\",\"Switch\",\"Match\",\"Suspense\",\"SuspenseList\",\"Portal\",\"Index\",\"Dynamic\",\"ErrorBoundary\"]\n */\n builtIns?: string[];\n };\n}\n\nfunction getExtension(filename: string): string {\n const index = filename.lastIndexOf('.');\n return index < 0 ? '' : filename.substring(index).replace(/\\?.+$/, '');\n}\nfunction containsSolidField(fields: Record<string, any>) {\n const keys = Object.keys(fields);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (key === 'solid') return true;\n if (typeof fields[key] === 'object' && fields[key] != null && containsSolidField(fields[key]))\n return true;\n }\n return false;\n}\n\nfunction getJestDomExport(setupFiles: string[]) {\n return setupFiles?.some((path) => /jest-dom/.test(path))\n ? undefined\n : ['@testing-library/jest-dom/vitest', '@testing-library/jest-dom/extend-expect'].find(\n (path) => {\n try {\n require.resolve(path);\n return true;\n } catch (e) {\n return false;\n }\n },\n );\n}\n\nexport default function solidPlugin(options: Partial<Options> = {}): Plugin {\n const filter = createFilter(options.include, options.exclude);\n\n let needHmr = false;\n let replaceDev = false;\n let projectRoot = process.cwd();\n let isTestMode = false;\n\n return {\n name: 'solid',\n enforce: 'pre',\n\n async config(userConfig, { command }) {\n // We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode\n replaceDev = options.dev === true || (options.dev !== false && command === 'serve');\n projectRoot = userConfig.root;\n isTestMode = userConfig.mode === 'test';\n\n if (!userConfig.resolve) userConfig.resolve = {};\n userConfig.resolve.alias = normalizeAliases(userConfig.resolve && userConfig.resolve.alias);\n\n const solidPkgsConfig = await crawlFrameworkPkgs({\n viteUserConfig: userConfig,\n root: projectRoot || process.cwd(),\n isBuild: command === 'build',\n isFrameworkPkgByJson(pkgJson) {\n return containsSolidField(pkgJson.exports || {});\n },\n });\n\n // fix for bundling dev in production\n const nestedDeps = replaceDev\n ? ['solid-js', 'solid-js/web', 'solid-js/store', 'solid-js/html', 'solid-js/h']\n : [];\n\n const userTest = (userConfig as any).test ?? {};\n const test = {} as any;\n if (userConfig.mode === 'test') {\n // to simplify the processing of the config, we normalize the setupFiles to an array\n const userSetupFiles: string[] =\n typeof userTest.setupFiles === 'string'\n ? [userTest.setupFiles]\n : userTest.setupFiles || [];\n\n if (!userTest.environment && !options.ssr) {\n test.environment = 'jsdom';\n }\n\n if (\n !userTest.server?.deps?.external?.find((item: string | RegExp) =>\n /solid-js/.test(item.toString()),\n )\n ) {\n test.server = { deps: { external: [/solid-js/] } };\n }\n if (!userTest.browser?.enabled) {\n // vitest browser mode already has bundled jest-dom assertions\n // https://main.vitest.dev/guide/browser/assertion-api.html#assertion-api\n const jestDomImport = getJestDomExport(userSetupFiles);\n if (jestDomImport) {\n test.setupFiles = [jestDomImport];\n }\n }\n }\n\n return {\n /**\n * We only need esbuild on .ts or .js files.\n * .tsx & .jsx files are handled by us\n */\n // esbuild: { include: /\\.ts$/ },\n resolve: {\n conditions: isVite6\n ? undefined\n : [\n 'solid',\n ...(replaceDev ? ['development'] : []),\n ...(userConfig.mode === 'test' && !options.ssr ? ['browser'] : []),\n ],\n dedupe: nestedDeps,\n alias: [{ find: /^solid-refresh$/, replacement: runtimePublicPath }],\n },\n optimizeDeps: {\n include: [...nestedDeps, ...solidPkgsConfig.optimizeDeps.include],\n exclude: solidPkgsConfig.optimizeDeps.exclude,\n },\n ssr: solidPkgsConfig.ssr,\n ...(test.server ? { test } : {}),\n };\n },\n\n // @ts-ignore This hook only works in Vite 6\n async configEnvironment(name, config, opts) {\n config.resolve ??= {};\n // Emulate Vite default fallback for `resolve.conditions` if not set\n if (config.resolve.conditions == null) {\n // @ts-ignore These exports only exist in Vite 6\n const { defaultClientConditions, defaultServerConditions } = await import('vite');\n if (config.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) {\n config.resolve.conditions = [...defaultClientConditions];\n } else {\n config.resolve.conditions = [...defaultServerConditions];\n }\n }\n config.resolve.conditions = [\n 'solid',\n ...(replaceDev ? ['development'] : []),\n ...(isTestMode && !opts.isSsrTargetWebworker && !options.ssr ? ['browser'] : []),\n ...config.resolve.conditions,\n ];\n },\n\n configResolved(config) {\n needHmr = config.command === 'serve' && config.mode !== 'production' && options.hot !== false;\n },\n\n resolveId(id) {\n if (id === runtimePublicPath) return id;\n },\n\n load(id) {\n if (id === runtimePublicPath) return runtimeCode;\n },\n\n async transform(source, id, transformOptions) {\n const isSsr = transformOptions && transformOptions.ssr;\n const currentFileExtension = getExtension(id);\n\n const extensionsToWatch = options.extensions || [];\n const allExtensions = extensionsToWatch.map((extension) =>\n // An extension can be a string or a tuple [extension, options]\n typeof extension === 'string' ? extension : extension[0],\n );\n\n if (!filter(id)) {\n return null;\n }\n\n id = id.replace(/\\?.*$/, '');\n\n if (!(/\\.[mc]?[tj]sx$/i.test(id) || allExtensions.includes(currentFileExtension))) {\n return null;\n }\n\n const inNodeModules = /node_modules/.test(id);\n\n let solidOptions: { generate: 'ssr' | 'dom'; hydratable: boolean };\n\n if (options.ssr) {\n if (isSsr) {\n solidOptions = { generate: 'ssr', hydratable: true };\n } else {\n solidOptions = { generate: 'dom', hydratable: true };\n }\n } else {\n solidOptions = { generate: 'dom', hydratable: false };\n }\n\n // We need to know if the current file extension has a typescript options tied to it\n const shouldBeProcessedWithTypescript =\n /\\.[mc]?tsx$/i.test(id) ||\n extensionsToWatch.some((extension) => {\n if (typeof extension === 'string') {\n return extension.includes('tsx');\n }\n\n const [extensionName, extensionOptions] = extension;\n if (extensionName !== currentFileExtension) return false;\n\n return extensionOptions.typescript;\n });\n const plugins: NonNullable<NonNullable<babel.TransformOptions['parserOpts']>['plugins']> = [\n 'jsx',\n ];\n\n if (shouldBeProcessedWithTypescript) {\n plugins.push('typescript');\n }\n\n const opts: babel.TransformOptions = {\n root: projectRoot,\n filename: id,\n sourceFileName: id,\n presets: [[solid, { ...solidOptions, ...(options.solid || {}) }]],\n plugins: needHmr && !isSsr && !inNodeModules ? [[solidRefresh, { bundler: 'vite' }]] : [],\n ast: false,\n sourceMaps: true,\n configFile: false,\n babelrc: false,\n parserOpts: {\n plugins,\n },\n };\n\n // Default value for babel user options\n let babelUserOptions: babel.TransformOptions = {};\n\n if (options.babel) {\n if (typeof options.babel === 'function') {\n const babelOptions = options.babel(source, id, isSsr);\n babelUserOptions = babelOptions instanceof Promise ? await babelOptions : babelOptions;\n } else {\n babelUserOptions = options.babel;\n }\n }\n\n const babelOptions = mergeAndConcat(babelUserOptions, opts) as babel.TransformOptions;\n\n const { code, map } = await babel.transformAsync(source, babelOptions);\n\n return { code, map };\n },\n };\n}\n\n/**\n * This basically normalize all aliases of the config into\n * the array format of the alias.\n *\n * eg: alias: { '@': 'src/' } => [{ find: '@', replacement: 'src/' }]\n */\nfunction normalizeAliases(alias: AliasOptions = []): Alias[] {\n return Array.isArray(alias)\n ? alias\n : Object.entries(alias).map(([find, replacement]) => ({ find, replacement }));\n}\n"],"names":["require","createRequire","import","meta","url","runtimePublicPath","runtimeFilePath","resolve","runtimeCode","readFileSync","isVite6","version","split","getExtension","filename","index","lastIndexOf","substring","replace","containsSolidField","fields","keys","Object","i","length","key","getJestDomExport","setupFiles","some","path","test","undefined","find","e","solidPlugin","options","filter","createFilter","include","exclude","needHmr","replaceDev","projectRoot","process","cwd","isTestMode","name","enforce","config","userConfig","command","dev","root","mode","alias","normalizeAliases","solidPkgsConfig","crawlFrameworkPkgs","viteUserConfig","isBuild","isFrameworkPkgByJson","pkgJson","exports","nestedDeps","userTest","userSetupFiles","environment","ssr","server","deps","external","item","toString","browser","enabled","jestDomImport","conditions","dedupe","replacement","optimizeDeps","configEnvironment","opts","defaultClientConditions","defaultServerConditions","consumer","isSsrTargetWebworker","configResolved","hot","resolveId","id","load","transform","source","transformOptions","isSsr","currentFileExtension","extensionsToWatch","extensions","allExtensions","map","extension","includes","inNodeModules","solidOptions","generate","hydratable","shouldBeProcessedWithTypescript","extensionName","extensionOptions","typescript","plugins","push","sourceFileName","presets","solid","solidRefresh","bundler","ast","sourceMaps","configFile","babelrc","parserOpts","babelUserOptions","babel","babelOptions","Promise","mergeAndConcat","code","transformAsync","Array","isArray","entries"],"mappings":";;;;;;;;;AAUA,MAAMA,OAAO,GAAGC,aAAa,CAACC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC;AAE9C,MAAMC,iBAAiB,GAAG,iBAAiB;AAC3C,MAAMC,eAAe,GAAGN,OAAO,CAACO,OAAO,CAAC,sCAAsC,CAAC;AAC/E,MAAMC,WAAW,GAAGC,YAAY,CAACH,eAAe,EAAE,OAAO,CAAC;AAE1D,MAAMI,OAAO,GAAG,CAACC,OAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;;AAE3C;;AAKA;;AA4IA,SAASC,YAAYA,CAACC,QAAgB,EAAU;AAC9C,EAAA,MAAMC,KAAK,GAAGD,QAAQ,CAACE,WAAW,CAAC,GAAG,CAAC;AACvC,EAAA,OAAOD,KAAK,GAAG,CAAC,GAAG,EAAE,GAAGD,QAAQ,CAACG,SAAS,CAACF,KAAK,CAAC,CAACG,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;AACxE;AACA,SAASC,kBAAkBA,CAACC,MAA2B,EAAE;AACvD,EAAA,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,MAAM,CAAC;AAChC,EAAA,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;AACpC,IAAA,MAAME,GAAG,GAAGJ,IAAI,CAACE,CAAC,CAAC;AACnB,IAAA,IAAIE,GAAG,KAAK,OAAO,EAAE,OAAO,IAAI;IAChC,IAAI,OAAOL,MAAM,CAACK,GAAG,CAAC,KAAK,QAAQ,IAAIL,MAAM,CAACK,GAAG,CAAC,IAAI,IAAI,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MC,YAAY,GAAGzF,OAAO,CAACwF,KAAK,CAAC/B,MAAM,EAAEH,EAAE,EAAEK,KAAK,CAAC;UACrD4B,gBAAgB,GAAGE,YAAY,YAAYC,OAAO,GAAG,MAAMD,YAAY,GAAGA,YAAY;AACxF,SAAC,MAAM;UACLF,gBAAgB,GAAGvF,OAAO,CAACwF,KAAK;AAClC;AACF;AAEA,MAAA,MAAMC,YAAY,GAAGE,cAAc,CAACJ,gBAAgB,EAAEzC,IAAI,CAA2B;MAErF,MAAM;QAAE8C,IAAI;AAAE5B,QAAAA;OAAK,GAAG,MAAMwB,KAAK,CAACK,cAAc,CAACpC,MAAM,EAAEgC,YAAY,CAAC;MAEtE,OAAO;QAAEG,IAAI;AAAE5B,QAAAA;OAAK;AACtB;GACD;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS5C,gBAAgBA,CAACD,KAAmB,GAAG,EAAE,EAAW;EAC3D,OAAO2E,KAAK,CAACC,OAAO,CAAC5E,KAAK,CAAC,GACvBA,KAAK,GACLhC,MAAM,CAAC6G,OAAO,CAAC7E,KAAK,CAAC,CAAC6C,GAAG,CAAC,CAAC,CAACnE,IAAI,EAAE8C,WAAW,CAAC,MAAM;IAAE9C,IAAI;AAAE8C,IAAAA;AAAY,GAAC,CAAC,CAAC;AACjF;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/lazy-module-url.ts","../../src/index.ts"],"sourcesContent":["import type { PluginObj, types as t } from '@babel/core';\n\nexport const LAZY_PLACEHOLDER_PREFIX = '__SOLID_LAZY_MODULE__:';\n\n/**\n * Detects whether a CallExpression argument is `() => import(\"specifier\")`\n * and returns the specifier string if so.\n */\nfunction extractDynamicImportSpecifier(node: t.Node): string | null {\n if (node.type !== 'ArrowFunctionExpression' && node.type !== 'FunctionExpression') return null;\n\n let callExpr: t.CallExpression | null = null;\n if (node.body.type === 'CallExpression') {\n callExpr = node.body;\n } else if (\n node.body.type === 'BlockStatement' &&\n node.body.body.length === 1 &&\n node.body.body[0].type === 'ReturnStatement' &&\n node.body.body[0].argument?.type === 'CallExpression'\n ) {\n callExpr = node.body.body[0].argument;\n }\n if (!callExpr) return null;\n\n if (callExpr.callee.type !== 'Import') return null;\n if (callExpr.arguments.length !== 1) return null;\n\n const arg = callExpr.arguments[0];\n if (arg.type !== 'StringLiteral') return null;\n\n return arg.value;\n}\n\n/**\n * Babel plugin that detects `lazy(() => import(\"specifier\"))` calls\n * and injects a placeholder as the second argument. The placeholder\n * is resolved to a real path by the Vite transform hook using this.resolve().\n */\nexport default function lazyModuleUrlPlugin(): PluginObj {\n return {\n name: 'solid-lazy-module-url',\n visitor: {\n CallExpression(nodePath, state) {\n if (!state.filename) return;\n const { node } = nodePath;\n\n if (node.callee.type !== 'Identifier' || node.callee.name !== 'lazy') return;\n\n const binding = nodePath.scope.getBinding('lazy');\n if (!binding || binding.kind !== 'module') return;\n const bindingPath = binding.path;\n if (\n bindingPath.type !== 'ImportSpecifier' ||\n bindingPath.parent.type !== 'ImportDeclaration'\n )\n return;\n const source = (bindingPath.parent as t.ImportDeclaration).source.value;\n if (source !== 'solid-js') return;\n\n if (node.arguments.length >= 2) return;\n if (node.arguments.length !== 1) return;\n\n const specifier = extractDynamicImportSpecifier(node.arguments[0] as t.Node);\n if (!specifier) return;\n\n node.arguments.push({\n type: 'StringLiteral',\n value: LAZY_PLACEHOLDER_PREFIX + specifier,\n } as t.StringLiteral);\n },\n },\n };\n}\n","import * as babel from '@babel/core';\nimport solid from 'babel-preset-solid';\nimport { readFileSync } from 'fs';\nimport { mergeAndConcat } from 'merge-anything';\nimport { createRequire } from 'module';\nimport solidRefresh from 'solid-refresh/babel';\n// TODO use proper path\nimport type { Options as RefreshOptions } from 'solid-refresh/babel';\nimport lazyModuleUrl, { LAZY_PLACEHOLDER_PREFIX } from './lazy-module-url.js';\nimport path from 'path';\nimport type { Alias, AliasOptions, FilterPattern, Plugin } from 'vite';\nimport { createFilter, version } from 'vite';\nimport { crawlFrameworkPkgs } from 'vitefu';\n\nconst require = createRequire(import.meta.url);\n\nconst runtimePublicPath = '/@solid-refresh';\nconst runtimeFilePath = require.resolve('solid-refresh/dist/solid-refresh.mjs');\nconst runtimeCode = readFileSync(runtimeFilePath, 'utf-8');\n\nconst isVite6 = +version.split('.')[0] >= 6;\n\n/** Possible options for the extensions property */\nexport interface ExtensionOptions {\n typescript?: boolean;\n}\n\n/** Configuration options for vite-plugin-solid. */\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 * This will inject solid-js/dev in place of solid-js in dev mode. Has no\n * effect in prod. If set to `false`, it won't inject it in dev. This is\n * useful for extra logs and debugging.\n *\n * @default true\n */\n dev?: boolean;\n /**\n * This will force SSR code in the produced files.\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 *\n * @default true\n * @deprecated use `refresh` instead\n */\n hot?: boolean;\n /**\n * This registers additional extensions that should be processed by\n * vite-plugin-solid.\n *\n * @default undefined\n */\n extensions?: (string | [string, ExtensionOptions])[];\n /**\n * Pass any additional babel transform options. They will be merged with\n * the transformations required by Solid.\n *\n * @default {}\n */\n babel?:\n | babel.TransformOptions\n | ((source: string, id: string, ssr: boolean) => babel.TransformOptions)\n | ((source: string, id: string, ssr: boolean) => Promise<babel.TransformOptions>);\n /**\n * Pass any additional [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/tree/main/packages/babel-plugin-jsx-dom-expressions#plugin-options).\n * They will be merged with the defaults sets by [babel-preset-solid](https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js#L8-L25).\n *\n * @default {}\n */\n solid?: {\n /**\n * Remove unnecessary closing tags from template strings. More info here:\n * https://github.com/solidjs/solid/blob/main/CHANGELOG.md#smaller-templates\n *\n * @default false\n */\n omitNestedClosingTags?: boolean;\n\n /**\n * Remove the last closing tag from template strings. Enabled by default even when `omitNestedClosingTags` is disabled.\n * Can be disabled for compatibility for some browser-like environments.\n *\n * @default true\n */\n omitLastClosingTag?: boolean;\n\n /**\n * Remove unnecessary quotes from template strings.\n * Can be disabled for compatibility for some browser-like environments.\n *\n * @default true\n */\n omitQuotes?: boolean;\n\n /**\n * The name of the runtime module to import the methods from.\n *\n * @default \"solid-js/web\"\n */\n moduleName?: string;\n\n /**\n * The output mode of the compiler.\n * Can be:\n * - \"dom\" is standard output\n * - \"ssr\" is for server side rendering of strings.\n * - \"universal\" is for using custom renderers from solid-js/universal\n *\n * @default \"dom\"\n */\n generate?: 'ssr' | 'dom' | 'universal';\n\n /**\n * Indicate whether the output should contain hydratable markers.\n *\n * @default false\n */\n hydratable?: boolean;\n\n /**\n * Boolean to indicate whether to enable automatic event delegation on camelCase.\n *\n * @default true\n */\n delegateEvents?: boolean;\n\n /**\n * Boolean indicates whether smart conditional detection should be used.\n * This optimizes simple boolean expressions and ternaries in JSX.\n *\n * @default true\n */\n wrapConditionals?: boolean;\n\n /**\n * Boolean indicates whether to set current render context on Custom Elements and slots.\n * Useful for seemless Context API with Web Components.\n *\n * @default true\n */\n contextToCustomElements?: boolean;\n\n /**\n * Array of Component exports from module, that aren't included by default with the library.\n * This plugin will automatically import them if it comes across them in the JSX.\n *\n * @default [\"For\",\"Show\",\"Switch\",\"Match\",\"Suspense\",\"SuspenseList\",\"Portal\",\"Index\",\"Dynamic\",\"ErrorBoundary\"]\n */\n builtIns?: string[];\n\n /**\n * Enable dev-mode compilation output. When true, the compiler emits\n * additional runtime checks (e.g. hydration mismatch assertions).\n * Automatically set to true during `vite dev` — override here to\n * force on or off.\n *\n * @default auto (true in dev, false in build)\n */\n dev?: boolean;\n };\n\n\n refresh: Omit<RefreshOptions & { disabled: boolean }, 'bundler' | 'fixRender' | 'jsx'>;\n}\n\nfunction getExtension(filename: string): string {\n const index = filename.lastIndexOf('.');\n return index < 0 ? '' : filename.substring(index).replace(/\\?.+$/, '');\n}\nfunction containsSolidField(fields: Record<string, any>) {\n const keys = Object.keys(fields);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (key === 'solid') return true;\n if (typeof fields[key] === 'object' && fields[key] != null && containsSolidField(fields[key]))\n return true;\n }\n return false;\n}\n\nfunction getJestDomExport(setupFiles: string[]) {\n return setupFiles?.some((path) => /jest-dom/.test(path))\n ? undefined\n : ['@testing-library/jest-dom/vitest', '@testing-library/jest-dom/extend-expect'].find(\n (path) => {\n try {\n require.resolve(path);\n return true;\n } catch (e) {\n return false;\n }\n },\n );\n}\n\nexport default function solidPlugin(options: Partial<Options> = {}): Plugin {\n const filter = createFilter(options.include, options.exclude);\n\n let needHmr = false;\n let replaceDev = false;\n let projectRoot = process.cwd();\n let isTestMode = false;\n let solidPkgsConfig: Awaited<ReturnType<typeof crawlFrameworkPkgs>>;\n\n return {\n name: 'solid',\n enforce: 'pre',\n\n async config(userConfig, { command }) {\n // We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode\n replaceDev = options.dev === true || (options.dev !== false && command === 'serve');\n projectRoot = userConfig.root || projectRoot;\n isTestMode = userConfig.mode === 'test';\n\n if (!userConfig.resolve) userConfig.resolve = {};\n userConfig.resolve.alias = normalizeAliases(userConfig.resolve && userConfig.resolve.alias);\n\n solidPkgsConfig = await crawlFrameworkPkgs({\n viteUserConfig: userConfig,\n root: projectRoot || process.cwd(),\n isBuild: command === 'build',\n isFrameworkPkgByJson(pkgJson) {\n return containsSolidField(pkgJson.exports || {});\n },\n });\n\n // fix for bundling dev in production\n const nestedDeps = replaceDev\n ? ['solid-js', '@solidjs/web']\n : [];\n\n const userTest = (userConfig as any).test ?? {};\n const test = {} as any;\n if (userConfig.mode === 'test') {\n // to simplify the processing of the config, we normalize the setupFiles to an array\n const userSetupFiles: string[] =\n typeof userTest.setupFiles === 'string'\n ? [userTest.setupFiles]\n : userTest.setupFiles || [];\n\n if (!userTest.environment && !options.ssr) {\n test.environment = 'jsdom';\n }\n\n if (\n !userTest.server?.deps?.external?.find((item: string | RegExp) =>\n /solid-js/.test(item.toString()),\n )\n ) {\n test.server = { deps: { external: [/solid-js/] } };\n }\n if (!userTest.browser?.enabled) {\n // vitest browser mode already has bundled jest-dom assertions\n // https://main.vitest.dev/guide/browser/assertion-api.html#assertion-api\n const jestDomImport = getJestDomExport(userSetupFiles);\n if (jestDomImport) {\n test.setupFiles = [jestDomImport];\n }\n }\n }\n\n return {\n /**\n * We only need esbuild on .ts or .js files.\n * .tsx & .jsx files are handled by us\n */\n // esbuild: { include: /\\.ts$/ },\n resolve: {\n conditions: isVite6\n ? undefined\n : [\n 'solid',\n ...(replaceDev ? ['development'] : []),\n ...(userConfig.mode === 'test' && !options.ssr ? ['browser'] : []),\n ],\n dedupe: nestedDeps,\n alias: [{ find: /^solid-refresh$/, replacement: runtimePublicPath }],\n },\n optimizeDeps: {\n include: [...nestedDeps, ...solidPkgsConfig.optimizeDeps.include],\n exclude: solidPkgsConfig.optimizeDeps.exclude,\n },\n ...(!isVite6 ? { ssr: solidPkgsConfig.ssr } : {}),\n ...(test.server ? { test } : {}),\n };\n },\n\n // @ts-ignore This hook only works in Vite 6\n async configEnvironment(name, config, opts) {\n config.resolve ??= {};\n // Emulate Vite default fallback for `resolve.conditions` if not set\n if (config.resolve.conditions == null) {\n // @ts-ignore These exports only exist in Vite 6\n const { defaultClientConditions, defaultServerConditions } = await import('vite');\n if (config.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) {\n config.resolve.conditions = [...defaultClientConditions];\n } else {\n config.resolve.conditions = [...defaultServerConditions];\n }\n }\n config.resolve.conditions = [\n 'solid',\n ...(replaceDev ? ['development'] : []),\n ...(isTestMode && !opts.isSsrTargetWebworker && !options.ssr ? ['browser'] : []),\n ...config.resolve.conditions,\n ];\n\n // Set resolve.noExternal and resolve.external for SSR environment (Vite 6+)\n // Only set resolve.external if noExternal is not true (to avoid conflicts with plugins like Cloudflare)\n if (isVite6 && name === 'ssr' && solidPkgsConfig) {\n if (config.resolve.noExternal !== true) {\n config.resolve.noExternal = [\n ...(Array.isArray(config.resolve.noExternal) ? config.resolve.noExternal : []),\n ...solidPkgsConfig.ssr.noExternal,\n ];\n config.resolve.external = [\n ...(Array.isArray(config.resolve.external) ? config.resolve.external : []),\n ...solidPkgsConfig.ssr.external,\n ];\n }\n }\n },\n\n configResolved(config) {\n needHmr = config.command === 'serve' && config.mode !== 'production' && (options.hot !== false && !options.refresh?.disabled);\n },\n\n resolveId(id) {\n if (id === runtimePublicPath) return id;\n },\n\n load(id) {\n if (id === runtimePublicPath) return runtimeCode;\n },\n\n async transform(source, id, transformOptions) {\n const isSsr = transformOptions && transformOptions.ssr;\n const currentFileExtension = getExtension(id);\n\n const extensionsToWatch = options.extensions || [];\n const allExtensions = extensionsToWatch.map((extension) =>\n // An extension can be a string or a tuple [extension, options]\n typeof extension === 'string' ? extension : extension[0],\n );\n\n if (!filter(id)) {\n return null;\n }\n\n id = id.replace(/\\?.*$/, '');\n\n if (!(/\\.[mc]?[tj]sx$/i.test(id) || allExtensions.includes(currentFileExtension))) {\n return null;\n }\n\n const inNodeModules = /node_modules/.test(id);\n\n let solidOptions: { generate: 'ssr' | 'dom'; hydratable: boolean };\n\n if (options.ssr) {\n if (isSsr) {\n solidOptions = { generate: 'ssr', hydratable: true };\n } else {\n solidOptions = { generate: 'dom', hydratable: true };\n }\n } else {\n solidOptions = { generate: 'dom', hydratable: false };\n }\n\n // We need to know if the current file extension has a typescript options tied to it\n const shouldBeProcessedWithTypescript =\n /\\.[mc]?tsx$/i.test(id) ||\n extensionsToWatch.some((extension) => {\n if (typeof extension === 'string') {\n return extension.includes('tsx');\n }\n\n const [extensionName, extensionOptions] = extension;\n if (extensionName !== currentFileExtension) return false;\n\n return extensionOptions.typescript;\n });\n const plugins: NonNullable<NonNullable<babel.TransformOptions['parserOpts']>['plugins']> = [\n 'jsx',\n 'decorators',\n ];\n\n if (shouldBeProcessedWithTypescript) {\n plugins.push('typescript');\n }\n\n const opts: babel.TransformOptions = {\n root: projectRoot,\n filename: id,\n sourceFileName: id,\n presets: [[solid, { ...solidOptions, dev: replaceDev, ...(options.solid || {}) }]],\n plugins: [\n [lazyModuleUrl],\n ...(needHmr && !isSsr && !inNodeModules ? [[solidRefresh, {\n ...(options.refresh || {}),\n bundler: 'vite',\n fixRender: true,\n // TODO unfortunately, even with SSR enabled for refresh\n // it still doesn't work, so now we have to disable\n // this config\n jsx: false,\n }]] : []),\n ],\n ast: false,\n sourceMaps: true,\n configFile: false,\n babelrc: false,\n parserOpts: {\n plugins,\n },\n };\n\n // Default value for babel user options\n let babelUserOptions: babel.TransformOptions = {};\n\n if (options.babel) {\n if (typeof options.babel === 'function') {\n const babelOptions = options.babel(source, id, !!isSsr);\n babelUserOptions = babelOptions instanceof Promise ? await babelOptions : babelOptions;\n } else {\n babelUserOptions = options.babel;\n }\n }\n\n const babelOptions = mergeAndConcat(babelUserOptions, opts) as babel.TransformOptions;\n\n const result = await babel.transformAsync(source, babelOptions);\n if (!result) {\n return undefined;\n }\n\n let code = result.code || '';\n\n // Resolve lazy() moduleUrl placeholders using Vite's resolver\n const placeholderRe = new RegExp(\n '\"' + LAZY_PLACEHOLDER_PREFIX + '([^\"]+)\"',\n 'g',\n );\n let match;\n const resolutions: Array<{ placeholder: string; resolved: string }> = [];\n while ((match = placeholderRe.exec(code)) !== null) {\n const specifier = match[1];\n const resolved = await this.resolve(specifier, id);\n if (resolved) {\n const cleanId = resolved.id.split('?')[0];\n resolutions.push({\n placeholder: match[0],\n resolved: '\"' + path.relative(projectRoot, cleanId) + '\"',\n });\n }\n }\n for (const { placeholder, resolved } of resolutions) {\n code = code.replace(placeholder, resolved);\n }\n\n return { code, map: result.map };\n },\n };\n}\n\n/**\n * This basically normalize all aliases of the config into\n * the array format of the alias.\n *\n * eg: alias: { '@': 'src/' } => [{ find: '@', replacement: 'src/' }]\n */\nfunction normalizeAliases(alias: AliasOptions = []): Alias[] {\n return Array.isArray(alias)\n ? alias\n : Object.entries(alias).map(([find, replacement]) => ({ find, replacement }));\n}\n\nexport type ViteManifest = Record<\n string,\n {\n file: string;\n css?: string[];\n isEntry?: boolean;\n isDynamicEntry?: boolean;\n imports?: string[];\n }\n>;\n\nlet _manifest: ViteManifest | undefined;\n\n/**\n * Returns the Vite asset manifest for SSR.\n * In production, reads and caches the manifest JSON from `manifestPath`.\n * In development (file not found), returns a proxy that maps each moduleUrl\n * to its dev server path, so lazy() asset resolution works without a build.\n */\nexport function getManifest(manifestPath?: string): ViteManifest {\n if (_manifest) return _manifest;\n if (manifestPath) {\n try {\n _manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));\n return _manifest!;\n } catch {\n // File doesn't exist — dev mode, fall through\n }\n }\n _manifest = new Proxy(\n {},\n {\n get(_, key) {\n if (typeof key !== 'string') return undefined;\n return { file: '/' + key };\n },\n },\n ) as ViteManifest;\n return _manifest;\n}\n"],"names":["LAZY_PLACEHOLDER_PREFIX","extractDynamicImportSpecifier","node","type","callExpr","body","length","argument","callee","arguments","arg","value","lazyModuleUrlPlugin","name","visitor","CallExpression","nodePath","state","filename","binding","scope","getBinding","kind","bindingPath","path","parent","source","specifier","push","require","createRequire","import","meta","url","runtimePublicPath","runtimeFilePath","resolve","runtimeCode","readFileSync","isVite6","version","split","getExtension","index","lastIndexOf","substring","replace","containsSolidField","fields","keys","Object","i","key","getJestDomExport","setupFiles","some","test","undefined","find","e","solidPlugin","options","filter","createFilter","include","exclude","needHmr","replaceDev","projectRoot","process","cwd","isTestMode","solidPkgsConfig","enforce","config","userConfig","command","dev","root","mode","alias","normalizeAliases","crawlFrameworkPkgs","viteUserConfig","isBuild","isFrameworkPkgByJson","pkgJson","exports","nestedDeps","userTest","userSetupFiles","environment","ssr","server","deps","external","item","toString","browser","enabled","jestDomImport","conditions","dedupe","replacement","optimizeDeps","configEnvironment","opts","defaultClientConditions","defaultServerConditions","consumer","isSsrTargetWebworker","noExternal","Array","isArray","configResolved","hot","refresh","disabled","resolveId","id","load","transform","transformOptions","isSsr","currentFileExtension","extensionsToWatch","extensions","allExtensions","map","extension","includes","inNodeModules","solidOptions","generate","hydratable","shouldBeProcessedWithTypescript","extensionName","extensionOptions","typescript","plugins","sourceFileName","presets","solid","lazyModuleUrl","solidRefresh","bundler","fixRender","jsx","ast","sourceMaps","configFile","babelrc","parserOpts","babelUserOptions","babel","babelOptions","Promise","mergeAndConcat","result","transformAsync","code","placeholderRe","RegExp","match","resolutions","exec","resolved","cleanId","placeholder","relative","entries","_manifest","getManifest","manifestPath","JSON","parse","Proxy","get","_","file"],"mappings":";;;;;;;;;;AAEO,MAAMA,uBAAuB,GAAG,wBAAwB;;AAE/D;AACA;AACA;AACA;AACA,SAASC,6BAA6BA,CAACC,IAAY,EAAiB;AAClE,EAAA,IAAIA,IAAI,CAACC,IAAI,KAAK,yBAAyB,IAAID,IAAI,CAACC,IAAI,KAAK,oBAAoB,EAAE,OAAO,IAAI;EAE9F,IAAIC,QAAiC,GAAG,IAAI;AAC5C,EAAA,IAAIF,IAAI,CAACG,IAAI,CAACF,IAAI,KAAK,gBAAgB,EAAE;IACvCC,QAAQ,GAAGF,IAAI,CAACG,IAAI;GACrB,MAAM,IACLH,IAAI,CAACG,IAAI,CAACF,IAAI,KAAK,gBAAgB,IACnCD,IAAI,CAACG,IAAI,CAACA,IAAI,CAACC,MAAM,KAAK,CAAC,IAC3BJ,IAAI,CAACG,IAAI,CAACA,IAAI,CAAC,CAAC,CAAC,CAACF,IAAI,KAAK,iBAAiB,IAC5CD,IAAI,CAACG,IAAI,CAACA,IAAI,CAAC,CAAC,CAAC,CAACE,QAAQ,EAAEJ,IAAI,KAAK,gBAAgB,EACrD;IACAC,QAAQ,GAAGF,IAAI,CAACG,IAAI,CAACA,IAAI,CAAC,CAAC,CAAC,CAACE,QAAQ;AACvC;AACA,E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|
|
1
1
|
import * as babel from '@babel/core';
|
|
2
|
+
import type { Options as RefreshOptions } from 'solid-refresh/babel';
|
|
2
3
|
import type { FilterPattern, Plugin } from 'vite';
|
|
3
4
|
/** Possible options for the extensions property */
|
|
4
5
|
export interface ExtensionOptions {
|
|
@@ -35,6 +36,7 @@ export interface Options {
|
|
|
35
36
|
* set to `false`, it won't inject the runtime in dev.
|
|
36
37
|
*
|
|
37
38
|
* @default true
|
|
39
|
+
* @deprecated use `refresh` instead
|
|
38
40
|
*/
|
|
39
41
|
hot?: boolean;
|
|
40
42
|
/**
|
|
@@ -128,6 +130,32 @@ export interface Options {
|
|
|
128
130
|
* @default ["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"]
|
|
129
131
|
*/
|
|
130
132
|
builtIns?: string[];
|
|
133
|
+
/**
|
|
134
|
+
* Enable dev-mode compilation output. When true, the compiler emits
|
|
135
|
+
* additional runtime checks (e.g. hydration mismatch assertions).
|
|
136
|
+
* Automatically set to true during `vite dev` — override here to
|
|
137
|
+
* force on or off.
|
|
138
|
+
*
|
|
139
|
+
* @default auto (true in dev, false in build)
|
|
140
|
+
*/
|
|
141
|
+
dev?: boolean;
|
|
131
142
|
};
|
|
143
|
+
refresh: Omit<RefreshOptions & {
|
|
144
|
+
disabled: boolean;
|
|
145
|
+
}, 'bundler' | 'fixRender' | 'jsx'>;
|
|
132
146
|
}
|
|
133
147
|
export default function solidPlugin(options?: Partial<Options>): Plugin;
|
|
148
|
+
export type ViteManifest = Record<string, {
|
|
149
|
+
file: string;
|
|
150
|
+
css?: string[];
|
|
151
|
+
isEntry?: boolean;
|
|
152
|
+
isDynamicEntry?: boolean;
|
|
153
|
+
imports?: string[];
|
|
154
|
+
}>;
|
|
155
|
+
/**
|
|
156
|
+
* Returns the Vite asset manifest for SSR.
|
|
157
|
+
* In production, reads and caches the manifest JSON from `manifestPath`.
|
|
158
|
+
* In development (file not found), returns a proxy that maps each moduleUrl
|
|
159
|
+
* to its dev server path, so lazy() asset resolution works without a build.
|
|
160
|
+
*/
|
|
161
|
+
export declare function getManifest(manifestPath?: string): ViteManifest;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PluginObj } from '@babel/core';
|
|
2
|
+
export declare const LAZY_PLACEHOLDER_PREFIX = "__SOLID_LAZY_MODULE__:";
|
|
3
|
+
/**
|
|
4
|
+
* Babel plugin that detects `lazy(() => import("specifier"))` calls
|
|
5
|
+
* and injects a placeholder as the second argument. The placeholder
|
|
6
|
+
* is resolved to a real path by the Vite transform hook using this.resolve().
|
|
7
|
+
*/
|
|
8
|
+
export default function lazyModuleUrlPlugin(): PluginObj;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-solid",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "solid-js integration plugin for vite 3/4/5/6",
|
|
3
|
+
"version": "3.0.0-next.0",
|
|
4
|
+
"description": "solid-js integration plugin for vite 3/4/5/6/7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@babel/core": "^7.23.3",
|
|
39
39
|
"@types/babel__core": "^7.20.4",
|
|
40
|
-
"babel-preset-solid": "^
|
|
40
|
+
"babel-preset-solid": "^2.0.0-beta",
|
|
41
41
|
"merge-anything": "^5.1.7",
|
|
42
|
-
"solid-refresh": "^0.
|
|
42
|
+
"solid-refresh": "^0.8.0-next.1",
|
|
43
43
|
"vitefu": "^1.0.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"prettier": "^3.1.0",
|
|
59
59
|
"rollup": "^4.5.0",
|
|
60
60
|
"rollup-plugin-cleaner": "^1.0.0",
|
|
61
|
-
"solid-js": "^
|
|
61
|
+
"solid-js": "^2.0.0-beta",
|
|
62
62
|
"typescript": "^5.2.2",
|
|
63
|
-
"vite": "^
|
|
63
|
+
"vite": "^7.0.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.*",
|
|
67
|
-
"solid-js": "^
|
|
67
|
+
"solid-js": "^2.0.0-beta",
|
|
68
68
|
"vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|