nitro-nightly 3.0.1-alpha.1 → 3.0.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/_build/common.mjs +24924 -52
- package/dist/_build/rolldown.mjs +29 -63
- package/dist/_build/rollup.mjs +22 -110
- package/dist/_build/vite.build.mjs +3 -43
- package/dist/{_dev.mjs → _chunks/dev.mjs} +45 -43
- package/dist/_chunks/{B-D1JOIz.mjs → nitro.mjs} +144 -308
- package/dist/_chunks/nitro2.mjs +101 -0
- package/dist/_chunks/utils.mjs +254 -0
- package/dist/{_chunks/Bqks5huO.mjs → _common.mjs} +24 -10
- package/dist/_libs/c12+giget+readdirp+chokidar.d.mts +214 -0
- package/dist/_libs/citty.mjs +140 -110
- package/dist/_libs/{plugin-commonjs.mjs → commondir+is-reference.mjs} +59 -250
- package/dist/_libs/compatx.d.mts +47 -0
- package/dist/_libs/confbox.mjs +388 -799
- package/dist/_libs/esbuild.d.mts +20 -0
- package/dist/_libs/estree-walker.mjs +1 -144
- package/dist/_libs/{plugin-node-resolve.mjs → hasown+resolve+deepmerge.mjs} +497 -78
- package/dist/_libs/httpxy.d.mts +79 -0
- package/dist/_libs/httpxy.mjs +6 -1
- package/dist/_libs/magic-string.d.mts +220 -0
- package/dist/_libs/mlly.d.mts +57 -0
- package/dist/_libs/nypm+giget+tinyexec.mjs +3603 -0
- package/dist/_libs/pkg-types.d.mts +23 -0
- package/dist/_libs/plugin-alias.mjs +4 -2
- package/dist/_libs/plugin-inject.mjs +5 -5
- package/dist/_libs/plugin-json.mjs +2 -2
- package/dist/_libs/pluginutils+plugin-commonjs.d.mts +241 -0
- package/dist/_libs/{vite-plugin-fullstack.mjs → pluginutils.mjs} +244 -153
- package/dist/_libs/rc9+c12+dotenv.mjs +972 -0
- package/dist/_libs/{chokidar.mjs → readdirp+chokidar.mjs} +237 -187
- package/dist/_libs/remapping.mjs +1 -1
- package/dist/_libs/{gen-mapping.mjs → resolve-uri+gen-mapping.mjs} +2 -166
- package/dist/_libs/rou3.d.mts +43 -0
- package/dist/_libs/rou3.mjs +9 -6
- package/dist/_libs/std-env.d.mts +4 -0
- package/dist/_libs/tsconfck.mjs +3 -3
- package/dist/_libs/{unimport.mjs → unimport+unplugin.mjs} +226 -1961
- package/dist/_libs/unplugin+unimport.d.mts +426 -0
- package/dist/_libs/unwasm.d.mts +29 -0
- package/dist/_presets.mjs +130 -80
- package/dist/builder.d.mts +4 -4
- package/dist/builder.mjs +6 -30
- package/dist/cli/_chunks/build.mjs +1 -1
- package/dist/cli/_chunks/dev.mjs +5 -11
- package/dist/cli/_chunks/list.mjs +1 -1
- package/dist/cli/_chunks/prepare.mjs +1 -1
- package/dist/cli/_chunks/run.mjs +1 -1
- package/dist/node_modules/@poppinss/colors/build/index.js +130 -160
- package/dist/node_modules/@poppinss/colors/package.json +20 -18
- package/dist/node_modules/@poppinss/exception/build/index.js +36 -55
- package/dist/node_modules/@poppinss/exception/package.json +19 -16
- package/dist/node_modules/@sindresorhus/is/distribution/index.js +46 -5
- package/dist/node_modules/@sindresorhus/is/package.json +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
- package/dist/node_modules/@speed-highlight/core/package.json +2 -2
- package/dist/node_modules/hookable/dist/index.mjs +5 -6
- package/dist/node_modules/hookable/package.json +13 -13
- package/dist/node_modules/ufo/dist/index.mjs +16 -9
- package/dist/node_modules/ufo/package.json +15 -14
- package/dist/node_modules/unctx/package.json +16 -16
- package/dist/node_modules/youch/build/{chunk-4XB2BYKC.js → chunk-7QV3D5YX.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-PUHGL6HA.js → chunk-AUGPHE32.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-F4I6KX4R.js → chunk-CM7DWJNZ.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-YYEJ3AGB.js → chunk-EJH674NB.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-EUJBVOYB.js → chunk-OIJ3WD7L.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-HFSXRSKS.js → chunk-P36L72PL.js} +5 -3
- package/dist/node_modules/youch/build/{chunk-4YEN7HVQ.js → chunk-PE3GG3TN.js} +5 -1
- package/dist/node_modules/youch/build/{chunk-PINJDICN.js → chunk-X53OIOJH.js} +2 -4
- package/dist/node_modules/youch/build/index.js +8 -9
- package/dist/node_modules/youch/build/public/error_info/style.css +1 -0
- package/dist/node_modules/youch/build/public/error_metadata/style.css +3 -0
- package/dist/node_modules/youch/build/public/error_stack/style.css +2 -3
- package/dist/node_modules/youch/package.json +1 -1
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +1 -1
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +5 -6
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +1 -1
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -1
- package/dist/presets/_nitro/runtime/service-worker.d.mts +1 -1
- package/dist/presets/_nitro/runtime/service-worker.mjs +2 -2
- package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +1 -1
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +1 -1
- package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -5
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +9 -11
- package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +1 -1
- package/dist/presets/azure/runtime/azure-swa.d.mts +1 -1
- package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
- package/dist/presets/bun/runtime/bun.d.mts +1 -1
- package/dist/presets/bun/runtime/bun.mjs +7 -8
- package/dist/presets/cloudflare/runtime/_module-handler.d.mts +3 -3
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +19 -17
- package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +17 -16
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +8 -9
- package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +12 -18
- package/dist/presets/deno/runtime/deno-deploy.d.mts +1 -1
- package/dist/presets/deno/runtime/deno-deploy.mjs +4 -5
- package/dist/presets/deno/runtime/deno-server.d.mts +1 -1
- package/dist/presets/deno/runtime/deno-server.mjs +5 -6
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +1 -2
- package/dist/presets/netlify/runtime/netlify-edge.mjs +3 -2
- package/dist/presets/netlify/runtime/netlify.d.mts +3 -2
- package/dist/presets/netlify/runtime/netlify.mjs +3 -1
- package/dist/presets/node/runtime/node-cluster.d.mts +1 -1
- package/dist/presets/node/runtime/node-cluster.mjs +5 -6
- package/dist/presets/node/runtime/node-middleware.d.mts +1 -1
- package/dist/presets/node/runtime/node-middleware.mjs +4 -5
- package/dist/presets/node/runtime/node-server.d.mts +1 -1
- package/dist/presets/node/runtime/node-server.mjs +5 -6
- package/dist/presets/standard/runtime/server.d.mts +1 -1
- package/dist/presets/standard/runtime/server.mjs +1 -1
- package/dist/presets/stormkit/runtime/stormkit.d.mts +1 -1
- package/dist/presets/stormkit/runtime/stormkit.mjs +1 -1
- package/dist/presets/vercel/runtime/isr.d.mts +2 -0
- package/dist/presets/vercel/runtime/isr.mjs +19 -0
- package/dist/presets/vercel/runtime/vercel.node.d.mts +1 -1
- package/dist/presets/vercel/runtime/vercel.node.mjs +16 -7
- package/dist/presets/vercel/runtime/vercel.web.d.mts +1 -1
- package/dist/presets/vercel/runtime/vercel.web.mjs +18 -13
- package/dist/presets/winterjs/runtime/winterjs.d.mts +1 -2
- package/dist/presets/winterjs/runtime/winterjs.mjs +1 -1
- package/dist/presets/zeabur/runtime/zeabur.d.mts +1 -1
- package/dist/presets/zeabur/runtime/zeabur.mjs +1 -1
- package/dist/runtime/app.d.mts +1 -1
- package/dist/runtime/app.mjs +1 -1
- package/dist/runtime/internal/app.d.mts +7 -3
- package/dist/runtime/internal/app.mjs +29 -22
- package/dist/runtime/internal/database.mjs +1 -1
- package/dist/runtime/internal/error/dev.d.mts +0 -1
- package/dist/runtime/internal/error/dev.mjs +1 -1
- package/dist/runtime/internal/route-rules.d.mts +0 -4
- package/dist/runtime/internal/routes/dev-tasks.mjs +1 -1
- package/dist/runtime/internal/routes/openapi.d.mts +0 -1
- package/dist/runtime/internal/routes/openapi.mjs +3 -3
- package/dist/runtime/internal/routes/renderer-template.dev.mjs +1 -1
- package/dist/runtime/internal/routes/renderer-template.mjs +1 -1
- package/dist/runtime/internal/routes/scalar.d.mts +0 -1
- package/dist/runtime/internal/routes/scalar.mjs +4 -4
- package/dist/runtime/internal/routes/swagger.d.mts +0 -1
- package/dist/runtime/internal/routes/swagger.mjs +3 -3
- package/dist/runtime/internal/runtime-config.mjs +8 -8
- package/dist/runtime/internal/static.mjs +1 -1
- package/dist/runtime/internal/storage.mjs +1 -1
- package/dist/runtime/internal/task.mjs +1 -1
- package/dist/runtime/internal/vite/dev-entry.mjs +3 -4
- package/dist/runtime/internal/vite/{dev-worker.mjs → node-runner.mjs} +51 -6
- package/dist/runtime/meta.d.mts +1 -1
- package/dist/runtime/meta.mjs +1 -1
- package/dist/runtime/nitro.d.mts +0 -3
- package/dist/runtime/nitro.mjs +1 -1
- package/dist/runtime/virtual/_runtime_warn.d.mts +1 -0
- package/dist/runtime/virtual/_runtime_warn.mjs +5 -0
- package/dist/runtime/virtual/database.d.mts +8 -0
- package/dist/runtime/virtual/database.mjs +2 -0
- package/dist/runtime/virtual/error-handler.d.mts +6 -0
- package/dist/runtime/virtual/error-handler.mjs +9 -0
- package/dist/runtime/virtual/feature-flags.d.mts +7 -0
- package/dist/runtime/virtual/feature-flags.mjs +7 -0
- package/dist/runtime/virtual/plugins.d.mts +3 -0
- package/dist/runtime/virtual/plugins.mjs +2 -0
- package/dist/runtime/virtual/polyfills.d.mts +3 -0
- package/dist/runtime/virtual/polyfills.mjs +2 -0
- package/dist/runtime/virtual/public-assets.d.mts +9 -0
- package/dist/runtime/virtual/public-assets.mjs +8 -0
- package/dist/runtime/virtual/renderer-template.d.mts +4 -0
- package/dist/runtime/virtual/renderer-template.mjs +7 -0
- package/dist/runtime/virtual/routing-meta.d.mts +7 -0
- package/dist/runtime/virtual/routing-meta.mjs +2 -0
- package/dist/runtime/virtual/routing.d.mts +8 -0
- package/dist/runtime/virtual/routing.mjs +11 -0
- package/dist/runtime/virtual/runtime-config.d.mts +3 -0
- package/dist/runtime/virtual/runtime-config.mjs +5 -0
- package/dist/runtime/virtual/server-assets.d.mts +6 -0
- package/dist/runtime/virtual/server-assets.mjs +12 -0
- package/dist/runtime/virtual/storage.d.mts +3 -0
- package/dist/runtime/virtual/storage.mjs +5 -0
- package/dist/runtime/virtual/tasks.d.mts +10 -0
- package/dist/runtime/virtual/tasks.mjs +3 -0
- package/dist/types/index.d.mts +292 -371
- package/dist/types/index.mjs +10 -0
- package/dist/vite.d.mts +7 -12
- package/dist/vite.mjs +734 -41
- package/lib/vite.types.d.mts +26 -0
- package/lib/vite.types.mjs +2 -0
- package/package.json +82 -53
- package/dist/_build/common2.mjs +0 -772
- package/dist/_build/vite.plugin.mjs +0 -768
- package/dist/_chunks/ANM1K1bE.mjs +0 -304
- package/dist/_chunks/BX9-zVkM.mjs +0 -59
- package/dist/_chunks/C7CbzoI1.mjs +0 -39
- package/dist/_libs/acorn.mjs +0 -5034
- package/dist/_libs/c12.mjs +0 -2858
- package/dist/_libs/commondir.mjs +0 -22
- package/dist/_libs/deepmerge.mjs +0 -86
- package/dist/_libs/dot-prop.mjs +0 -138
- package/dist/_libs/duplexer.mjs +0 -71
- package/dist/_libs/etag.mjs +0 -80
- package/dist/_libs/fdir.mjs +0 -514
- package/dist/_libs/function-bind.mjs +0 -63
- package/dist/_libs/giget.mjs +0 -19289
- package/dist/_libs/gzip-size.mjs +0 -21
- package/dist/_libs/hasown.mjs +0 -14
- package/dist/_libs/is-core-module.mjs +0 -220
- package/dist/_libs/is-module.mjs +0 -13
- package/dist/_libs/is-reference.mjs +0 -32
- package/dist/_libs/js-tokens.mjs +0 -382
- package/dist/_libs/knitwork.mjs +0 -124
- package/dist/_libs/local-pkg.mjs +0 -1686
- package/dist/_libs/magic-string.mjs +0 -939
- package/dist/_libs/mime.mjs +0 -1391
- package/dist/_libs/node-fetch-native.mjs +0 -173
- package/dist/_libs/path-parse.mjs +0 -47
- package/dist/_libs/pathe.mjs +0 -41
- package/dist/_libs/picomatch.mjs +0 -1673
- package/dist/_libs/plugin-replace.mjs +0 -104
- package/dist/_libs/pretty-bytes.mjs +0 -116
- package/dist/_libs/std-env.mjs +0 -158
- package/dist/_libs/strip-literal.mjs +0 -51
- package/dist/_libs/tinyglobby.mjs +0 -292
- package/dist/_libs/untyped.mjs +0 -271
- package/dist/_libs/unwasm.mjs +0 -5836
- package/dist/cli/_chunks/detect-acorn.mjs +0 -12
- package/dist/cli/_chunks/dist.mjs +0 -3
- package/dist/cli/_chunks/dist2.mjs +0 -3
- package/dist/cli/_chunks/dist3.mjs +0 -3
- package/dist/cli/_chunks/dist4.mjs +0 -4
- package/dist/cli/_chunks/dist5.mjs +0 -4
- package/dist/cli/_chunks/esm.mjs +0 -3
- package/dist/cli/_chunks/json5.mjs +0 -4
- package/dist/cli/_chunks/jsonc.mjs +0 -4
- package/dist/cli/_chunks/multipart-parser.mjs +0 -6
- package/dist/cli/_chunks/toml.mjs +0 -4
- package/dist/cli/_chunks/yaml.mjs +0 -4
- package/dist/node_modules/kleur/index.js +0 -110
- package/dist/node_modules/youch/build/chunk-OSUFJZHZ.js +0 -6
- package/lib/deps/ofetch.mjs +0 -1
- package/lib/deps/ofetch.mts +0 -1
- /package/dist/runtime/{vite-runtime.d.mts → vite.d.mts} +0 -0
- /package/dist/runtime/{vite-runtime.mjs → vite.mjs} +0 -0
- /package/lib/{deps/h3.d.mts → h3.d.mts} +0 -0
- /package/lib/{deps/h3.mjs → h3.mjs} +0 -0
|
@@ -1,15 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import path from "node:path";
|
|
1
|
+
import { n as __exportAll } from "../_common.mjs";
|
|
2
|
+
import { S as MagicString, x as stripLiteral } from "../_build/common.mjs";
|
|
4
3
|
import fs from "node:fs";
|
|
5
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
import path from "node:path";
|
|
6
6
|
import assert from "node:assert";
|
|
7
|
-
import "srvx/node";
|
|
8
7
|
import { createHash } from "node:crypto";
|
|
9
8
|
import { isCSSRequest, normalizePath } from "vite";
|
|
10
9
|
import assert$1 from "node:assert/strict";
|
|
11
10
|
|
|
12
|
-
//#region node_modules/.pnpm/@
|
|
11
|
+
//#region node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.55/node_modules/@rolldown/pluginutils/dist/simple-filters.js
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a RegExp that matches the exact string specified.
|
|
14
|
+
*
|
|
15
|
+
* This is useful for plugin hook filters.
|
|
16
|
+
*
|
|
17
|
+
* @param str the string to match.
|
|
18
|
+
* @param flags flags for the RegExp.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { exactRegex } from '@rolldown/pluginutils';
|
|
23
|
+
* const plugin = {
|
|
24
|
+
* name: 'plugin',
|
|
25
|
+
* resolveId: {
|
|
26
|
+
* filter: { id: exactRegex('foo') },
|
|
27
|
+
* handler(id) {} // will only be called for `foo`
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
function exactRegex(str, flags) {
|
|
33
|
+
return new RegExp(`^${escapeRegex(str)}$`, flags);
|
|
34
|
+
}
|
|
35
|
+
const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
|
|
36
|
+
function escapeRegex(str) {
|
|
37
|
+
return str.replace(escapeRegexRE, "\\$&");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region node_modules/.pnpm/@hiogawa+vite-plugin-fullstack@0.0.11_vite@8.0.0-beta.8_@types+node@25.0.9_esbuild@0.27_577572ae8fc6296e77b8a4205393d7c0/node_modules/@hiogawa/vite-plugin-fullstack/dist/plugin-B4MlD0Bd.js
|
|
13
42
|
function parseIdQuery(id) {
|
|
14
43
|
if (!id.includes("?")) return {
|
|
15
44
|
filename: id,
|
|
@@ -30,13 +59,19 @@ function parseAssetsVirtual(id) {
|
|
|
30
59
|
function createVirtualPlugin(name, load) {
|
|
31
60
|
name = "virtual:" + name;
|
|
32
61
|
return {
|
|
33
|
-
name: `
|
|
34
|
-
resolveId: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
62
|
+
name: `fullstack:virtual-${name}`,
|
|
63
|
+
resolveId: {
|
|
64
|
+
filter: { id: exactRegex(name) },
|
|
65
|
+
handler(source, _importer, _options) {
|
|
66
|
+
return source === name ? "\0" + name : void 0;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
load: {
|
|
70
|
+
filter: { id: exactRegex("\0" + name) },
|
|
71
|
+
handler(id, options) {
|
|
72
|
+
return load.apply(this, [id, options]);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
40
75
|
};
|
|
41
76
|
}
|
|
42
77
|
function normalizeRelativePath(s) {
|
|
@@ -114,11 +149,11 @@ function assetsPlugin(pluginOpts) {
|
|
|
114
149
|
};
|
|
115
150
|
const environment = server.environments[options.environment];
|
|
116
151
|
assert$1(environment, `Unknown environment: ${options.environment}`);
|
|
117
|
-
if (options.environment === "client") result.entry = normalizeViteImportAnalysisUrl(environment, id);
|
|
152
|
+
if (options.environment === "client") result.entry = assetsURLDev(normalizeViteImportAnalysisUrl(environment, id).slice(1), resolvedConfig);
|
|
118
153
|
if (environment.name !== "client") {
|
|
119
154
|
const collected = await collectCss(environment, id, { eager: pluginOpts?.experimental?.devEagerTransform ?? true });
|
|
120
155
|
result.css = collected.hrefs.map((href, i) => ({
|
|
121
|
-
href,
|
|
156
|
+
href: assetsURLDev(href.slice(1), resolvedConfig),
|
|
122
157
|
"data-vite-dev-id": collected.ids[i]
|
|
123
158
|
}));
|
|
124
159
|
}
|
|
@@ -155,13 +190,13 @@ function assetsPlugin(pluginOpts) {
|
|
|
155
190
|
};
|
|
156
191
|
const { chunk, deps } = found;
|
|
157
192
|
if (environmentName === "client") {
|
|
158
|
-
result.entry =
|
|
159
|
-
result.js = deps.js.map((fileName) => ({ href:
|
|
193
|
+
result.entry = assetsURL(chunk.fileName, builder.config);
|
|
194
|
+
result.js = deps.js.map((fileName) => ({ href: assetsURL(fileName, builder.config) }));
|
|
160
195
|
}
|
|
161
|
-
result.css = deps.css.map((fileName) => ({ href:
|
|
196
|
+
result.css = deps.css.map((fileName) => ({ href: assetsURL(fileName, builder.config) }));
|
|
162
197
|
if (!builder.environments[environmentName].config.build.cssCodeSplit) {
|
|
163
198
|
const singleCss = Object.values(bundle).find((v) => v.type === "asset" && v.originalFileNames.includes("style.css"));
|
|
164
|
-
if (singleCss) result.css.push({ href:
|
|
199
|
+
if (singleCss) result.css.push({ href: assetsURL(singleCss.fileName, builder.config) });
|
|
165
200
|
}
|
|
166
201
|
(manifest[environmentName] ??= {})[meta.key] = result;
|
|
167
202
|
}
|
|
@@ -169,7 +204,7 @@ function assetsPlugin(pluginOpts) {
|
|
|
169
204
|
const importerEnvironments = new Set(Object.values(importAssetsMetaMap).flatMap((metas) => Object.values(metas)).flatMap((meta) => meta.importerEnvironment));
|
|
170
205
|
for (const environmentName of importerEnvironments) {
|
|
171
206
|
const outDir = builder.environments[environmentName].config.build.outDir;
|
|
172
|
-
fs.writeFileSync(path.join(outDir, BUILD_ASSETS_MANIFEST_NAME), `export default ${
|
|
207
|
+
fs.writeFileSync(path.join(outDir, BUILD_ASSETS_MANIFEST_NAME), `export default ${serializeValueWithRuntime(manifest)};`);
|
|
173
208
|
const clientOutDir = builder.environments["client"].config.build.outDir;
|
|
174
209
|
for (const asset of Object.values(bundleMap[environmentName])) if (asset.type === "asset") {
|
|
175
210
|
const srcFile = path.join(outDir, asset.fileName);
|
|
@@ -192,85 +227,93 @@ function assetsPlugin(pluginOpts) {
|
|
|
192
227
|
configEnvironment(name) {
|
|
193
228
|
if ((pluginOpts?.serverEnvironments ?? ["ssr"]).includes(name)) return { build: { emitAssets: true } };
|
|
194
229
|
},
|
|
195
|
-
transform: {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
230
|
+
transform: {
|
|
231
|
+
filter: { code: /import\.meta\.vite\.assets\(/ },
|
|
232
|
+
async handler(code, id, _options) {
|
|
233
|
+
const output = new MagicString(code);
|
|
234
|
+
const strippedCode = stripLiteral(code);
|
|
235
|
+
const newImports = /* @__PURE__ */ new Set();
|
|
236
|
+
for (const match of code.matchAll(/import\.meta\.vite\.assets\(([\s\S]*?)\)/dg)) {
|
|
237
|
+
const [start, end] = match.indices[0];
|
|
238
|
+
if (!strippedCode.slice(start, end).includes("import.meta.vite.assets")) continue;
|
|
239
|
+
if (this.environment.name === "client") {
|
|
240
|
+
const replacement$1 = `(${JSON.stringify(EMPTY_ASSETS)})`;
|
|
241
|
+
output.update(start, end, replacement$1);
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
const argCode = match[1].trim();
|
|
245
|
+
const options = {
|
|
246
|
+
import: id,
|
|
247
|
+
environment: void 0,
|
|
248
|
+
asEntry: false
|
|
249
|
+
};
|
|
250
|
+
if (argCode) {
|
|
251
|
+
const argValue = evalValue(argCode);
|
|
252
|
+
Object.assign(options, argValue);
|
|
253
|
+
}
|
|
254
|
+
const environments = options.environment ? [options.environment] : ["client", this.environment.name];
|
|
255
|
+
const importedNames = [];
|
|
256
|
+
for (const environment of environments) {
|
|
257
|
+
const importSource = toAssetsVirtual({
|
|
258
|
+
import: options.import,
|
|
259
|
+
importer: id,
|
|
260
|
+
environment,
|
|
261
|
+
entry: options.asEntry ? "1" : ""
|
|
262
|
+
});
|
|
263
|
+
const importedName = `__assets_${hashString(importSource)}`;
|
|
264
|
+
newImports.add(`;import ${importedName} from ${JSON.stringify(importSource)};\n`);
|
|
265
|
+
importedNames.push(importedName);
|
|
266
|
+
}
|
|
267
|
+
let replacement = importedNames[0];
|
|
268
|
+
if (importedNames.length > 1) {
|
|
269
|
+
newImports.add(`;import * as __assets_runtime from "virtual:fullstack/runtime";\n`);
|
|
270
|
+
replacement = `__assets_runtime.mergeAssets(${importedNames.join(", ")})`;
|
|
271
|
+
}
|
|
272
|
+
output.update(start, end, `(${replacement})`);
|
|
207
273
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (argCode) {
|
|
215
|
-
const argValue = evalValue(argCode);
|
|
216
|
-
Object.assign(options, argValue);
|
|
217
|
-
}
|
|
218
|
-
const environments = options.environment ? [options.environment] : ["client", this.environment.name];
|
|
219
|
-
const importedNames = [];
|
|
220
|
-
for (const environment of environments) {
|
|
221
|
-
const importSource = toAssetsVirtual({
|
|
222
|
-
import: options.import,
|
|
223
|
-
importer: id,
|
|
224
|
-
environment,
|
|
225
|
-
entry: options.asEntry ? "1" : ""
|
|
226
|
-
});
|
|
227
|
-
const importedName = `__assets_${hashString(importSource)}`;
|
|
228
|
-
newImports.add(`;import ${importedName} from ${JSON.stringify(importSource)};\n`);
|
|
229
|
-
importedNames.push(importedName);
|
|
274
|
+
if (output.hasChanged()) {
|
|
275
|
+
for (const newImport of newImports) output.append(newImport);
|
|
276
|
+
return {
|
|
277
|
+
code: output.toString(),
|
|
278
|
+
map: output.generateMap({ hires: "boundary" })
|
|
279
|
+
};
|
|
230
280
|
}
|
|
231
|
-
let replacement = importedNames[0];
|
|
232
|
-
if (importedNames.length > 1) {
|
|
233
|
-
newImports.add(`;import * as __assets_runtime from "virtual:fullstack/runtime";\n`);
|
|
234
|
-
replacement = `__assets_runtime.mergeAssets(${importedNames.join(", ")})`;
|
|
235
|
-
}
|
|
236
|
-
output.update(start, end, `(${replacement})`);
|
|
237
281
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
282
|
+
},
|
|
283
|
+
resolveId: {
|
|
284
|
+
filter: { id: /^virtual:fullstack\// },
|
|
285
|
+
handler(source) {
|
|
286
|
+
if (source === "virtual:fullstack/runtime") return "\0" + source;
|
|
287
|
+
if (source.startsWith("virtual:fullstack/assets?")) return "\0" + source;
|
|
288
|
+
if (source === "virtual:fullstack/assets-manifest") {
|
|
289
|
+
assert$1.notEqual(this.environment.name, "client");
|
|
290
|
+
assert$1.equal(this.environment.mode, "build");
|
|
291
|
+
return {
|
|
292
|
+
id: source,
|
|
293
|
+
external: true
|
|
294
|
+
};
|
|
295
|
+
}
|
|
244
296
|
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
297
|
+
},
|
|
298
|
+
load: {
|
|
299
|
+
filter: { id: /^\0virtual:fullstack\// },
|
|
300
|
+
async handler(id) {
|
|
301
|
+
if (id === "\0virtual:fullstack/runtime") return `export const mergeAssets = ${(await Promise.resolve().then(() => runtime_exports)).mergeAssets.toString()};`;
|
|
302
|
+
const parsed = parseAssetsVirtual(id);
|
|
303
|
+
if (!parsed) return;
|
|
249
304
|
assert$1.notEqual(this.environment.name, "client");
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
305
|
+
const resolved = await this.resolve(parsed.import, parsed.importer);
|
|
306
|
+
assert$1(resolved, `Failed to resolve: ${parsed.import}`);
|
|
307
|
+
const s = new MagicString("");
|
|
308
|
+
const code = await processAssetsImport(this, resolved.id, {
|
|
309
|
+
environment: parsed.environment,
|
|
310
|
+
isEntry: !!parsed.entry
|
|
311
|
+
});
|
|
312
|
+
s.append(`export default ${code};\n`);
|
|
313
|
+
if (this.environment.mode === "build") s.prepend(`import __assets_manifest from "virtual:fullstack/assets-manifest";\n`);
|
|
314
|
+
return s.toString();
|
|
255
315
|
}
|
|
256
|
-
|
|
257
|
-
} },
|
|
258
|
-
load: { async handler(id) {
|
|
259
|
-
if (id === "virtual:fullstack/runtime") return runtimeUtils();
|
|
260
|
-
const parsed = parseAssetsVirtual(id);
|
|
261
|
-
if (!parsed) return;
|
|
262
|
-
assert$1.notEqual(this.environment.name, "client");
|
|
263
|
-
const resolved = await this.resolve(parsed.import, parsed.importer);
|
|
264
|
-
assert$1(resolved, `Failed to resolve: ${parsed.import}`);
|
|
265
|
-
const s = new MagicString("");
|
|
266
|
-
const code = await processAssetsImport(this, resolved.id, {
|
|
267
|
-
environment: parsed.environment,
|
|
268
|
-
isEntry: !!parsed.entry
|
|
269
|
-
});
|
|
270
|
-
s.append(`export default ${code};\n`);
|
|
271
|
-
if (this.environment.mode === "build") s.prepend(`import __assets_manifest from "virtual:fullstack/assets-manifest";\n`);
|
|
272
|
-
return s.toString();
|
|
273
|
-
} },
|
|
316
|
+
},
|
|
274
317
|
renderChunk(code, chunk) {
|
|
275
318
|
if (code.includes("virtual:fullstack/assets-manifest")) {
|
|
276
319
|
const replacement = normalizeRelativePath(path.relative(path.join(chunk.fileName, ".."), BUILD_ASSETS_MANIFEST_NAME));
|
|
@@ -315,50 +358,52 @@ function assetsPlugin(pluginOpts) {
|
|
|
315
358
|
sharedDuringBuild: true,
|
|
316
359
|
resolveId: {
|
|
317
360
|
order: "pre",
|
|
361
|
+
filter: { id: /[?&]assets/ },
|
|
318
362
|
handler(source) {
|
|
319
363
|
const { query } = parseIdQuery(source);
|
|
320
364
|
if (typeof query["assets"] !== "undefined") {
|
|
321
365
|
if (this.environment.name === "client") return `\0virtual:fullstack/empty-assets`;
|
|
322
366
|
}
|
|
323
|
-
if (source === "virtual:fullstack/runtime") return source;
|
|
324
367
|
}
|
|
325
368
|
},
|
|
326
|
-
load: {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
369
|
+
load: {
|
|
370
|
+
filter: { id: [/^\0virtual:fullstack\/empty-assets$/, /[?&]assets/] },
|
|
371
|
+
async handler(id) {
|
|
372
|
+
if (id === "\0virtual:fullstack/empty-assets") return `export default ${JSON.stringify(EMPTY_ASSETS)}`;
|
|
373
|
+
const { filename, query } = parseIdQuery(id);
|
|
374
|
+
const value = query["assets"];
|
|
375
|
+
if (typeof value !== "undefined") {
|
|
376
|
+
const s = new MagicString("");
|
|
377
|
+
const codes = [];
|
|
378
|
+
if (value) {
|
|
379
|
+
const code = await processAssetsImport(this, filename, {
|
|
380
|
+
environment: value,
|
|
381
|
+
isEntry: value === "client"
|
|
382
|
+
});
|
|
383
|
+
codes.push(code);
|
|
384
|
+
} else {
|
|
385
|
+
const code1 = await processAssetsImport(this, filename, {
|
|
386
|
+
environment: "client",
|
|
387
|
+
isEntry: false
|
|
388
|
+
});
|
|
389
|
+
const code2 = await processAssetsImport(this, filename, {
|
|
390
|
+
environment: this.environment.name,
|
|
391
|
+
isEntry: false
|
|
392
|
+
});
|
|
393
|
+
codes.push(code1, code2);
|
|
394
|
+
}
|
|
395
|
+
s.append(`
|
|
352
396
|
import * as __assets_runtime from "virtual:fullstack/runtime";\n
|
|
353
397
|
export default __assets_runtime.mergeAssets(${codes.join(", ")});
|
|
354
398
|
`);
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
399
|
+
if (this.environment.mode === "build") s.prepend(`import __assets_manifest from "virtual:fullstack/assets-manifest";\n`);
|
|
400
|
+
return {
|
|
401
|
+
code: s.toString(),
|
|
402
|
+
moduleSideEffects: false
|
|
403
|
+
};
|
|
404
|
+
}
|
|
360
405
|
}
|
|
361
|
-
}
|
|
406
|
+
},
|
|
362
407
|
hotUpdate(ctx) {
|
|
363
408
|
if (this.environment.name === "rsc") {
|
|
364
409
|
const mods = collectModuleDependents(ctx.modules);
|
|
@@ -478,11 +523,13 @@ function patchViteClientPlugin() {
|
|
|
478
523
|
}
|
|
479
524
|
return {
|
|
480
525
|
name: "fullstack:patch-vite-client",
|
|
481
|
-
transform: {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
526
|
+
transform: {
|
|
527
|
+
filter: { id: exactRegex(viteClientPath) },
|
|
528
|
+
handler(code, id) {
|
|
529
|
+
if (id === viteClientPath) {
|
|
530
|
+
if (code.includes("linkSheetsMap")) return;
|
|
531
|
+
const s = new MagicString(code);
|
|
532
|
+
s.prependLeft(code.indexOf("const sheetsMap"), `\
|
|
486
533
|
const linkSheetsMap = new Map();
|
|
487
534
|
document
|
|
488
535
|
.querySelectorAll('link[rel="stylesheet"][data-vite-dev-id]')
|
|
@@ -490,8 +537,8 @@ document
|
|
|
490
537
|
linkSheetsMap.set(el.getAttribute('data-vite-dev-id'), el)
|
|
491
538
|
});
|
|
492
539
|
`);
|
|
493
|
-
|
|
494
|
-
|
|
540
|
+
s.appendLeft(endIndexOf(code, `function updateStyle(id, content) {`), `if (linkSheetsMap.has(id)) { return }`);
|
|
541
|
+
s.appendLeft(endIndexOf(code, `function removeStyle(id) {`), `
|
|
495
542
|
const link = linkSheetsMap.get(id);
|
|
496
543
|
if (link) {
|
|
497
544
|
document
|
|
@@ -506,9 +553,10 @@ if (link) {
|
|
|
506
553
|
linkSheetsMap.delete(id)
|
|
507
554
|
}
|
|
508
555
|
`);
|
|
509
|
-
|
|
556
|
+
return s.toString();
|
|
557
|
+
}
|
|
510
558
|
}
|
|
511
|
-
}
|
|
559
|
+
}
|
|
512
560
|
};
|
|
513
561
|
}
|
|
514
562
|
function patchVueScopeCssHmr() {
|
|
@@ -537,25 +585,68 @@ function patchCssLinkSelfAccept() {
|
|
|
537
585
|
}
|
|
538
586
|
};
|
|
539
587
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}
|
|
588
|
+
var BuildAssetsURLWithRuntime = class {
|
|
589
|
+
constructor(runtime) {
|
|
590
|
+
this.runtime = runtime;
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
function serializeValueWithRuntime(value) {
|
|
594
|
+
const replacements = [];
|
|
595
|
+
let result = JSON.stringify(value, (_key, value$1) => {
|
|
596
|
+
if (value$1 instanceof BuildAssetsURLWithRuntime) {
|
|
597
|
+
const placeholder = `__runtime_placeholder_${replacements.length}__`;
|
|
598
|
+
replacements.push([placeholder, value$1.runtime]);
|
|
599
|
+
return placeholder;
|
|
600
|
+
}
|
|
601
|
+
return value$1;
|
|
602
|
+
}, 2);
|
|
603
|
+
for (const [placeholder, runtime] of replacements) result = result.replace(`"${placeholder}"`, runtime);
|
|
604
|
+
return result;
|
|
605
|
+
}
|
|
606
|
+
function assetsURL(url, config) {
|
|
607
|
+
if (config.command === "build" && typeof config.experimental?.renderBuiltUrl === "function") {
|
|
608
|
+
const result = config.experimental.renderBuiltUrl(url, {
|
|
609
|
+
type: "asset",
|
|
610
|
+
hostType: "js",
|
|
611
|
+
ssr: true,
|
|
612
|
+
hostId: ""
|
|
613
|
+
});
|
|
614
|
+
if (typeof result === "object") {
|
|
615
|
+
if (result.runtime) return new BuildAssetsURLWithRuntime(result.runtime);
|
|
616
|
+
assert$1(!result.relative, "\"result.relative\" not supported on renderBuiltUrl() for fullstack plugin");
|
|
617
|
+
} else if (result) return result;
|
|
618
|
+
}
|
|
619
|
+
return config.base + url;
|
|
620
|
+
}
|
|
621
|
+
function assetsURLDev(url, config) {
|
|
622
|
+
return config.base + url;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
//#endregion
|
|
626
|
+
//#region node_modules/.pnpm/@hiogawa+vite-plugin-fullstack@0.0.11_vite@8.0.0-beta.8_@types+node@25.0.9_esbuild@0.27_577572ae8fc6296e77b8a4205393d7c0/node_modules/@hiogawa/vite-plugin-fullstack/dist/runtime.js
|
|
627
|
+
var runtime_exports = /* @__PURE__ */ __exportAll({ mergeAssets: () => mergeAssets });
|
|
628
|
+
function mergeAssets(...args) {
|
|
629
|
+
const js = uniqBy(args.flatMap((h) => h.js), (a) => a.href);
|
|
630
|
+
const css = uniqBy(args.flatMap((h) => h.css), (a) => a.href);
|
|
631
|
+
const raw = {
|
|
632
|
+
entry: args.filter((arg) => arg.entry)?.[0]?.entry,
|
|
633
|
+
js,
|
|
634
|
+
css
|
|
635
|
+
};
|
|
636
|
+
return {
|
|
637
|
+
...raw,
|
|
638
|
+
merge: (...args$1) => mergeAssets(raw, ...args$1)
|
|
639
|
+
};
|
|
640
|
+
function uniqBy(array, key) {
|
|
641
|
+
const seen = /* @__PURE__ */ new Set();
|
|
642
|
+
return array.filter((item) => {
|
|
643
|
+
const k = key(item);
|
|
644
|
+
if (seen.has(k)) return false;
|
|
645
|
+
seen.add(k);
|
|
646
|
+
return true;
|
|
647
|
+
});
|
|
648
|
+
}
|
|
558
649
|
}
|
|
559
650
|
|
|
560
651
|
//#endregion
|
|
561
|
-
export { assetsPlugin as t };
|
|
652
|
+
export { assetsPlugin as n, runtime_exports as t };
|