@nuxt/vite-builder-nightly 4.0.0-28954008.e4a6cdce → 4.0.0-28954996.e5a7c19b

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.
Files changed (2) hide show
  1. package/dist/index.mjs +28 -59
  2. package/package.json +4 -5
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import * as vite from 'vite';
3
3
  import { isFileServingAllowed, isCSSRequest, createLogger } from 'vite';
4
- import { dirname, resolve, normalize, isAbsolute, join, relative } from 'pathe';
5
- import { useNuxt, useNitro, logger, resolvePath, tryImportModule, createIsIgnored, addVitePlugin } from '@nuxt/kit';
4
+ import { dirname, normalize, resolve, isAbsolute, join, relative } from 'pathe';
5
+ import { useNitro, logger, useNuxt, resolvePath, tryImportModule, createIsIgnored, addVitePlugin } from '@nuxt/kit';
6
6
  import replace from '@rollup/plugin-replace';
7
- import { resolve as resolve$1, findStaticImports, sanitizeFilePath } from 'mlly';
7
+ import { findStaticImports, sanitizeFilePath } from 'mlly';
8
8
  import { parseURL, parseQuery, joinURL, withTrailingSlash, getQuery, withLeadingSlash, withoutLeadingSlash, withoutBase } from 'ufo';
9
9
  import { filename as filename$1 } from 'pathe/utils';
10
10
  import { resolveTSConfig } from 'pkg-types';
@@ -19,7 +19,6 @@ import MagicString from 'magic-string';
19
19
  import { mkdir, writeFile, rm, readFile } from 'node:fs/promises';
20
20
  import { ViteNodeServer } from 'vite-node/server';
21
21
  import { normalizeViteManifest } from 'vue-bundle-renderer';
22
- import { ExternalsDefaults, isExternal } from 'externality';
23
22
  import escapeStringRegexp from 'escape-string-regexp';
24
23
  import { colorize } from 'consola/utils';
25
24
  import { hasTTY, isCI } from 'std-env';
@@ -54,9 +53,6 @@ const IS_CSS_RE = /\.(?:css|scss|sass|postcss|pcss|less|stylus|styl)(?:\?[^.]+)?
54
53
  function isCSS(file) {
55
54
  return IS_CSS_RE.test(file);
56
55
  }
57
- function toArray(value) {
58
- return Array.isArray(value) ? value : [value];
59
- }
60
56
 
61
57
  function devStyleSSRPlugin(options) {
62
58
  return {
@@ -136,48 +132,6 @@ if (_distDir.match(/(chunks|shared)$/)) {
136
132
  }
137
133
  const distDir = _distDir;
138
134
 
139
- function createIsExternal(viteServer, nuxt) {
140
- const externalOpts = {
141
- inline: [
142
- /virtual:/,
143
- /\.ts$/,
144
- ...ExternalsDefaults.inline || [],
145
- ...viteServer.config.ssr.noExternal && viteServer.config.ssr.noExternal !== true ? toArray(viteServer.config.ssr.noExternal) : []
146
- ],
147
- external: [
148
- "#shared",
149
- new RegExp("^" + escapeStringRegexp(withTrailingSlash(resolve(nuxt.options.rootDir, nuxt.options.dir.shared)))),
150
- ...viteServer.config.ssr.external || [],
151
- /node_modules/
152
- ],
153
- resolve: {
154
- modules: nuxt.options.modulesDir,
155
- type: "module",
156
- extensions: [".ts", ".js", ".json", ".vue", ".mjs", ".jsx", ".tsx", ".wasm"]
157
- }
158
- };
159
- return (id) => isExternal(id, nuxt.options.rootDir, externalOpts);
160
- }
161
-
162
- function transpile(envs) {
163
- const nuxt = useNuxt();
164
- const transpile2 = [];
165
- for (let pattern of nuxt.options.build.transpile) {
166
- if (typeof pattern === "function") {
167
- const result = pattern(envs);
168
- if (result) {
169
- pattern = result;
170
- }
171
- }
172
- if (typeof pattern === "string") {
173
- transpile2.push(new RegExp(escapeStringRegexp(normalize(pattern))));
174
- } else if (pattern instanceof RegExp) {
175
- transpile2.push(pattern);
176
- }
177
- }
178
- return transpile2;
179
- }
180
-
181
135
  function viteNodePlugin(ctx) {
182
136
  const invalidates = /* @__PURE__ */ new Set();
183
137
  function markInvalidate(mod) {
@@ -264,9 +218,13 @@ function createViteNodeApp(ctx, invalidates = /* @__PURE__ */ new Set()) {
264
218
  const node = new ViteNodeServer(viteServer, {
265
219
  deps: {
266
220
  inline: [
267
- /\/node_modules\/(.*\/)?(nuxt|nuxt3|nuxt-nightly)\//,
221
+ // Common
268
222
  /^#/,
269
- ...transpile({ isServer: true, isDev: ctx.nuxt.options.dev })
223
+ /\?/
224
+ ],
225
+ external: [
226
+ "#shared",
227
+ new RegExp("^" + escapeStringRegexp(withTrailingSlash(resolve(ctx.nuxt.options.rootDir, ctx.nuxt.options.dir.shared))))
270
228
  ]
271
229
  },
272
230
  transformMode: {
@@ -274,14 +232,6 @@ function createViteNodeApp(ctx, invalidates = /* @__PURE__ */ new Set()) {
274
232
  web: []
275
233
  }
276
234
  });
277
- const isExternal = createIsExternal(viteServer, ctx.nuxt);
278
- node.shouldExternalize = async (id) => {
279
- const result = await isExternal(id);
280
- if (result?.external) {
281
- return resolve$1(result.id, { url: ctx.nuxt.options.modulesDir }).catch(() => false);
282
- }
283
- return false;
284
- };
285
235
  return eventHandler(async (event) => {
286
236
  const moduleId = decodeURI(event.path).substring(1);
287
237
  if (moduleId === "/") {
@@ -821,6 +771,25 @@ async function writeManifest(ctx) {
821
771
  }
822
772
  }
823
773
 
774
+ function transpile(envs) {
775
+ const nuxt = useNuxt();
776
+ const transpile2 = [];
777
+ for (let pattern of nuxt.options.build.transpile) {
778
+ if (typeof pattern === "function") {
779
+ const result = pattern(envs);
780
+ if (result) {
781
+ pattern = result;
782
+ }
783
+ }
784
+ if (typeof pattern === "string") {
785
+ transpile2.push(new RegExp(escapeStringRegexp(normalize(pattern))));
786
+ } else if (pattern instanceof RegExp) {
787
+ transpile2.push(pattern);
788
+ }
789
+ }
790
+ return transpile2;
791
+ }
792
+
824
793
  const createSourcemapPreserver = () => {
825
794
  let outputDir;
826
795
  const ids = /* @__PURE__ */ new Set();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/vite-builder-nightly",
3
- "version": "4.0.0-28954008.e4a6cdce",
3
+ "version": "4.0.0-28954996.e5a7c19b",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -21,13 +21,13 @@
21
21
  "dist"
22
22
  ],
23
23
  "devDependencies": {
24
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.0.0-28954008.e4a6cdce",
25
- "rollup": "4.30.1",
24
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.0.0-28954996.e5a7c19b",
25
+ "rollup": "4.31.0",
26
26
  "unbuild": "3.3.1",
27
27
  "vue": "3.5.13"
28
28
  },
29
29
  "dependencies": {
30
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.0.0-28954008.e4a6cdce",
30
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.0.0-28954996.e5a7c19b",
31
31
  "@rollup/plugin-replace": "^6.0.2",
32
32
  "@vitejs/plugin-vue": "^5.2.1",
33
33
  "@vitejs/plugin-vue-jsx": "^4.1.1",
@@ -37,7 +37,6 @@
37
37
  "defu": "^6.1.4",
38
38
  "esbuild": "^0.24.2",
39
39
  "escape-string-regexp": "^5.0.0",
40
- "externality": "^1.0.2",
41
40
  "get-port-please": "^3.1.2",
42
41
  "h3": "npm:h3-nightly@2.0.0-1718872656.6765a6e",
43
42
  "jiti": "^2.4.2",