@forsakringskassan/vite-lib-config 4.6.3 → 4.6.4
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/vite.config.cjs +19 -7
- package/dist/vite.config.mjs +19 -7
- package/package.json +1 -1
package/dist/vite.config.cjs
CHANGED
|
@@ -4658,7 +4658,7 @@ var import_node_path = __toESM(require("node:path"), 1);
|
|
|
4658
4658
|
var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
4659
4659
|
var import_node_tty = require("node:tty");
|
|
4660
4660
|
var import_node_util = require("node:util");
|
|
4661
|
-
var version = "6.0.
|
|
4661
|
+
var version = "6.0.6";
|
|
4662
4662
|
function resolveCompiler(root) {
|
|
4663
4663
|
const compiler = tryResolveCompiler(root) || tryResolveCompiler();
|
|
4664
4664
|
if (!compiler) throw new Error("Failed to resolve vue/compiler-sfc.\n@vitejs/plugin-vue requires vue (>=3.2.25) to be present in the dependency tree.");
|
|
@@ -4778,6 +4778,8 @@ function createRollupError(id, error) {
|
|
|
4778
4778
|
async function transformTemplateAsModule(code, filename, descriptor, options, pluginContext, ssr, customElement) {
|
|
4779
4779
|
const result = compile(code, filename, descriptor, options, pluginContext, ssr, customElement);
|
|
4780
4780
|
let returnCode = result.code;
|
|
4781
|
+
returnCode += `
|
|
4782
|
+
export const multiRoot = ${JSON.stringify(result.multiRoot)}`;
|
|
4781
4783
|
if (options.devServer && options.devServer.config.server.hmr !== false && !ssr && !options.isProduction) returnCode += `
|
|
4782
4784
|
import.meta.hot.accept(({ render }) => {
|
|
4783
4785
|
__VUE_HMR_RUNTIME__.rerender(${JSON.stringify(descriptor.id)}, render)
|
|
@@ -5902,11 +5904,14 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|
|
5902
5904
|
}
|
|
5903
5905
|
const attachedProps = [];
|
|
5904
5906
|
const hasScoped = descriptor.styles.some((s) => s.scoped);
|
|
5907
|
+
const isTemplateOnlyVapor = !descriptor.script && !descriptor.scriptSetup && descriptor.vapor;
|
|
5905
5908
|
const { code: scriptCode, map: scriptMap } = await genScriptCode(descriptor, options, pluginContext, ssr, customElement);
|
|
5906
5909
|
const hasTemplateImport = descriptor.template && !isUseInlineTemplate(descriptor, options);
|
|
5910
|
+
const isTemplateInlined = !!descriptor.template && (!descriptor.template.lang || descriptor.template.lang === "html") && !descriptor.template.src;
|
|
5907
5911
|
let templateCode = "";
|
|
5908
5912
|
let templateMap = void 0;
|
|
5909
|
-
|
|
5913
|
+
let templateMultiRoot;
|
|
5914
|
+
if (hasTemplateImport) ({ code: templateCode, map: templateMap, multiRoot: templateMultiRoot } = await genTemplateCode(descriptor, options, pluginContext, ssr, customElement));
|
|
5910
5915
|
if (hasTemplateImport) attachedProps.push(ssr ? ["ssrRender", "_sfc_ssrRender"] : ["render", "_sfc_render"]);
|
|
5911
5916
|
else if (prevDescriptor && !isEqualBlock(descriptor.template, prevDescriptor.template)) attachedProps.push([ssr ? "ssrRender" : "render", "() => {}"]);
|
|
5912
5917
|
const stylesCode = await genStyleCode(descriptor, pluginContext, customElement, attachedProps);
|
|
@@ -5914,6 +5919,7 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|
|
5914
5919
|
const output = [
|
|
5915
5920
|
scriptCode,
|
|
5916
5921
|
templateCode,
|
|
5922
|
+
isTemplateOnlyVapor ? `${scriptIdentifier}.__multiRoot = ${isTemplateInlined ? templateMultiRoot : "_sfc_multiRoot"}` : "",
|
|
5917
5923
|
stylesCode,
|
|
5918
5924
|
customBlocksCode
|
|
5919
5925
|
];
|
|
@@ -5995,15 +6001,21 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|
|
5995
6001
|
async function genTemplateCode(descriptor, options, pluginContext, ssr, customElement) {
|
|
5996
6002
|
const template = descriptor.template;
|
|
5997
6003
|
const hasScoped = descriptor.styles.some((style) => style.scoped);
|
|
5998
|
-
|
|
5999
|
-
|
|
6004
|
+
const needsMultiRoot = !descriptor.script && !descriptor.scriptSetup && descriptor.vapor;
|
|
6005
|
+
if ((!template.lang || template.lang === "html") && !template.src) {
|
|
6006
|
+
const result = transformTemplateInMain(template.content, descriptor, options, pluginContext, ssr, customElement);
|
|
6007
|
+
return {
|
|
6008
|
+
...result,
|
|
6009
|
+
multiRoot: needsMultiRoot ? result.multiRoot : void 0
|
|
6010
|
+
};
|
|
6011
|
+
} else {
|
|
6000
6012
|
if (template.src) await linkSrcToDescriptor(template.src, descriptor, pluginContext, hasScoped);
|
|
6001
6013
|
const src = template.src || descriptor.filename;
|
|
6002
6014
|
const query = `?vue&type=template${template.src ? hasScoped ? `&src=${descriptor.id}` : "&src=true" : ""}${hasScoped ? `&scoped=${descriptor.id}` : ``}${attrsToQuery(template.attrs, "js", true)}`;
|
|
6003
6015
|
const request = JSON.stringify(src + query);
|
|
6004
6016
|
const renderFnName = ssr ? "ssrRender" : "render";
|
|
6005
6017
|
return {
|
|
6006
|
-
code: `import { ${renderFnName} as _sfc_${renderFnName} } from ${request}`,
|
|
6018
|
+
code: `import { ${renderFnName} as _sfc_${renderFnName}${needsMultiRoot ? ", multiRoot as _sfc_multiRoot" : ""} } from ${request}`,
|
|
6007
6019
|
map: void 0
|
|
6008
6020
|
};
|
|
6009
6021
|
}
|
|
@@ -6264,14 +6276,14 @@ function vuePlugin(rawOptions = {}) {
|
|
|
6264
6276
|
resolveId: {
|
|
6265
6277
|
filter: { id: [exactRegex(EXPORT_HELPER_ID), /[?&]vue\b/] },
|
|
6266
6278
|
handler(id) {
|
|
6267
|
-
if (id ===
|
|
6279
|
+
if (id === "\0plugin-vue:export-helper") return id;
|
|
6268
6280
|
if (parseVueRequest(id).query.vue) return id;
|
|
6269
6281
|
}
|
|
6270
6282
|
},
|
|
6271
6283
|
load: {
|
|
6272
6284
|
filter: { id: [exactRegex(EXPORT_HELPER_ID), /[?&]vue\b/] },
|
|
6273
6285
|
handler(id, opt) {
|
|
6274
|
-
if (id ===
|
|
6286
|
+
if (id === "\0plugin-vue:export-helper") return helperCode;
|
|
6275
6287
|
const ssr = opt?.ssr === true;
|
|
6276
6288
|
const { filename, query } = parseVueRequest(id);
|
|
6277
6289
|
if (query.vue) {
|
package/dist/vite.config.mjs
CHANGED
|
@@ -4648,7 +4648,7 @@ import path from "node:path";
|
|
|
4648
4648
|
import crypto from "node:crypto";
|
|
4649
4649
|
import { isatty } from "node:tty";
|
|
4650
4650
|
import { formatWithOptions, inspect } from "node:util";
|
|
4651
|
-
var version = "6.0.
|
|
4651
|
+
var version = "6.0.6";
|
|
4652
4652
|
function resolveCompiler(root) {
|
|
4653
4653
|
const compiler = tryResolveCompiler(root) || tryResolveCompiler();
|
|
4654
4654
|
if (!compiler) throw new Error("Failed to resolve vue/compiler-sfc.\n@vitejs/plugin-vue requires vue (>=3.2.25) to be present in the dependency tree.");
|
|
@@ -4768,6 +4768,8 @@ function createRollupError(id, error) {
|
|
|
4768
4768
|
async function transformTemplateAsModule(code, filename, descriptor, options, pluginContext, ssr, customElement) {
|
|
4769
4769
|
const result = compile(code, filename, descriptor, options, pluginContext, ssr, customElement);
|
|
4770
4770
|
let returnCode = result.code;
|
|
4771
|
+
returnCode += `
|
|
4772
|
+
export const multiRoot = ${JSON.stringify(result.multiRoot)}`;
|
|
4771
4773
|
if (options.devServer && options.devServer.config.server.hmr !== false && !ssr && !options.isProduction) returnCode += `
|
|
4772
4774
|
import.meta.hot.accept(({ render }) => {
|
|
4773
4775
|
__VUE_HMR_RUNTIME__.rerender(${JSON.stringify(descriptor.id)}, render)
|
|
@@ -5892,11 +5894,14 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|
|
5892
5894
|
}
|
|
5893
5895
|
const attachedProps = [];
|
|
5894
5896
|
const hasScoped = descriptor.styles.some((s) => s.scoped);
|
|
5897
|
+
const isTemplateOnlyVapor = !descriptor.script && !descriptor.scriptSetup && descriptor.vapor;
|
|
5895
5898
|
const { code: scriptCode, map: scriptMap } = await genScriptCode(descriptor, options, pluginContext, ssr, customElement);
|
|
5896
5899
|
const hasTemplateImport = descriptor.template && !isUseInlineTemplate(descriptor, options);
|
|
5900
|
+
const isTemplateInlined = !!descriptor.template && (!descriptor.template.lang || descriptor.template.lang === "html") && !descriptor.template.src;
|
|
5897
5901
|
let templateCode = "";
|
|
5898
5902
|
let templateMap = void 0;
|
|
5899
|
-
|
|
5903
|
+
let templateMultiRoot;
|
|
5904
|
+
if (hasTemplateImport) ({ code: templateCode, map: templateMap, multiRoot: templateMultiRoot } = await genTemplateCode(descriptor, options, pluginContext, ssr, customElement));
|
|
5900
5905
|
if (hasTemplateImport) attachedProps.push(ssr ? ["ssrRender", "_sfc_ssrRender"] : ["render", "_sfc_render"]);
|
|
5901
5906
|
else if (prevDescriptor && !isEqualBlock(descriptor.template, prevDescriptor.template)) attachedProps.push([ssr ? "ssrRender" : "render", "() => {}"]);
|
|
5902
5907
|
const stylesCode = await genStyleCode(descriptor, pluginContext, customElement, attachedProps);
|
|
@@ -5904,6 +5909,7 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|
|
5904
5909
|
const output = [
|
|
5905
5910
|
scriptCode,
|
|
5906
5911
|
templateCode,
|
|
5912
|
+
isTemplateOnlyVapor ? `${scriptIdentifier}.__multiRoot = ${isTemplateInlined ? templateMultiRoot : "_sfc_multiRoot"}` : "",
|
|
5907
5913
|
stylesCode,
|
|
5908
5914
|
customBlocksCode
|
|
5909
5915
|
];
|
|
@@ -5985,15 +5991,21 @@ async function transformMain(code, filename, options, pluginContext, ssr, custom
|
|
|
5985
5991
|
async function genTemplateCode(descriptor, options, pluginContext, ssr, customElement) {
|
|
5986
5992
|
const template = descriptor.template;
|
|
5987
5993
|
const hasScoped = descriptor.styles.some((style) => style.scoped);
|
|
5988
|
-
|
|
5989
|
-
|
|
5994
|
+
const needsMultiRoot = !descriptor.script && !descriptor.scriptSetup && descriptor.vapor;
|
|
5995
|
+
if ((!template.lang || template.lang === "html") && !template.src) {
|
|
5996
|
+
const result = transformTemplateInMain(template.content, descriptor, options, pluginContext, ssr, customElement);
|
|
5997
|
+
return {
|
|
5998
|
+
...result,
|
|
5999
|
+
multiRoot: needsMultiRoot ? result.multiRoot : void 0
|
|
6000
|
+
};
|
|
6001
|
+
} else {
|
|
5990
6002
|
if (template.src) await linkSrcToDescriptor(template.src, descriptor, pluginContext, hasScoped);
|
|
5991
6003
|
const src = template.src || descriptor.filename;
|
|
5992
6004
|
const query = `?vue&type=template${template.src ? hasScoped ? `&src=${descriptor.id}` : "&src=true" : ""}${hasScoped ? `&scoped=${descriptor.id}` : ``}${attrsToQuery(template.attrs, "js", true)}`;
|
|
5993
6005
|
const request = JSON.stringify(src + query);
|
|
5994
6006
|
const renderFnName = ssr ? "ssrRender" : "render";
|
|
5995
6007
|
return {
|
|
5996
|
-
code: `import { ${renderFnName} as _sfc_${renderFnName} } from ${request}`,
|
|
6008
|
+
code: `import { ${renderFnName} as _sfc_${renderFnName}${needsMultiRoot ? ", multiRoot as _sfc_multiRoot" : ""} } from ${request}`,
|
|
5997
6009
|
map: void 0
|
|
5998
6010
|
};
|
|
5999
6011
|
}
|
|
@@ -6254,14 +6266,14 @@ function vuePlugin(rawOptions = {}) {
|
|
|
6254
6266
|
resolveId: {
|
|
6255
6267
|
filter: { id: [exactRegex(EXPORT_HELPER_ID), /[?&]vue\b/] },
|
|
6256
6268
|
handler(id) {
|
|
6257
|
-
if (id ===
|
|
6269
|
+
if (id === "\0plugin-vue:export-helper") return id;
|
|
6258
6270
|
if (parseVueRequest(id).query.vue) return id;
|
|
6259
6271
|
}
|
|
6260
6272
|
},
|
|
6261
6273
|
load: {
|
|
6262
6274
|
filter: { id: [exactRegex(EXPORT_HELPER_ID), /[?&]vue\b/] },
|
|
6263
6275
|
handler(id, opt) {
|
|
6264
|
-
if (id ===
|
|
6276
|
+
if (id === "\0plugin-vue:export-helper") return helperCode;
|
|
6265
6277
|
const ssr = opt?.ssr === true;
|
|
6266
6278
|
const { filename, query } = parseVueRequest(id);
|
|
6267
6279
|
if (query.vue) {
|