@nuxt/bridge-edge 3.1.0-28519866.cbbbacf → 3.1.0-28522654.a6eae9b

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.
@@ -7,7 +7,7 @@ import { genObjectFromRawEntries, genDynamicImport } from 'knitwork';
7
7
  import fse from 'fs-extra';
8
8
  import { debounce } from 'perfect-debounce';
9
9
  import { isIgnored, logger } from '@nuxt/kit';
10
- import { h as hashId, u as uniq, g as generateDevSSRManifest, i as isCSS } from '../shared/bridge-edge.efdbfaeb.mjs';
10
+ import { h as hashId, u as uniq, g as generateDevSSRManifest, i as isCSS } from '../shared/bridge-edge.4e3b17a7.mjs';
11
11
  import { c as createIsExternal } from './vite.mjs';
12
12
  import 'h3';
13
13
  import 'node-fetch';
@@ -34,7 +34,6 @@ import '@vitejs/plugin-vue2';
34
34
  import 'get-port-please';
35
35
  import 'vite-node/server';
36
36
  import 'vite';
37
- import '@vitejs/plugin-legacy';
38
37
  import '@rollup/plugin-replace';
39
38
  import 'postcss-import-resolver';
40
39
 
@@ -3,7 +3,7 @@ import hash from 'hash-sum';
3
3
  import { resolve } from 'pathe';
4
4
  import { genImport, genObjectFromRawEntries } from 'knitwork';
5
5
 
6
- const version = "3.1.0-28519866.cbbbacf";
6
+ const version = "3.1.0-28522654.a6eae9b";
7
7
 
8
8
  const middlewareTemplate = {
9
9
  filename: "middleware.js",
@@ -2,7 +2,7 @@ import { normalize, isAbsolute, resolve as resolve$1, join } from 'pathe';
2
2
  import { logger, isIgnored } from '@nuxt/kit';
3
3
  import { resolve, findExports, sanitizeFilePath } from 'mlly';
4
4
  import { joinURL, withoutLeadingSlash, withTrailingSlash } from 'ufo';
5
- import { t as transpile, d as distDir, i as isCSS, p as prepareManifests, a as pkgDir } from '../shared/bridge-edge.efdbfaeb.mjs';
5
+ import { t as transpile, d as distDir, i as isCSS, p as prepareManifests, a as pkgDir } from '../shared/bridge-edge.4e3b17a7.mjs';
6
6
  import createVuePlugin from '@vitejs/plugin-vue2';
7
7
  import { getPort } from 'get-port-please';
8
8
  import { toNodeListener, createApp, defineEventHandler, defineLazyEventHandler, eventHandler, createError } from 'h3';
@@ -13,15 +13,10 @@ import fse from 'fs-extra';
13
13
  import { isFileServingAllowed } from 'vite';
14
14
  import { normalizeViteManifest } from 'vue-bundle-renderer';
15
15
  import { ExternalsDefaults, isExternal } from 'externality';
16
- import require$$0 from '@vitejs/plugin-legacy';
17
16
  import replace$1 from '@rollup/plugin-replace';
18
17
  import MagicString from 'magic-string';
19
18
  import createResolver from 'postcss-import-resolver';
20
19
 
21
- function getDefaultExportFromCjs (x) {
22
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
23
- }
24
-
25
20
  // CommonJS proxy to bypass jiti transforms from nuxt 2
26
21
  // eslint-disable-next-line jsdoc/valid-types
27
22
  /** @type {typeof import('vite')} */
@@ -245,12 +240,6 @@ async function initViteNodeServer(ctx) {
245
240
  );
246
241
  }
247
242
 
248
- // CommonJS proxy to bypass jiti transforms from nuxt 2
249
- /** @type {typeof import('@vitejs/plugin-legacy')['default'] } */
250
- var stubLegacy = require$$0;
251
-
252
- const PluginLegacy = /*@__PURE__*/getDefaultExportFromCjs(stubLegacy);
253
-
254
243
  function devStyleSSRPlugin(options) {
255
244
  return {
256
245
  name: "nuxt:dev-style-ssr",
@@ -327,7 +316,6 @@ async function buildClient(ctx) {
327
316
  plugins: [
328
317
  jsxPlugin(),
329
318
  createVuePlugin(ctx.config.vue),
330
- PluginLegacy(),
331
319
  devStyleSSRPlugin({
332
320
  srcDir: ctx.nuxt.options.srcDir,
333
321
  buildAssetsURL: joinURL(ctx.nuxt.options.app.baseURL, ctx.nuxt.options.app.buildAssetsDir)
@@ -339,6 +327,11 @@ async function buildClient(ctx) {
339
327
  middlewareMode: true
340
328
  }
341
329
  });
330
+ const disabledLegacy = typeof ctx.nuxt.options.bridge.vite === "object" && ctx.nuxt.options.bridge.vite.legacy === false;
331
+ if (!disabledLegacy) {
332
+ const legacyPlugin = await import('@vitejs/plugin-legacy').then((r) => r.default || r);
333
+ clientConfig.plugins.push(legacyPlugin());
334
+ }
342
335
  if (!ctx.nuxt.options.dev) {
343
336
  clientConfig.server.hmr = false;
344
337
  }
@@ -745,8 +738,8 @@ class ViteBuilder {
745
738
  }
746
739
 
747
740
  const vite = {
748
- __proto__: null,
749
- ViteBuilder: ViteBuilder
741
+ __proto__: null,
742
+ ViteBuilder: ViteBuilder
750
743
  };
751
744
 
752
745
  export { createIsExternal as c, vite as v };
package/dist/module.d.mts CHANGED
@@ -4,7 +4,12 @@ import { NuxtModule } from '@nuxt/schema';
4
4
  interface BridgeConfig {
5
5
  nitro: boolean
6
6
  nitroGenerator: boolean
7
- vite: boolean
7
+ vite: boolean | {
8
+ /**
9
+ * If set to false, `@vitejs/plugin-legacy` not used.
10
+ */
11
+ legacy?: boolean
12
+ }
8
13
  app: boolean | {}
9
14
  capi: boolean | {
10
15
  legacy?: boolean
package/dist/module.d.ts CHANGED
@@ -4,7 +4,12 @@ import { NuxtModule } from '@nuxt/schema';
4
4
  interface BridgeConfig {
5
5
  nitro: boolean
6
6
  nitroGenerator: boolean
7
- vite: boolean
7
+ vite: boolean | {
8
+ /**
9
+ * If set to false, `@vitejs/plugin-legacy` not used.
10
+ */
11
+ legacy?: boolean
12
+ }
8
13
  app: boolean | {}
9
14
  capi: boolean | {
10
15
  legacy?: boolean
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import '@nuxt/kit';
2
2
  import 'h3';
3
- export { m as default } from './shared/bridge-edge.efdbfaeb.mjs';
3
+ export { m as default } from './shared/bridge-edge.4e3b17a7.mjs';
4
4
  import 'fs';
5
5
  import 'url';
6
6
  import 'node-fetch';
@@ -1614,48 +1614,54 @@ async function generateBuildManifest(ctx) {
1614
1614
  }
1615
1615
  }
1616
1616
  }
1617
- const polyfillName = Object.values(clientManifest).find((entry) => entry.file.startsWith("polyfills-legacy"))?.file;
1618
- const polyfill = await fse.readFile(rDist("client", buildAssetsDir, polyfillName), "utf-8");
1619
- const clientImports = /* @__PURE__ */ new Set();
1620
- const clientEntry = {
1621
- assets: /* @__PURE__ */ new Set(),
1622
- css: /* @__PURE__ */ new Set(),
1623
- dynamicImports: /* @__PURE__ */ new Set()
1624
- };
1625
- for (const entry in clientManifest) {
1626
- if (!clientManifest[entry].file.startsWith("polyfills-legacy") && clientManifest[entry].file.includes("-legacy")) {
1627
- clientImports.add(clientManifest[entry].file);
1628
- for (const key of ["css", "assets", "dynamicImports"]) {
1629
- for (const file of clientManifest[entry][key] || []) {
1630
- clientEntry[key].add(file);
1617
+ const disabledLegacy = typeof ctx.nuxt.options.bridge.vite === "object" && ctx.nuxt.options.bridge.vite.legacy === false;
1618
+ let manifest;
1619
+ if (disabledLegacy) {
1620
+ manifest = normalizeViteManifest(clientManifest);
1621
+ } else {
1622
+ const polyfillName = Object.values(clientManifest).find((entry) => entry.file.startsWith("polyfills-legacy"))?.file;
1623
+ const polyfill = await fse.readFile(rDist("client", buildAssetsDir, polyfillName), "utf-8");
1624
+ const clientImports = /* @__PURE__ */ new Set();
1625
+ const clientEntry = {
1626
+ assets: /* @__PURE__ */ new Set(),
1627
+ css: /* @__PURE__ */ new Set(),
1628
+ dynamicImports: /* @__PURE__ */ new Set()
1629
+ };
1630
+ for (const entry in clientManifest) {
1631
+ if (!clientManifest[entry].file.startsWith("polyfills-legacy") && clientManifest[entry].file.includes("-legacy")) {
1632
+ clientImports.add(clientManifest[entry].file);
1633
+ for (const key of ["css", "assets", "dynamicImports"]) {
1634
+ for (const file of clientManifest[entry][key] || []) {
1635
+ clientEntry[key].add(file);
1636
+ }
1631
1637
  }
1632
1638
  }
1639
+ delete clientManifest[entry].isEntry;
1633
1640
  }
1634
- delete clientManifest[entry].isEntry;
1641
+ const clientEntryCode = [
1642
+ polyfill,
1643
+ "var appConfig = window && window.__NUXT__ && window.__NUXT__.config.app || {}",
1644
+ 'var publicBase = appConfig.cdnURL || appConfig.baseURL || "/"',
1645
+ 'function joinURL (a, b) { return a.replace(/\\/+$/, "") + "/" + b.replace(/^\\/+/, "") }',
1646
+ 'globalThis.__publicAssetsURL = function(id) { return joinURL(publicBase, id || "") }',
1647
+ 'globalThis.__buildAssetsURL = function(id) { return joinURL(publicBase, joinURL(appConfig.buildAssetsDir, id || "")) }',
1648
+ `var imports = ${JSON.stringify([...clientImports])};`,
1649
+ "imports.reduce(function(p, id){return p.then(function(){return System.import(__buildAssetsURL(id))})}, Promise.resolve())"
1650
+ ].join("\n");
1651
+ const clientEntryName = "entry-legacy." + hash(clientEntryCode) + ".js";
1652
+ await fse.writeFile(rDist("client", buildAssetsDir, clientEntryName), clientEntryCode, "utf-8");
1653
+ manifest = normalizeViteManifest({
1654
+ [clientEntryName]: {
1655
+ file: clientEntryName,
1656
+ module: true,
1657
+ isEntry: true,
1658
+ css: [...clientEntry.css],
1659
+ assets: [...clientEntry.assets],
1660
+ dynamicImports: [...clientEntry.dynamicImports]
1661
+ },
1662
+ ...clientManifest
1663
+ });
1635
1664
  }
1636
- const clientEntryCode = [
1637
- polyfill,
1638
- "var appConfig = window && window.__NUXT__ && window.__NUXT__.config.app || {}",
1639
- 'var publicBase = appConfig.cdnURL || appConfig.baseURL || "/"',
1640
- 'function joinURL (a, b) { return a.replace(/\\/+$/, "") + "/" + b.replace(/^\\/+/, "") }',
1641
- 'globalThis.__publicAssetsURL = function(id) { return joinURL(publicBase, id || "") }',
1642
- 'globalThis.__buildAssetsURL = function(id) { return joinURL(publicBase, joinURL(appConfig.buildAssetsDir, id || "")) }',
1643
- `var imports = ${JSON.stringify([...clientImports])};`,
1644
- "imports.reduce(function(p, id){return p.then(function(){return System.import(__buildAssetsURL(id))})}, Promise.resolve())"
1645
- ].join("\n");
1646
- const clientEntryName = "entry-legacy." + hash(clientEntryCode) + ".js";
1647
- await fse.writeFile(rDist("client", buildAssetsDir, clientEntryName), clientEntryCode, "utf-8");
1648
- const manifest = normalizeViteManifest({
1649
- [clientEntryName]: {
1650
- file: clientEntryName,
1651
- module: true,
1652
- isEntry: true,
1653
- css: [...clientEntry.css],
1654
- assets: [...clientEntry.assets],
1655
- dynamicImports: [...clientEntry.dynamicImports]
1656
- },
1657
- ...clientManifest
1658
- });
1659
1665
  await writeClientManifest(manifest, ctx.nuxt.options.buildDir);
1660
1666
  await fse.remove(rDist("client/manifest.json"));
1661
1667
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/bridge-edge",
3
- "version": "3.1.0-28519866.cbbbacf",
3
+ "version": "3.1.0-28522654.a6eae9b",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/bridge.git"
@@ -22,15 +22,15 @@
22
22
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
23
23
  "@babel/plugin-proposal-optional-chaining": "^7.21.0",
24
24
  "@babel/plugin-transform-typescript": "^7.24.1",
25
- "@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.1.0-28519866.cbbbacf",
25
+ "@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.1.0-28522654.a6eae9b",
26
26
  "@nuxt/devalue": "^2.0.2",
27
27
  "@nuxt/kit": "3.11.1",
28
28
  "@nuxt/postcss8": "^1.1.3",
29
29
  "@nuxt/schema": "3.11.1",
30
30
  "@nuxt/ui-templates": "^1.3.1",
31
31
  "@rollup/plugin-replace": "^5.0.5",
32
- "@unhead/ssr": "^1.8.20",
33
- "@unhead/vue": "^1.8.20",
32
+ "@unhead/ssr": "^1.9.1",
33
+ "@unhead/vue": "^1.9.1",
34
34
  "@vitejs/plugin-legacy": "^5.3.2",
35
35
  "@vitejs/plugin-vue2": "^2.3.1",
36
36
  "acorn": "^8.11.3",
@@ -74,7 +74,7 @@
74
74
  "unimport": "^3.7.1",
75
75
  "unplugin": "^1.10.0",
76
76
  "untyped": "^1.4.2",
77
- "vite": "~5.2.3",
77
+ "vite": "~5.2.6",
78
78
  "vite-node": "^1.4.0",
79
79
  "vue-bundle-renderer": "^2.0.0"
80
80
  },
package/types.d.ts CHANGED
@@ -23,7 +23,12 @@ export interface NuxtSSRContext extends SSRContext {
23
23
  export interface BridgeConfig {
24
24
  nitro: boolean
25
25
  nitroGenerator: boolean
26
- vite: boolean
26
+ vite: boolean | {
27
+ /**
28
+ * If set to false, `@vitejs/plugin-legacy` not used.
29
+ */
30
+ legacy?: boolean
31
+ }
27
32
  app: boolean | {}
28
33
  capi: boolean | {
29
34
  legacy?: boolean