@vue/compiler-sfc 3.6.0-alpha.3 → 3.6.0-alpha.5

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,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.6.0-alpha.3
2
+ * @vue/compiler-sfc v3.6.0-alpha.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -126,6 +126,9 @@ var hashSumExports = /*@__PURE__*/ requireHashSum();
126
126
  var hash = /*@__PURE__*/getDefaultExportFromCjs(hashSumExports);
127
127
 
128
128
  const CSS_VARS_HELPER = `useCssVars`;
129
+ function getCssVarsHelper(vapor) {
130
+ return vapor ? `useVaporCssVars` : CSS_VARS_HELPER;
131
+ }
129
132
  function genCssVarsFromList(vars, id, isProd, isSSR = false) {
130
133
  return `{
131
134
  ${vars.map(
@@ -234,7 +237,7 @@ const cssVarsPlugin = (opts) => {
234
237
  };
235
238
  };
236
239
  cssVarsPlugin.postcss = true;
237
- function genCssVarsCode(vars, bindings, id, isProd) {
240
+ function genCssVarsCode(vars, bindings, id, isProd, vapor) {
238
241
  const varsExp = genCssVarsFromList(vars, id, isProd);
239
242
  const exp = CompilerDOM.createSimpleExpression(varsExp, false);
240
243
  const context = CompilerDOM.createTransformContext(CompilerDOM.createRoot([]), {
@@ -246,7 +249,7 @@ function genCssVarsCode(vars, bindings, id, isProd) {
246
249
  const transformedString = transformed.type === 4 ? transformed.content : transformed.children.map((c) => {
247
250
  return typeof c === "string" ? c : c.content;
248
251
  }).join("");
249
- return `_${CSS_VARS_HELPER}(_ctx => (${transformedString}))`;
252
+ return `_${getCssVarsHelper(vapor)}(_ctx => (${transformedString}))`;
250
253
  }
251
254
  function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd, defaultVar) {
252
255
  return `
@@ -2247,54 +2250,49 @@ const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
2247
2250
  return;
2248
2251
  }
2249
2252
  }
2250
- const compoundExpression = compilerCore.createCompoundExpression([], attr.loc);
2253
+ let content = "";
2251
2254
  imageCandidates.forEach(({ url, descriptor }, index2) => {
2252
2255
  if (shouldProcessUrl(url)) {
2253
2256
  const { path: path2 } = parseUrl(url);
2254
- let exp2;
2255
2257
  if (path2) {
2258
+ let exp2 = "";
2256
2259
  const existingImportsIndex = context.imports.findIndex(
2257
2260
  (i) => i.path === path2
2258
2261
  );
2259
2262
  if (existingImportsIndex > -1) {
2260
- exp2 = compilerCore.createSimpleExpression(
2261
- `_imports_${existingImportsIndex}`,
2262
- false,
2263
- attr.loc,
2264
- 3
2265
- );
2263
+ exp2 = `_imports_${existingImportsIndex}`;
2266
2264
  } else {
2267
- exp2 = compilerCore.createSimpleExpression(
2268
- `_imports_${context.imports.length}`,
2269
- false,
2270
- attr.loc,
2271
- 3
2272
- );
2273
- context.imports.push({ exp: exp2, path: path2 });
2265
+ exp2 = `_imports_${context.imports.length}`;
2266
+ context.imports.push({
2267
+ exp: compilerCore.createSimpleExpression(
2268
+ exp2,
2269
+ false,
2270
+ attr.loc,
2271
+ 3
2272
+ ),
2273
+ path: path2
2274
+ });
2274
2275
  }
2275
- compoundExpression.children.push(exp2);
2276
+ content += exp2;
2276
2277
  }
2277
2278
  } else {
2278
- const exp2 = compilerCore.createSimpleExpression(
2279
- `"${url}"`,
2280
- false,
2281
- attr.loc,
2282
- 3
2283
- );
2284
- compoundExpression.children.push(exp2);
2279
+ content += `"${url}"`;
2285
2280
  }
2286
2281
  const isNotLast = imageCandidates.length - 1 > index2;
2287
- if (descriptor && isNotLast) {
2288
- compoundExpression.children.push(` + ' ${descriptor}, ' + `);
2289
- } else if (descriptor) {
2290
- compoundExpression.children.push(` + ' ${descriptor}'`);
2282
+ if (descriptor) {
2283
+ content += ` + ' ${descriptor}${isNotLast ? ", " : ""}'${isNotLast ? " + " : ""}`;
2291
2284
  } else if (isNotLast) {
2292
- compoundExpression.children.push(` + ', ' + `);
2285
+ content += ` + ', ' + `;
2293
2286
  }
2294
2287
  });
2295
- let exp = compoundExpression;
2288
+ let exp = compilerCore.createSimpleExpression(
2289
+ content,
2290
+ false,
2291
+ attr.loc,
2292
+ 3
2293
+ );
2296
2294
  if (context.hoistStatic) {
2297
- exp = context.hoist(compoundExpression);
2295
+ exp = context.hoist(exp);
2298
2296
  exp.constType = 3;
2299
2297
  }
2300
2298
  node.props[index] = {
@@ -20234,9 +20232,7 @@ function genModelProps(ctx) {
20234
20232
  }
20235
20233
  modelPropsDecl += `
20236
20234
  ${JSON.stringify(name)}: ${decl},`;
20237
- const modifierPropName = JSON.stringify(
20238
- name === "modelValue" ? `modelModifiers` : `${name}Modifiers`
20239
- );
20235
+ const modifierPropName = JSON.stringify(shared.getModifierPropName(name));
20240
20236
  modelPropsDecl += `
20241
20237
  ${modifierPropName}: {},`;
20242
20238
  }
@@ -21339,7 +21335,7 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
21339
21335
  }
21340
21336
  if (sfc.cssVars.length && // no need to do this when targeting SSR
21341
21337
  !ssr) {
21342
- ctx.helperImports.add(CSS_VARS_HELPER);
21338
+ ctx.helperImports.add(getCssVarsHelper(vapor));
21343
21339
  ctx.helperImports.add("unref");
21344
21340
  ctx.s.prependLeft(
21345
21341
  startOffset,
@@ -21348,7 +21344,8 @@ ${genCssVarsCode(
21348
21344
  sfc.cssVars,
21349
21345
  ctx.bindingMetadata,
21350
21346
  scopeId,
21351
- !!options.isProd
21347
+ !!options.isProd,
21348
+ vapor
21352
21349
  )}
21353
21350
  `
21354
21351
  );
@@ -21759,7 +21756,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
21759
21756
  return generator.toJSON();
21760
21757
  }
21761
21758
 
21762
- const version = "3.6.0-alpha.3";
21759
+ const version = "3.6.0-alpha.5";
21763
21760
  const parseCache = parseCache$1;
21764
21761
  const errorMessages = {
21765
21762
  ...CompilerDOM.errorMessages,