nuxt-nightly 4.1.1-29281581.418bafeb → 4.1.1-29282072.39113ab4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const setInterval:
|
|
1
|
+
export declare const setInterval: typeof globalThis.setInterval | (() => void);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createError } from "../composables/error.js";
|
|
2
2
|
const intervalError = "[nuxt] `setInterval` should not be used on the server. Consider wrapping it with an `onNuxtReady`, `onBeforeMount` or `onMounted` lifecycle hook, or ensure you only call it in the browser by checking `import.meta.client`.";
|
|
3
|
-
export const setInterval = import.meta.client ?
|
|
3
|
+
export const setInterval = import.meta.client ? globalThis.setInterval : () => {
|
|
4
4
|
if (import.meta.dev) {
|
|
5
5
|
throw createError({
|
|
6
6
|
statusCode: 500,
|
|
@@ -13,7 +13,7 @@ const CookieDefaults = {
|
|
|
13
13
|
decode: (val) => destr(decodeURIComponent(val)),
|
|
14
14
|
encode: (val) => encodeURIComponent(typeof val === "string" ? val : JSON.stringify(val))
|
|
15
15
|
};
|
|
16
|
-
const store = import.meta.client && cookieStore ?
|
|
16
|
+
const store = import.meta.client && cookieStore ? globalThis.cookieStore : void 0;
|
|
17
17
|
export function useCookie(name, _opts) {
|
|
18
18
|
const opts = { ...CookieDefaults, ..._opts };
|
|
19
19
|
opts.filter ??= (key) => key === name;
|
package/dist/index.mjs
CHANGED
|
@@ -35,7 +35,6 @@ import { splitByCase, kebabCase, pascalCase, camelCase } from 'scule';
|
|
|
35
35
|
import { createUnplugin } from 'unplugin';
|
|
36
36
|
import { findStaticImports, findExports, parseStaticImport, parseNodeModulePath, lookupNodeModuleSubpath } from 'mlly';
|
|
37
37
|
import MagicString from 'magic-string';
|
|
38
|
-
import { stripLiteral } from 'strip-literal';
|
|
39
38
|
import { unheadVueComposablesImports } from '@unhead/vue';
|
|
40
39
|
import { defineUnimportPreset, createUnimport, toExports, scanDirExports } from 'unimport';
|
|
41
40
|
import { glob } from 'tinyglobby';
|
|
@@ -1105,8 +1104,6 @@ function resolveEnd(node) {
|
|
|
1105
1104
|
return "fnNode" in node ? node.fnNode.end : node.end;
|
|
1106
1105
|
}
|
|
1107
1106
|
|
|
1108
|
-
const INJECTION_RE_TEMPLATE = /\b_ctx\.\$route\b/g;
|
|
1109
|
-
const INJECTION_RE_SCRIPT = /\bthis\.\$route\b/g;
|
|
1110
1107
|
const INJECTION_SINGLE_RE = /\bthis\.\$route\b|\b_ctx\.\$route\b/;
|
|
1111
1108
|
const RouteInjectionPlugin = (nuxt) => createUnplugin(() => {
|
|
1112
1109
|
return {
|
|
@@ -1117,29 +1114,30 @@ const RouteInjectionPlugin = (nuxt) => createUnplugin(() => {
|
|
|
1117
1114
|
},
|
|
1118
1115
|
transform: {
|
|
1119
1116
|
filter: {
|
|
1120
|
-
code: {
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1117
|
+
code: {
|
|
1118
|
+
include: INJECTION_SINGLE_RE,
|
|
1119
|
+
exclude: [
|
|
1120
|
+
`_ctx._.provides[__nuxt_route_symbol`,
|
|
1121
|
+
"this._.provides[__nuxt_route_symbol"
|
|
1122
|
+
]
|
|
1125
1123
|
}
|
|
1126
|
-
|
|
1124
|
+
},
|
|
1125
|
+
handler(code, id) {
|
|
1127
1126
|
const s = new MagicString(code);
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
const start = match.index;
|
|
1132
|
-
const end = start + match[0].length;
|
|
1133
|
-
s.overwrite(start, end, replacement);
|
|
1134
|
-
replaced ||= true;
|
|
1127
|
+
parseAndWalk(code, id, (node) => {
|
|
1128
|
+
if (node.type !== "MemberExpression") {
|
|
1129
|
+
return;
|
|
1135
1130
|
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1131
|
+
if (node.object.type === "ThisExpression" && node.property.type === "Identifier" && node.property.name === "$route") {
|
|
1132
|
+
s.overwrite(node.start, node.end, "(this._.provides[__nuxt_route_symbol] || this.$route)");
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
if (node.object.type === "Identifier" && node.object.name === "_ctx" && node.property.type === "Identifier" && node.property.name === "$route") {
|
|
1136
|
+
s.overwrite(node.start, node.end, "(_ctx._.provides[__nuxt_route_symbol] || _ctx.$route)");
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
1142
1139
|
if (s.hasChanged()) {
|
|
1140
|
+
s.prepend("import { PageRouteSymbol as __nuxt_route_symbol } from '#app/components/injections';\n");
|
|
1143
1141
|
return {
|
|
1144
1142
|
code: s.toString(),
|
|
1145
1143
|
map: nuxt.options.sourcemap.client || nuxt.options.sourcemap.server ? s.generateMap({ hires: true }) : void 0
|
|
@@ -3757,7 +3755,7 @@ function addDeclarationTemplates(ctx, options) {
|
|
|
3757
3755
|
});
|
|
3758
3756
|
}
|
|
3759
3757
|
|
|
3760
|
-
const version = "4.1.1-
|
|
3758
|
+
const version = "4.1.1-29282072.39113ab4";
|
|
3761
3759
|
|
|
3762
3760
|
const createImportProtectionPatterns = (nuxt, options) => {
|
|
3763
3761
|
const patterns = [];
|
|
@@ -3830,10 +3828,10 @@ const UnctxTransformPlugin = (options) => createUnplugin(() => {
|
|
|
3830
3828
|
});
|
|
3831
3829
|
|
|
3832
3830
|
const TreeShakeComposablesPlugin = (options) => createUnplugin(() => {
|
|
3833
|
-
const
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3831
|
+
const allComposableNames = new Set(Object.values(options.composables).flat());
|
|
3832
|
+
if (!allComposableNames.size) {
|
|
3833
|
+
return [];
|
|
3834
|
+
}
|
|
3837
3835
|
return {
|
|
3838
3836
|
name: "nuxt:tree-shake-composables:transform",
|
|
3839
3837
|
enforce: "post",
|
|
@@ -3842,14 +3840,44 @@ const TreeShakeComposablesPlugin = (options) => createUnplugin(() => {
|
|
|
3842
3840
|
},
|
|
3843
3841
|
transform: {
|
|
3844
3842
|
filter: {
|
|
3845
|
-
code: { include:
|
|
3843
|
+
code: { include: new RegExp(`\\b(?:${[...allComposableNames].map((r) => escapeRE(r)).join("|")})\\b`) }
|
|
3846
3844
|
},
|
|
3847
|
-
handler(code) {
|
|
3845
|
+
handler(code, id) {
|
|
3848
3846
|
const s = new MagicString(code);
|
|
3849
|
-
const
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
}
|
|
3847
|
+
const scopeTracker = new ScopeTracker({ preserveExitedScopes: true });
|
|
3848
|
+
const parseResult = parseAndWalk(code, id, {
|
|
3849
|
+
scopeTracker
|
|
3850
|
+
});
|
|
3851
|
+
scopeTracker.freeze();
|
|
3852
|
+
walk(parseResult.program, {
|
|
3853
|
+
scopeTracker,
|
|
3854
|
+
enter(node) {
|
|
3855
|
+
if (node.type !== "CallExpression" || node.callee.type !== "Identifier") {
|
|
3856
|
+
return;
|
|
3857
|
+
}
|
|
3858
|
+
const functionName = node.callee.name;
|
|
3859
|
+
const scopeTrackerNode = scopeTracker.getDeclaration(functionName);
|
|
3860
|
+
if (scopeTrackerNode) {
|
|
3861
|
+
if (scopeTrackerNode.type !== "Import") {
|
|
3862
|
+
return;
|
|
3863
|
+
}
|
|
3864
|
+
if (scopeTrackerNode.importNode.type !== "ImportDeclaration") {
|
|
3865
|
+
return;
|
|
3866
|
+
}
|
|
3867
|
+
const importPath = scopeTrackerNode.importNode.source.value;
|
|
3868
|
+
const importSpecifier = scopeTrackerNode.node;
|
|
3869
|
+
const importedName = importSpecifier.type === "ImportSpecifier" && importSpecifier.imported.type === "Identifier" ? importSpecifier.imported.name : importSpecifier.local.name;
|
|
3870
|
+
const isFromAllowedPath = importPath === "#imports" ? allComposableNames.has(importedName) : options.composables[importPath]?.includes(importedName);
|
|
3871
|
+
if (!isFromAllowedPath) {
|
|
3872
|
+
return;
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
if (!scopeTrackerNode && !allComposableNames.has(functionName)) {
|
|
3876
|
+
return;
|
|
3877
|
+
}
|
|
3878
|
+
s.overwrite(node.start, node.end, ` false && /*@__PURE__*/ ${functionName}${code.slice(node.callee.end, node.end)}`);
|
|
3879
|
+
}
|
|
3880
|
+
});
|
|
3853
3881
|
if (s.hasChanged()) {
|
|
3854
3882
|
return {
|
|
3855
3883
|
code: s.toString(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-nightly",
|
|
3
|
-
"version": "4.1.1-
|
|
3
|
+
"version": "4.1.1-29282072.39113ab4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"@nuxt/cli": "npm:@nuxt/cli-nightly@latest",
|
|
68
68
|
"@nuxt/devalue": "^2.0.2",
|
|
69
69
|
"@nuxt/devtools": "^2.6.3",
|
|
70
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.1-
|
|
71
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.1-
|
|
70
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.1-29282072.39113ab4",
|
|
71
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.1-29282072.39113ab4",
|
|
72
72
|
"@nuxt/telemetry": "^2.6.6",
|
|
73
|
-
"@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.1-
|
|
73
|
+
"@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.1-29282072.39113ab4",
|
|
74
74
|
"@unhead/vue": "^2.0.14",
|
|
75
75
|
"@vue/shared": "^3.5.20",
|
|
76
76
|
"c12": "^3.2.0",
|
|
@@ -113,7 +113,6 @@
|
|
|
113
113
|
"scule": "^1.3.0",
|
|
114
114
|
"semver": "^7.7.2",
|
|
115
115
|
"std-env": "^3.9.0",
|
|
116
|
-
"strip-literal": "^3.0.0",
|
|
117
116
|
"tinyglobby": "0.2.14",
|
|
118
117
|
"ufo": "^1.6.1",
|
|
119
118
|
"ultrahtml": "^1.6.0",
|