@nuxt/bridge-edge 3.0.0-28200790.d820607 → 3.0.0-28244705.131ac01

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/bin/nuxt2.cjs ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ require('@nuxt/cli').run()
3
+ .catch((error) => {
4
+ require('consola').fatal(error)
5
+ require('exit')(2)
6
+ })
@@ -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.2026cf91.mjs';
10
+ import { h as hashId, u as uniq, g as generateDevSSRManifest, i as isCSS } from '../shared/bridge-edge.e329865b.mjs';
11
11
  import { c as createIsExternal } from './vite.mjs';
12
12
  import 'h3';
13
13
  import 'node-fetch';
@@ -0,0 +1,36 @@
1
+ import { addDependency } from 'nypm';
2
+ import { resolvePackageJSON } from 'pkg-types';
3
+ import { logger } from '@nuxt/kit';
4
+ import { isCI } from 'std-env';
5
+
6
+ async function ensurePackageInstalled(rootDir, name, searchPaths) {
7
+ if (await resolvePackageJSON(name, { url: searchPaths }).catch(() => null)) {
8
+ return true;
9
+ }
10
+ logger.info(`Package ${name} is missing`);
11
+ if (isCI) {
12
+ return false;
13
+ }
14
+ const confirm = await logger.prompt(`Do you want to install ${name} package?`, {
15
+ type: "confirm",
16
+ name: "confirm",
17
+ initial: true
18
+ });
19
+ if (!confirm) {
20
+ return false;
21
+ }
22
+ logger.info(`Installing ${name}...`);
23
+ try {
24
+ await addDependency(name, {
25
+ cwd: rootDir,
26
+ dev: true
27
+ });
28
+ logger.success(`Installed ${name}`);
29
+ return true;
30
+ } catch (err) {
31
+ logger.error(err);
32
+ return false;
33
+ }
34
+ }
35
+
36
+ export { ensurePackageInstalled };
@@ -2,7 +2,7 @@ import { normalize, isAbsolute, resolve as resolve$1, join } from 'pathe';
2
2
  import { logger, useNuxt, isIgnored } from '@nuxt/kit';
3
3
  import { resolve, findExports, sanitizeFilePath } from 'mlly';
4
4
  import { joinURL, withoutLeadingSlash, withTrailingSlash } from 'ufo';
5
- import { d as distDir, i as isCSS, p as prepareManifests, a as pkgDir } from '../shared/bridge-edge.2026cf91.mjs';
5
+ import { d as distDir, i as isCSS, p as prepareManifests, a as pkgDir } from '../shared/bridge-edge.e329865b.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';
@@ -626,6 +626,12 @@ function resolveCSSOptions(nuxt) {
626
626
  return css;
627
627
  }
628
628
 
629
+ var __defProp = Object.defineProperty;
630
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
631
+ var __publicField = (obj, key, value) => {
632
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
633
+ return value;
634
+ };
629
635
  async function bundle(nuxt, builder) {
630
636
  for (const p of builder.plugins) {
631
637
  p.src = nuxt.resolver.resolvePath(resolve$1(nuxt.options.buildDir, p.src));
@@ -745,6 +751,8 @@ async function bundle(nuxt, builder) {
745
751
  }
746
752
  class ViteBuilder {
747
753
  constructor(builder) {
754
+ __publicField(this, "builder");
755
+ __publicField(this, "nuxt");
748
756
  this.builder = builder;
749
757
  this.nuxt = builder.nuxt;
750
758
  }
@@ -0,0 +1,44 @@
1
+ /// <reference types="nitropack" />
2
+ import { NuxtModule } from '@nuxt/schema';
3
+
4
+ interface BridgeConfig {
5
+ nitro: boolean
6
+ nitroGenerator: boolean
7
+ vite: boolean
8
+ app: boolean | {}
9
+ capi: boolean | {
10
+ legacy?: boolean
11
+ }
12
+ /**
13
+ * @deprecated use `imports.autoImport` instead to disable auto-importing.
14
+ * @see {@link https://nuxt.com/docs/guide/concepts/auto-imports#disabling-auto-imports}
15
+ */
16
+ imports: boolean
17
+ /** @deprecated */
18
+ autoImports?: boolean
19
+ transpile: boolean
20
+ compatibility: boolean
21
+ postcss8: boolean
22
+ resolve: boolean
23
+ typescript: boolean
24
+ meta: boolean | null
25
+ }
26
+
27
+ declare module '@nuxt/bridge-schema' {
28
+ interface Nuxt2Config {
29
+ bridge?: Partial<BridgeConfig> | false
30
+ }
31
+ }
32
+
33
+ declare module 'nitropack' {
34
+ interface NitroRouteConfig {
35
+ ssr?: boolean
36
+ }
37
+ interface NitroRouteOptions {
38
+ ssr?: boolean
39
+ }
40
+ }
41
+
42
+ declare const _default: NuxtModule<BridgeConfig>;
43
+
44
+ export { _default as default };
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.2026cf91.mjs';
3
+ export { m as default } from './shared/bridge-edge.e329865b.mjs';
4
4
  import 'fs';
5
5
  import 'url';
6
6
  import 'node-fetch';
@@ -32,7 +32,7 @@ export interface NavigateToOptions {
32
32
  export declare const navigateTo: (to: RawLocation | undefined | null, options?: NavigateToOptions) => Promise<void | Route | NavigationFailure> | RawLocation | Route;
33
33
  /** This will abort navigation within a Nuxt route middleware handler. */
34
34
  export declare const abortNavigation: (err?: string | Partial<NuxtError>) => boolean;
35
- type RouteMiddlewareReturn = void | Error | string | Location | boolean;
35
+ type RouteMiddlewareReturn = void | Error | string | Location | boolean | Route;
36
36
  export interface RouteMiddleware {
37
37
  (to: Route, from: Route): RouteMiddlewareReturn | Promise<RouteMiddlewareReturn>;
38
38
  }
@@ -1,2 +1,2 @@
1
1
  export const viteNodeOptions: any;
2
- export const viteNodeFetch: import("ofetch/dist/error-d5becc6e").$;
2
+ export const viteNodeFetch: import("ofetch/dist/shared/ofetch.441891d5").$;
@@ -1,4 +1,4 @@
1
- import { useNuxt, addPluginTemplate, tryImportModule, resolvePath, addTemplate, resolveAlias, addWebpackPlugin, addVitePlugin, addPlugin, extendWebpackConfig, resolveFiles, defineNuxtModule, logger, addComponent, addImportsSources, installModule, checkNuxtCompatibility } from '@nuxt/kit';
1
+ import { useNuxt, addPluginTemplate, tryImportModule, resolvePath, addTemplate, resolveAlias, addWebpackPlugin, addVitePlugin, addPlugin, extendWebpackConfig, resolveFiles, defineNuxtModule, logger, addComponent, addImportsSources, installModule, writeTypes as writeTypes$1, checkNuxtCompatibility } from '@nuxt/kit';
2
2
  import { dynamicEventHandler, fromNodeMiddleware } from 'h3';
3
3
  import fs, { existsSync, readdirSync, statSync, promises } from 'fs';
4
4
  import { fileURLToPath, pathToFileURL } from 'url';
@@ -25,8 +25,16 @@ import { defineUnimportPreset, createUnimport, toImports } from 'unimport';
25
25
  import { camelCase } from 'scule';
26
26
  import escapeRE from 'escape-string-regexp';
27
27
 
28
+ var __defProp$1 = Object.defineProperty;
29
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
30
+ var __publicField$1 = (obj, key, value) => {
31
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
32
+ return value;
33
+ };
28
34
  class AsyncLoadingPlugin {
29
35
  constructor(opts) {
36
+ __publicField$1(this, "opts");
37
+ __publicField$1(this, "Template");
30
38
  this.opts = opts;
31
39
  const _require = createRequire(import.meta.url);
32
40
  const TemplatePath = _require.resolve("webpack/lib/Template", { paths: [...this.opts.modulesDir] });
@@ -861,6 +869,12 @@ function setupCAPIBridge(options) {
861
869
  addWebpackPlugin(KeyPlugin.webpack());
862
870
  }
863
871
 
872
+ var __defProp = Object.defineProperty;
873
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
874
+ var __publicField = (obj, key, value) => {
875
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
876
+ return value;
877
+ };
864
878
  const DEFAULTS = {
865
879
  fileSystem: new enhancedResolve.CachedInputFileSystem(fs, 4e3),
866
880
  extensions: [".ts", ".tsx", ".mjs", ".cjs", ".js", ".jsx", ".json", ".vue"]
@@ -875,6 +889,7 @@ const createResolver = (resolveOptions) => {
875
889
  };
876
890
  class EnhancedResolverPlugin {
877
891
  constructor(options) {
892
+ __publicField(this, "resolver");
878
893
  this.resolver = createResolver(options);
879
894
  }
880
895
  apply(defaultResolver) {
@@ -1308,7 +1323,6 @@ const metaModule = defineNuxtModule({
1308
1323
  "useServerHeadSafe"
1309
1324
  ]
1310
1325
  });
1311
- addPlugin({ src: resolve(runtimeDir, "plugin") });
1312
1326
  addPlugin({ src: resolve(runtimeDir, "plugins/unhead") });
1313
1327
  }
1314
1328
  });
@@ -1519,6 +1533,9 @@ const module = defineNuxtModule({
1519
1533
  throw new Error("[bridge] Vite build will not work unless Nitro is enabled.");
1520
1534
  }
1521
1535
  if (opts.nitro) {
1536
+ if (!await import('../chunks/features.mjs').then((r) => r.ensurePackageInstalled(nuxt.options.rootDir, "nuxi", nuxt.options.modulesDir))) {
1537
+ logger.warn("Failed to install `nuxi`, please install it manually, or change the `nitro` option to false in `nuxt.config`");
1538
+ }
1522
1539
  nuxt.options.router.base = nuxt.options.app.baseURL || "/";
1523
1540
  nuxt.hook("modules:done", async () => {
1524
1541
  await setupNitroBridge();
@@ -1584,6 +1601,11 @@ const module = defineNuxtModule({
1584
1601
  }
1585
1602
  if (opts.typescript) {
1586
1603
  await setupTypescript();
1604
+ if (!opts.nitro) {
1605
+ nuxt.hook("modules:done", async () => {
1606
+ await writeTypes$1(nuxt);
1607
+ });
1608
+ }
1587
1609
  }
1588
1610
  if (opts.resolve) {
1589
1611
  setupBetterResolve();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/bridge-edge",
3
- "version": "3.0.0-28200790.d820607",
3
+ "version": "3.0.0-28244705.131ac01",
4
4
  "repository": "nuxt/bridge",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,79 +13,80 @@
13
13
  "dist"
14
14
  ],
15
15
  "bin": {
16
- "nuxi": "./bin/nuxt.mjs"
16
+ "nuxt2": "./bin/nuxt2.cjs"
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
20
20
  "@babel/plugin-proposal-optional-chaining": "^7.21.0",
21
- "@babel/plugin-transform-typescript": "^7.22.9",
22
- "@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.0.0-28200790.d820607",
21
+ "@babel/plugin-transform-typescript": "^7.22.15",
22
+ "@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.0.0-28244705.131ac01",
23
23
  "@nuxt/devalue": "^2.0.2",
24
- "@nuxt/kit": "3.6.5",
24
+ "@nuxt/kit": "3.7.3",
25
25
  "@nuxt/postcss8": "^1.1.3",
26
- "@nuxt/schema": "3.6.5",
27
- "@nuxt/ui-templates": "^1.2.0",
28
- "@unhead/ssr": "^1.1.32",
29
- "@unhead/vue": "^1.1.32",
26
+ "@nuxt/schema": "3.7.3",
27
+ "@nuxt/ui-templates": "^1.3.1",
28
+ "@unhead/ssr": "^1.7.2",
29
+ "@unhead/vue": "^1.7.2",
30
30
  "@vitejs/plugin-legacy": "^4.1.1",
31
31
  "@vitejs/plugin-vue2": "^2.2.0",
32
32
  "acorn": "^8.10.0",
33
33
  "cookie-es": "^1.0.0",
34
34
  "defu": "^6.1.2",
35
- "destr": "^2.0.0",
35
+ "destr": "^2.0.1",
36
36
  "enhanced-resolve": "^5.15.0",
37
37
  "escape-string-regexp": "^5.0.0",
38
38
  "estree-walker": "^3.0.3",
39
39
  "externality": "^1.0.2",
40
40
  "fs-extra": "^10.1.0",
41
- "get-port-please": "^3.0.1",
41
+ "get-port-please": "^3.1.1",
42
42
  "globby": "^13.2.2",
43
- "h3": "^1.7.1",
43
+ "h3": "^1.8.1",
44
44
  "hash-sum": "^2.0.0",
45
45
  "knitwork": "^1.0.0",
46
- "magic-string": "^0.30.1",
47
- "mlly": "^1.4.0",
48
- "nitropack": "^2.5.2",
49
- "node-fetch": "^3.3.1",
50
- "nuxi": "3.6.5",
51
- "ofetch": "^1.1.1",
52
- "ohash": "^1.1.2",
46
+ "magic-string": "^0.30.3",
47
+ "mlly": "^1.4.2",
48
+ "nitropack": "^2.6.3",
49
+ "node-fetch": "^3.3.2",
50
+ "nypm": "^0.3.3",
51
+ "ofetch": "^1.3.3",
52
+ "ohash": "^1.1.3",
53
53
  "pathe": "^1.1.1",
54
54
  "perfect-debounce": "^1.0.0",
55
- "postcss": "^8.4.26",
55
+ "pkg-types": "^1.0.3",
56
+ "postcss": "^8.4.29",
56
57
  "postcss-import": "^15.1.0",
57
58
  "postcss-import-resolver": "^2.0.0",
58
- "postcss-preset-env": "^9.0.0",
59
+ "postcss-preset-env": "^9.1.3",
59
60
  "postcss-url": "^10.1.3",
60
61
  "scule": "^1.0.0",
61
62
  "semver": "^7.5.4",
62
- "std-env": "^3.3.3",
63
- "terser": "^5.19.1",
64
- "ufo": "^1.1.2",
63
+ "std-env": "^3.4.3",
64
+ "terser": "^5.19.4",
65
+ "ufo": "^1.3.0",
65
66
  "unctx": "^2.3.1",
66
- "unimport": "^3.1.0",
67
+ "unimport": "^3.3.0",
67
68
  "unplugin": "^1.4.0",
68
- "untyped": "^1.3.2",
69
- "vite": "~4.4.6",
70
- "vite-node": "^0.33.0",
71
- "vue-bundle-renderer": "^1.0.3"
69
+ "untyped": "^1.4.0",
70
+ "vite": "~4.4.9",
71
+ "vite-node": "^0.34.4",
72
+ "vue-bundle-renderer": "^2.0.0"
72
73
  },
73
74
  "devDependencies": {
74
75
  "@nuxt/types": "^2.17.1",
75
76
  "@nuxtjs/eslint-config": "^12.0.0",
76
- "@nuxtjs/eslint-config-typescript": "^12.0.0",
77
+ "@nuxtjs/eslint-config-typescript": "^12.1.0",
77
78
  "@types/fs-extra": "^9.0.13",
78
79
  "@types/hash-sum": "^1.0.0",
79
80
  "@types/node-fetch": "^3.0.2",
80
81
  "nuxt": "^2.17.1",
81
- "unbuild": "1.2.1",
82
+ "unbuild": "2.0.0",
82
83
  "vue": "^2.7.14",
83
84
  "vue-router": "^3.6.5"
84
85
  },
85
86
  "engines": {
86
87
  "node": "^14.16.0 || ^16.11.0 || >=17.0.0"
87
88
  },
88
- "packageManager": "pnpm@8.6.9",
89
+ "packageManager": "pnpm@8.7.5",
89
90
  "_name": "@nuxt/bridge",
90
91
  "scripts": {
91
92
  "build": "pnpm prepack"
package/bin/nuxt.mjs DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import 'nuxi/cli'
@@ -1,2 +0,0 @@
1
- declare const _default: (ctx: import("../app").Context, inject: (id: string, value: any) => void) => void;
2
- export default _default;
@@ -1,5 +0,0 @@
1
- import { VueHeadMixin } from "@unhead/vue";
2
- import { defineNuxtPlugin } from "../app.mjs";
3
- export default defineNuxtPlugin((nuxtApp) => {
4
- nuxtApp.vueApp.mixin(VueHeadMixin);
5
- });