@nuxt/bridge-edge 3.0.0-27404632.dabb72e → 3.0.0-27405804.ba522b2
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/chunks/module.mjs +16 -22
- package/dist/chunks/module2.mjs +1 -1
- package/package.json +9 -7
package/dist/chunks/module.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire } from 'module';
|
|
|
2
2
|
import { useNuxt, addPluginTemplate, resolveModule, addTemplate, addVitePlugin, addWebpackPlugin, extendWebpackConfig, resolveFiles, defineNuxtModule, resolveAlias, installModule, isNuxt3, addPlugin, nuxtCtx, checkNuxtCompatibility } from '@nuxt/kit';
|
|
3
3
|
import fs, { existsSync, promises } from 'fs';
|
|
4
4
|
import fetch from 'node-fetch';
|
|
5
|
-
import { stringifyQuery, parseURL, parseQuery } from 'ufo';
|
|
5
|
+
import { joinURL, stringifyQuery, parseURL, parseQuery } from 'ufo';
|
|
6
6
|
import { dirname, resolve, isAbsolute, relative, join as join$1, parse as parse$1, normalize } from 'pathe';
|
|
7
7
|
import { getNitroContext, resolveMiddleware, scanMiddleware, writeTypes, build, prepare, generate, wpfs, createDevServer } from '@nuxt/nitro';
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
@@ -290,9 +290,13 @@ function createNuxt2DevServer(nitroContext) {
|
|
|
290
290
|
if (!listener) {
|
|
291
291
|
throw new Error("There is no server listener to call `server.renderRoute()`");
|
|
292
292
|
}
|
|
293
|
-
const
|
|
293
|
+
const res = await fetch(joinURL(listener.url, route), {
|
|
294
294
|
headers: { "nuxt-render-context": stringifyQuery(renderContext) }
|
|
295
|
-
})
|
|
295
|
+
});
|
|
296
|
+
const html = await res.text();
|
|
297
|
+
if (!res.ok) {
|
|
298
|
+
return { html, error: res.statusText };
|
|
299
|
+
}
|
|
296
300
|
return { html };
|
|
297
301
|
}
|
|
298
302
|
return {
|
|
@@ -820,15 +824,6 @@ const autoImports = defineNuxtModule({
|
|
|
820
824
|
await nuxt.callHook("autoImports:sources", options.sources);
|
|
821
825
|
options.sources = options.sources.filter((source) => source.disabled !== true);
|
|
822
826
|
const ctx = createAutoImportContext(options);
|
|
823
|
-
for (const source of options.sources) {
|
|
824
|
-
for (const importName of source.names) {
|
|
825
|
-
if (typeof importName === "string") {
|
|
826
|
-
ctx.autoImports.push({ name: importName, as: importName, from: source.from });
|
|
827
|
-
} else {
|
|
828
|
-
ctx.autoImports.push({ name: importName.name, as: importName.as || importName.name, from: source.from });
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
827
|
let composablesDirs = [
|
|
833
828
|
join$1(nuxt.options.srcDir, "composables"),
|
|
834
829
|
...options.dirs
|
|
@@ -858,15 +853,16 @@ export default () => {};`;
|
|
|
858
853
|
addVitePlugin(TransformPlugin.vite(ctx));
|
|
859
854
|
addWebpackPlugin(TransformPlugin.webpack(ctx));
|
|
860
855
|
}
|
|
861
|
-
const
|
|
856
|
+
const regenerateAutoImports = async () => {
|
|
857
|
+
ctx.autoImports = options.sources.flatMap((source) => source.names.map((importName) => typeof importName === "string" ? { name: importName, as: importName, from: source.from } : { name: importName.name, as: importName.as || importName.name, from: source.from }));
|
|
862
858
|
for (const composablesDir of composablesDirs) {
|
|
863
859
|
await scanForComposables(composablesDir, ctx.autoImports);
|
|
864
860
|
}
|
|
865
861
|
await nuxt.callHook("autoImports:extend", ctx.autoImports);
|
|
866
862
|
updateAutoImportContext(ctx);
|
|
867
|
-
generateDts(ctx);
|
|
868
863
|
};
|
|
869
|
-
await
|
|
864
|
+
await regenerateAutoImports();
|
|
865
|
+
addDeclarationTemplates(ctx);
|
|
870
866
|
nuxt.hook("prepare:types", ({ references }) => {
|
|
871
867
|
references.push({ path: resolve(nuxt.options.buildDir, "types/auto-imports.d.ts") });
|
|
872
868
|
references.push({ path: resolve(nuxt.options.buildDir, "types/imports.d.ts") });
|
|
@@ -874,12 +870,13 @@ export default () => {};`;
|
|
|
874
870
|
nuxt.hook("builder:watch", async (_, path) => {
|
|
875
871
|
const _resolved = resolve(nuxt.options.srcDir, path);
|
|
876
872
|
if (composablesDirs.find((dir) => _resolved.startsWith(dir))) {
|
|
877
|
-
await
|
|
873
|
+
await regenerateAutoImports();
|
|
874
|
+
await nuxt.callHook("builder:generateApp");
|
|
878
875
|
}
|
|
879
876
|
});
|
|
880
877
|
}
|
|
881
878
|
});
|
|
882
|
-
function
|
|
879
|
+
function addDeclarationTemplates(ctx) {
|
|
883
880
|
const nuxt = useNuxt();
|
|
884
881
|
const resolved = {};
|
|
885
882
|
const r = (id) => {
|
|
@@ -896,12 +893,10 @@ function generateDts(ctx) {
|
|
|
896
893
|
};
|
|
897
894
|
addTemplate({
|
|
898
895
|
filename: "types/imports.d.ts",
|
|
899
|
-
write: true,
|
|
900
896
|
getContents: () => toExports(ctx.autoImports)
|
|
901
897
|
});
|
|
902
898
|
addTemplate({
|
|
903
899
|
filename: "types/auto-imports.d.ts",
|
|
904
|
-
write: true,
|
|
905
900
|
getContents: () => `// Generated by auto imports
|
|
906
901
|
declare global {
|
|
907
902
|
${ctx.autoImports.map((i) => ` const ${i.as}: typeof ${genDynamicImport(r(i.from), { wrapper: false })}['${i.name}']`).join("\n")}
|
|
@@ -944,13 +939,12 @@ function setupTypescript() {
|
|
|
944
939
|
const nuxt = useNuxt();
|
|
945
940
|
nuxt.options.extensions.push(...extensions);
|
|
946
941
|
nuxt.options.build.additionalExtensions.push(...extensions);
|
|
947
|
-
const _require = createRequire(import.meta.url);
|
|
948
|
-
const babelPlugin = _require.resolve("@babel/plugin-transform-typescript");
|
|
949
942
|
nuxt.options.build.babel.plugins = nuxt.options.build.babel.plugins || [];
|
|
950
943
|
if (nuxt.options.buildModules.includes("@nuxt/typescript-build")) {
|
|
951
944
|
throw new Error("Please remove `@nuxt/typescript-build` from `buildModules` or set `bridge.typescript: false` to avoid conflict with bridge.");
|
|
952
945
|
}
|
|
953
|
-
|
|
946
|
+
const _require = createRequire(import.meta.url);
|
|
947
|
+
nuxt.options.build.babel.plugins.unshift(_require.resolve("@babel/plugin-proposal-optional-chaining"), _require.resolve("@babel/plugin-proposal-nullish-coalescing-operator"), _require.resolve("@babel/plugin-transform-typescript"));
|
|
954
948
|
extendWebpackConfig((config) => {
|
|
955
949
|
config.resolve.extensions.push(...extensions.map((e) => `.${e}`));
|
|
956
950
|
const babelRule = config.module.rules.find((rule) => rule.test?.test("test.js"));
|
package/dist/chunks/module2.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import hash from 'hash-sum';
|
|
|
4
4
|
import { resolve } from 'pathe';
|
|
5
5
|
import { genImport, genObjectFromRawEntries } from 'knitwork';
|
|
6
6
|
|
|
7
|
-
const version = "3.0.0-
|
|
7
|
+
const version = "3.0.0-27405804.ba522b2";
|
|
8
8
|
|
|
9
9
|
const middlewareTemplate = {
|
|
10
10
|
filename: "middleware.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/bridge-edge",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-27405804.ba522b2",
|
|
4
4
|
"repository": "nuxt/framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,11 +18,13 @@
|
|
|
18
18
|
"prepack": "unbuild"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
|
|
22
|
+
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
|
|
21
23
|
"@babel/plugin-transform-typescript": "^7.16.8",
|
|
22
|
-
"@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-
|
|
23
|
-
"@nuxt/nitro": "npm:@nuxt/nitro-edge@3.0.0-
|
|
24
|
+
"@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-27405804.ba522b2",
|
|
25
|
+
"@nuxt/nitro": "npm:@nuxt/nitro-edge@3.0.0-27405804.ba522b2",
|
|
24
26
|
"@nuxt/postcss8": "^1.1.3",
|
|
25
|
-
"@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-
|
|
27
|
+
"@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-27405804.ba522b2",
|
|
26
28
|
"@vitejs/plugin-legacy": "^1.6.4",
|
|
27
29
|
"@vue/composition-api": "^1.4.6",
|
|
28
30
|
"@vueuse/head": "^0.7.5",
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
"cookie-es": "^0.5.0",
|
|
32
34
|
"defu": "^5.0.1",
|
|
33
35
|
"destr": "^1.1.0",
|
|
34
|
-
"enhanced-resolve": "^5.
|
|
36
|
+
"enhanced-resolve": "^5.9.0",
|
|
35
37
|
"estree-walker": "^3.0.1",
|
|
36
38
|
"externality": "^0.1.6",
|
|
37
39
|
"fs-extra": "^10.0.0",
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
"mlly": "^0.4.2",
|
|
44
46
|
"murmurhash-es": "^0.1.1",
|
|
45
47
|
"node-fetch": "^3.2.0",
|
|
46
|
-
"nuxi": "npm:nuxi-edge@3.0.0-
|
|
48
|
+
"nuxi": "npm:nuxi-edge@3.0.0-27405804.ba522b2",
|
|
47
49
|
"p-debounce": "^4.0.0",
|
|
48
50
|
"pathe": "^0.2.0",
|
|
49
51
|
"postcss": "^8",
|
|
@@ -55,7 +57,7 @@
|
|
|
55
57
|
"semver": "^7.3.5",
|
|
56
58
|
"ufo": "^0.7.9",
|
|
57
59
|
"unplugin": "^0.3.2",
|
|
58
|
-
"unplugin-vue2-script-setup": "0.9.
|
|
60
|
+
"unplugin-vue2-script-setup": "0.9.2",
|
|
59
61
|
"vite": "^2.7.13",
|
|
60
62
|
"vite-plugin-vue2": "^1.9.3",
|
|
61
63
|
"vue-template-compiler": "^2.6.14"
|