@nuxt/kit-nightly 5.0.0-29757187.0628bc1a → 5.0.0-29757407.3ffd5236

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.
Files changed (2) hide show
  1. package/dist/index.mjs +23 -11
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -25,11 +25,10 @@ import { addDependency, addDependencyCommand, detectPackageManager } from "nypm"
25
25
  import { hasTTY, isCI, provider } from "std-env";
26
26
  import { applyDefaults } from "untyped";
27
27
  import { loadConfig, setupDotenv } from "c12";
28
- import { klona } from "klona/full";
28
+ import { klona } from "klona";
29
29
  import { diff } from "ohash/utils";
30
30
  import destr from "destr";
31
31
  import { kebabCase, pascalCase, snakeCase } from "scule";
32
- import { klona as klona$1 } from "klona";
33
32
  import { hash } from "ohash";
34
33
  import { isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$1 } from "node:path";
35
34
  import { stat } from "node:fs/promises";
@@ -1728,7 +1727,7 @@ function addServerScanDir(dirs, opts = {}) {
1728
1727
  */
1729
1728
  function useRuntimeConfig() {
1730
1729
  const nuxt = useNuxt();
1731
- return applyEnv(klona$1(nuxt.options.nitro.runtimeConfig), {
1730
+ return applyEnv(klona(nuxt.options.nitro.runtimeConfig), {
1732
1731
  prefix: "NITRO_",
1733
1732
  altPrefix: "NUXT_",
1734
1733
  envExpansion: nuxt.options.nitro.experimental?.envExpansion ?? !!process.env.NITRO_ENV_EXPANSION
@@ -1862,14 +1861,17 @@ function addVitePlugin(pluginOrGetter, options = {}) {
1862
1861
  return;
1863
1862
  }
1864
1863
  const environmentName = options.server === false ? "client" : "ssr";
1865
- const pluginName = plugin.map((p) => p.name).join("|");
1866
- config.plugins.push({
1867
- name: `${pluginName}:wrapper`,
1868
- enforce: isIsomorphic ? options?.prepend ? "pre" : void 0 : options?.prepend ? "pre" : "post",
1869
- applyToEnvironment(environment) {
1870
- if (isIsomorphic ? environment.name === "client" || environment.name === "ssr" : environment.name === environmentName) return resolveNestedPlugins(plugin, config, environment, nuxt);
1871
- }
1872
- });
1864
+ const defaultEnforce = isIsomorphic ? options?.prepend ? "pre" : void 0 : options?.prepend ? "pre" : "post";
1865
+ for (const [enforce, plugins] of groupByEnforce(plugin, defaultEnforce)) {
1866
+ const pluginName = plugins.map((p) => p.name).join("|");
1867
+ config.plugins.push({
1868
+ name: `${pluginName}:wrapper`,
1869
+ enforce,
1870
+ applyToEnvironment(environment) {
1871
+ if (isIsomorphic ? environment.name === "client" || environment.name === "ssr" : environment.name === environmentName) return resolveNestedPlugins(plugins, config, environment, nuxt);
1872
+ }
1873
+ });
1874
+ }
1873
1875
  });
1874
1876
  nuxt.hook("vite:extendConfig", async (config, env) => {
1875
1877
  if (!needsEnvInjection) return;
@@ -1879,6 +1881,16 @@ function addVitePlugin(pluginOrGetter, options = {}) {
1879
1881
  if (env.isServer && options.client === false) config.plugins[method](...plugin);
1880
1882
  });
1881
1883
  }
1884
+ function groupByEnforce(plugins, defaultEnforce) {
1885
+ const groups = /* @__PURE__ */ new Map();
1886
+ for (const plugin of plugins) {
1887
+ const enforce = plugin.enforce ?? defaultEnforce;
1888
+ const group = groups.get(enforce);
1889
+ if (group) group.push(plugin);
1890
+ else groups.set(enforce, [plugin]);
1891
+ }
1892
+ return groups;
1893
+ }
1882
1894
  /**
1883
1895
  * Vite only honours `apply` and `applyToEnvironment` for plugins it finds in the
1884
1896
  * top-level plugin array, so plugins nested behind a wrapper have to be resolved
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit-nightly",
3
- "version": "5.0.0-29757187.0628bc1a",
3
+ "version": "5.0.0-29757407.3ffd5236",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -44,7 +44,7 @@
44
44
  "verkit": "^0.3.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29757187.0628bc1a",
47
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29757407.3ffd5236",
48
48
  "chokidar": "^5.0.0",
49
49
  "hookable": "^6.1.1",
50
50
  "nitro": "^3.0.260610-beta",