@nuxt/vite-builder-nightly 4.3.0-29437273.f9c092c5 → 4.3.0-29439165.ec1da219
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/index.mjs +136 -2
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { performance } from 'node:perf_hooks';
|
|
|
3
3
|
import * as vite from 'vite';
|
|
4
4
|
import { isCSSRequest, createLogger, mergeConfig, createBuilder, createServer } from 'vite';
|
|
5
5
|
import { normalize, join, relative, dirname, basename, resolve, isAbsolute } from 'pathe';
|
|
6
|
-
import { tryUseNuxt, useNitro, logger, useNuxt, resolvePath, getLayerDirectories, createIsIgnored } from '@nuxt/kit';
|
|
7
|
-
import { findStaticImports, sanitizeFilePath } from 'mlly';
|
|
6
|
+
import { tryUseNuxt, useNitro, logger, useNuxt, resolvePath, getLayerDirectories, resolveAlias, directoryToURL, tryImportModule, createIsIgnored } from '@nuxt/kit';
|
|
7
|
+
import { findStaticImports, parseNodeModulePath, sanitizeFilePath } from 'mlly';
|
|
8
8
|
import viteJsxPlugin from '@vitejs/plugin-vue-jsx';
|
|
9
9
|
import vuePlugin from '@vitejs/plugin-vue';
|
|
10
10
|
import { parseURL, parseQuery, joinURL, getQuery, withLeadingSlash, withTrailingSlash, withoutLeadingSlash, withoutBase } from 'ufo';
|
|
@@ -33,6 +33,7 @@ import { createJiti } from 'jiti';
|
|
|
33
33
|
import { genImport, genArrayFromRaw, genObjectFromRawEntries } from 'knitwork';
|
|
34
34
|
import replacePlugin from '@rollup/plugin-replace';
|
|
35
35
|
import { defineEnv } from 'unenv';
|
|
36
|
+
import { runtimeDependencies } from 'nuxt/meta';
|
|
36
37
|
|
|
37
38
|
function isVue(id, opts = {}) {
|
|
38
39
|
const { search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
|
|
@@ -2101,6 +2102,136 @@ function ClientManifestPlugin(nuxt) {
|
|
|
2101
2102
|
};
|
|
2102
2103
|
}
|
|
2103
2104
|
|
|
2105
|
+
const VIRTUAL_RE = /^\0?virtual:(?:nuxt:)?/;
|
|
2106
|
+
function ResolveDeepImportsPlugin(nuxt) {
|
|
2107
|
+
const exclude = ["virtual:", "\0virtual:", "/__skip_vite", "@vitest/"];
|
|
2108
|
+
const conditions = {};
|
|
2109
|
+
function resolveConditions(environment) {
|
|
2110
|
+
const resolvedConditions = /* @__PURE__ */ new Set([nuxt.options.dev ? "development" : "production", ...environment.config.resolve.conditions]);
|
|
2111
|
+
if (resolvedConditions.has("browser")) {
|
|
2112
|
+
resolvedConditions.add("web");
|
|
2113
|
+
resolvedConditions.add("import");
|
|
2114
|
+
resolvedConditions.add("module");
|
|
2115
|
+
resolvedConditions.add("default");
|
|
2116
|
+
}
|
|
2117
|
+
if (environment.config.mode === "test") {
|
|
2118
|
+
resolvedConditions.add("import");
|
|
2119
|
+
resolvedConditions.add("require");
|
|
2120
|
+
}
|
|
2121
|
+
return [...resolvedConditions];
|
|
2122
|
+
}
|
|
2123
|
+
return {
|
|
2124
|
+
name: "nuxt:resolve-bare-imports",
|
|
2125
|
+
enforce: "post",
|
|
2126
|
+
resolveId: {
|
|
2127
|
+
filter: {
|
|
2128
|
+
id: {
|
|
2129
|
+
exclude: [
|
|
2130
|
+
// absolute path
|
|
2131
|
+
/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,
|
|
2132
|
+
...exclude.map((e) => new RegExp("^" + escapeStringRegexp(e)))
|
|
2133
|
+
]
|
|
2134
|
+
}
|
|
2135
|
+
},
|
|
2136
|
+
async handler(id, importer) {
|
|
2137
|
+
if (!importer || !isAbsolute(importer) && !VIRTUAL_RE.test(importer)) {
|
|
2138
|
+
return;
|
|
2139
|
+
}
|
|
2140
|
+
const normalisedId = resolveAlias(normalize(id), nuxt.options.alias);
|
|
2141
|
+
const isNuxtTemplate = importer.startsWith("virtual:nuxt");
|
|
2142
|
+
const normalisedImporter = (isNuxtTemplate ? decodeURIComponent(importer) : importer).replace(VIRTUAL_RE, "");
|
|
2143
|
+
if (nuxt.options.experimental.templateImportResolution !== false && isNuxtTemplate) {
|
|
2144
|
+
const template = nuxt.options.build.templates.find((t) => resolve(nuxt.options.buildDir, t.filename) === normalisedImporter);
|
|
2145
|
+
if (template?._path) {
|
|
2146
|
+
const res2 = await this.resolve?.(normalisedId, template._path, { skipSelf: true });
|
|
2147
|
+
if (res2 !== void 0 && res2 !== null) {
|
|
2148
|
+
return res2;
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
const dir = parseNodeModulePath(normalisedImporter).dir || nuxt.options.appDir;
|
|
2153
|
+
const res = await this.resolve?.(normalisedId, dir, { skipSelf: true });
|
|
2154
|
+
if (res !== void 0 && res !== null) {
|
|
2155
|
+
return res;
|
|
2156
|
+
}
|
|
2157
|
+
const environmentConditions = conditions[this.environment.name] ||= resolveConditions(this.environment);
|
|
2158
|
+
const path = resolveModulePath(id, {
|
|
2159
|
+
from: [dir, ...nuxt.options.modulesDir].map((d) => directoryToURL(d)),
|
|
2160
|
+
suffixes: ["", "index"],
|
|
2161
|
+
conditions: environmentConditions,
|
|
2162
|
+
try: true
|
|
2163
|
+
});
|
|
2164
|
+
if (!path) {
|
|
2165
|
+
logger.debug("Could not resolve id", id, importer);
|
|
2166
|
+
return null;
|
|
2167
|
+
}
|
|
2168
|
+
return normalize(path);
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
function ResolveExternalsPlugin(nuxt) {
|
|
2175
|
+
let external = /* @__PURE__ */ new Set();
|
|
2176
|
+
const nitro = useNitro();
|
|
2177
|
+
return {
|
|
2178
|
+
name: "nuxt:resolve-externals",
|
|
2179
|
+
enforce: "pre",
|
|
2180
|
+
async config() {
|
|
2181
|
+
const { runtimeDependencies: runtimeNitroDependencies = [] } = await tryImportModule("nitropack/runtime/meta", {
|
|
2182
|
+
url: new URL(import.meta.url)
|
|
2183
|
+
}) || {};
|
|
2184
|
+
external = /* @__PURE__ */ new Set([
|
|
2185
|
+
// explicit dependencies we use in our ssr renderer - these can be inlined (if necessary) in the nitro build
|
|
2186
|
+
"unhead",
|
|
2187
|
+
"@unhead/vue",
|
|
2188
|
+
"@nuxt/devalue",
|
|
2189
|
+
"rou3",
|
|
2190
|
+
"unstorage",
|
|
2191
|
+
// ensure we only have one version of vue if nitro is going to inline anyway
|
|
2192
|
+
...nitro.options.inlineDynamicImports ? ["vue", "@vue/server-renderer"] : [],
|
|
2193
|
+
...runtimeDependencies,
|
|
2194
|
+
// dependencies we might share with nitro - these can be inlined (if necessary) in the nitro build
|
|
2195
|
+
...runtimeNitroDependencies
|
|
2196
|
+
]);
|
|
2197
|
+
return {
|
|
2198
|
+
optimizeDeps: {
|
|
2199
|
+
exclude: Array.from(external)
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
},
|
|
2203
|
+
applyToEnvironment(environment) {
|
|
2204
|
+
if (nuxt.options.dev || environment.name !== "ssr") {
|
|
2205
|
+
return false;
|
|
2206
|
+
}
|
|
2207
|
+
return {
|
|
2208
|
+
name: "nuxt:resolve-externals:external",
|
|
2209
|
+
resolveId: {
|
|
2210
|
+
filter: {
|
|
2211
|
+
id: [...external].map((dep) => new RegExp("^" + escapeStringRegexp(dep) + "$"))
|
|
2212
|
+
},
|
|
2213
|
+
async handler(id, importer) {
|
|
2214
|
+
const res = await this.resolve?.(id, importer, { skipSelf: true });
|
|
2215
|
+
if (res !== void 0 && res !== null) {
|
|
2216
|
+
if (res.id === id) {
|
|
2217
|
+
res.id = resolveModulePath(res.id, {
|
|
2218
|
+
try: true,
|
|
2219
|
+
from: importer,
|
|
2220
|
+
extensions: nuxt.options.extensions
|
|
2221
|
+
}) || res.id;
|
|
2222
|
+
}
|
|
2223
|
+
return {
|
|
2224
|
+
...res,
|
|
2225
|
+
external: "absolute"
|
|
2226
|
+
};
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
};
|
|
2231
|
+
}
|
|
2232
|
+
};
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2104
2235
|
const bundle = async (nuxt) => {
|
|
2105
2236
|
const useAsyncEntry = nuxt.options.experimental.asyncEntry || nuxt.options.dev;
|
|
2106
2237
|
const entry = await resolvePath(resolve(nuxt.options.appDir, useAsyncEntry ? "entry.async" : "entry"));
|
|
@@ -2228,6 +2359,9 @@ const bundle = async (nuxt) => {
|
|
|
2228
2359
|
}
|
|
2229
2360
|
},
|
|
2230
2361
|
plugins: [
|
|
2362
|
+
// add resolver for modules used in virtual files
|
|
2363
|
+
ResolveDeepImportsPlugin(nuxt),
|
|
2364
|
+
ResolveExternalsPlugin(nuxt),
|
|
2231
2365
|
...nuxt.options.experimental.viteEnvironmentApi ? [
|
|
2232
2366
|
vuePlugin(viteConfig.vue),
|
|
2233
2367
|
viteJsxPlugin(viteConfig.vueJsx),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/vite-builder-nightly",
|
|
3
|
-
"version": "4.3.0-
|
|
3
|
+
"version": "4.3.0-29439165.ec1da219",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-
|
|
28
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29439165.ec1da219",
|
|
29
29
|
"nitropack": "2.12.9",
|
|
30
30
|
"rolldown": "1.0.0-beta.54",
|
|
31
31
|
"rollup": "4.53.4",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"vue": "3.5.25"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-
|
|
36
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-29439165.ec1da219",
|
|
37
37
|
"@rollup/plugin-replace": "^6.0.3",
|
|
38
38
|
"@vitejs/plugin-vue": "^6.0.3",
|
|
39
39
|
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"vue-bundle-renderer": "^2.2.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"nuxt": "npm:nuxt-nightly@4.3.0-
|
|
68
|
+
"nuxt": "npm:nuxt-nightly@4.3.0-29439165.ec1da219",
|
|
69
69
|
"rolldown": "^1.0.0-beta.38",
|
|
70
70
|
"vue": "^3.3.4"
|
|
71
71
|
},
|