@nuxt/bridge-edge 3.0.0-27405804.ba522b2 → 3.0.0-27405808.7825e2a
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 +30 -15
- package/dist/chunks/module2.mjs +1 -1
- package/dist/chunks/vite.mjs +1 -0
- package/dist/module.mjs +1 -0
- package/package.json +6 -5
package/dist/chunks/module.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
|
-
import { useNuxt, addPluginTemplate, resolveModule, addTemplate, addVitePlugin, addWebpackPlugin, extendWebpackConfig, resolveFiles, defineNuxtModule,
|
|
2
|
+
import { useNuxt, addPluginTemplate, resolveModule, addTemplate, resolveAlias, addVitePlugin, addWebpackPlugin, extendWebpackConfig, resolveFiles, defineNuxtModule, installModule, isNuxt3, addPlugin, nuxtCtx, checkNuxtCompatibility } from '@nuxt/kit';
|
|
3
3
|
import fs, { existsSync, promises } from 'fs';
|
|
4
4
|
import fetch from 'node-fetch';
|
|
5
5
|
import { joinURL, stringifyQuery, parseURL, parseQuery } from 'ufo';
|
|
@@ -7,7 +7,8 @@ import { dirname, resolve, isAbsolute, relative, join as join$1, parse as parse$
|
|
|
7
7
|
import { getNitroContext, resolveMiddleware, scanMiddleware, writeTypes, build, prepare, generate, wpfs, createDevServer } from '@nuxt/nitro';
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
9
|
import { join } from 'path';
|
|
10
|
-
import { genDynamicImport,
|
|
10
|
+
import { genDynamicImport, genString, genExport, genImport } from 'knitwork';
|
|
11
|
+
import escapeRE from 'escape-string-regexp';
|
|
11
12
|
import crypto from 'crypto';
|
|
12
13
|
import { createUnplugin } from 'unplugin';
|
|
13
14
|
import { parse } from 'acorn';
|
|
@@ -324,6 +325,25 @@ export {}
|
|
|
324
325
|
`
|
|
325
326
|
};
|
|
326
327
|
|
|
328
|
+
const adHocModules = ["router", "pages", "auto-imports", "meta", "components"];
|
|
329
|
+
const schemaTemplate = {
|
|
330
|
+
filename: "types/schema.d.ts",
|
|
331
|
+
getContents: ({ nuxt }) => {
|
|
332
|
+
const moduleInfo = nuxt.options._installedModules.map((m) => ({
|
|
333
|
+
...m.meta || {},
|
|
334
|
+
importName: m.entryPath || m.meta?.name
|
|
335
|
+
})).filter((m) => m.configKey && m.name && !adHocModules.includes(m.name));
|
|
336
|
+
return [
|
|
337
|
+
"import { NuxtModule } from '@nuxt/schema'",
|
|
338
|
+
"declare module '@nuxt/schema' {",
|
|
339
|
+
" interface NuxtConfig {",
|
|
340
|
+
...moduleInfo.filter(Boolean).map((meta) => ` [${genString(meta.configKey)}]?: typeof ${genDynamicImport(meta.importName, { wrapper: false })}.default extends NuxtModule<infer O> ? Partial<O> : Record<string, any>`),
|
|
341
|
+
" }",
|
|
342
|
+
"}"
|
|
343
|
+
].join("\n");
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
|
|
327
347
|
function setupAppBridge(_options) {
|
|
328
348
|
const nuxt = useNuxt();
|
|
329
349
|
nuxt.options.alias["#app"] = resolve(distDir$1, "runtime/index.mjs");
|
|
@@ -348,6 +368,13 @@ function setupAppBridge(_options) {
|
|
|
348
368
|
nuxt.hook("prepare:types", ({ references }) => {
|
|
349
369
|
references.push({ path: resolve(nuxt.options.buildDir, "types/components.d.ts") });
|
|
350
370
|
});
|
|
371
|
+
nuxt.hook("modules:done", async (container) => {
|
|
372
|
+
nuxt.options._installedModules = await Promise.all(Object.values(container.requiredModules).map(async (m) => ({
|
|
373
|
+
meta: await m.handler.getMeta?.(),
|
|
374
|
+
entryPath: resolveAlias(m.src, nuxt.options.alias)
|
|
375
|
+
})));
|
|
376
|
+
addTemplate(schemaTemplate);
|
|
377
|
+
});
|
|
351
378
|
nuxt.options.alias["vue2-bridge"] = resolve(distDir$1, "runtime/vue2-bridge.mjs");
|
|
352
379
|
for (const alias of [
|
|
353
380
|
"vue",
|
|
@@ -766,18 +793,6 @@ async function scanForComposables(dir, autoImports) {
|
|
|
766
793
|
}));
|
|
767
794
|
}
|
|
768
795
|
|
|
769
|
-
function escapeStringRegexp(string) {
|
|
770
|
-
if (typeof string !== 'string') {
|
|
771
|
-
throw new TypeError('Expected a string');
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
// Escape characters with special meaning either inside or outside character sets.
|
|
775
|
-
// Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
|
776
|
-
return string
|
|
777
|
-
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
|
|
778
|
-
.replace(/-/g, '\\x2d');
|
|
779
|
-
}
|
|
780
|
-
|
|
781
796
|
function createAutoImportContext(opts) {
|
|
782
797
|
return {
|
|
783
798
|
autoImports: [],
|
|
@@ -799,7 +814,7 @@ function updateAutoImportContext(ctx) {
|
|
|
799
814
|
}
|
|
800
815
|
}
|
|
801
816
|
ctx.autoImports = ctx.autoImports.filter((i) => i.disabled !== true);
|
|
802
|
-
ctx.matchRE = new RegExp(`\\b(${ctx.autoImports.map((i) =>
|
|
817
|
+
ctx.matchRE = new RegExp(`\\b(${ctx.autoImports.map((i) => escapeRE(i.as)).join("|")})\\b`, "g");
|
|
803
818
|
ctx.map.clear();
|
|
804
819
|
for (const autoImport of ctx.autoImports) {
|
|
805
820
|
ctx.map.set(autoImport.as, autoImport);
|
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-27405808.7825e2a";
|
|
8
8
|
|
|
9
9
|
const middlewareTemplate = {
|
|
10
10
|
filename: "middleware.js",
|
package/dist/chunks/vite.mjs
CHANGED
package/dist/module.mjs
CHANGED
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-27405808.7825e2a",
|
|
4
4
|
"repository": "nuxt/framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
|
|
22
22
|
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
|
|
23
23
|
"@babel/plugin-transform-typescript": "^7.16.8",
|
|
24
|
-
"@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-
|
|
25
|
-
"@nuxt/nitro": "npm:@nuxt/nitro-edge@3.0.0-
|
|
24
|
+
"@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-27405808.7825e2a",
|
|
25
|
+
"@nuxt/nitro": "npm:@nuxt/nitro-edge@3.0.0-27405808.7825e2a",
|
|
26
26
|
"@nuxt/postcss8": "^1.1.3",
|
|
27
|
-
"@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-
|
|
27
|
+
"@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-27405808.7825e2a",
|
|
28
28
|
"@vitejs/plugin-legacy": "^1.6.4",
|
|
29
29
|
"@vue/composition-api": "^1.4.6",
|
|
30
30
|
"@vueuse/head": "^0.7.5",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"defu": "^5.0.1",
|
|
35
35
|
"destr": "^1.1.0",
|
|
36
36
|
"enhanced-resolve": "^5.9.0",
|
|
37
|
+
"escape-string-regexp": "^5.0.0",
|
|
37
38
|
"estree-walker": "^3.0.1",
|
|
38
39
|
"externality": "^0.1.6",
|
|
39
40
|
"fs-extra": "^10.0.0",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"mlly": "^0.4.2",
|
|
46
47
|
"murmurhash-es": "^0.1.1",
|
|
47
48
|
"node-fetch": "^3.2.0",
|
|
48
|
-
"nuxi": "npm:nuxi-edge@3.0.0-
|
|
49
|
+
"nuxi": "npm:nuxi-edge@3.0.0-27405808.7825e2a",
|
|
49
50
|
"p-debounce": "^4.0.0",
|
|
50
51
|
"pathe": "^0.2.0",
|
|
51
52
|
"postcss": "^8",
|