@vue/compiler-sfc 3.1.3 → 3.1.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.
@@ -421,15 +421,9 @@ const defaultAssetUrlOptions = {
421
421
  const normalizeOptions = (options) => {
422
422
  if (Object.keys(options).some(key => shared.isArray(options[key]))) {
423
423
  // legacy option format which directly passes in tags config
424
- return {
425
- ...defaultAssetUrlOptions,
426
- tags: options
427
- };
424
+ return Object.assign(Object.assign({}, defaultAssetUrlOptions), { tags: options });
428
425
  }
429
- return {
430
- ...defaultAssetUrlOptions,
431
- ...options
432
- };
426
+ return Object.assign(Object.assign({}, defaultAssetUrlOptions), options);
433
427
  };
434
428
  const createAssetUrlTransformWithOptions = (options) => {
435
429
  return (node, context) => transformAssetUrl(node, context, options);
@@ -637,7 +631,7 @@ function preprocess({ source, filename, preprocessOptions }, preprocessor) {
637
631
  // have to be sync because they are applied via Node.js require hooks)
638
632
  let res = '';
639
633
  let err = null;
640
- preprocessor.render(source, { filename, ...preprocessOptions }, (_err, _res) => {
634
+ preprocessor.render(source, Object.assign({ filename }, preprocessOptions), (_err, _res) => {
641
635
  if (_err)
642
636
  err = _err;
643
637
  res = _res;
@@ -655,10 +649,7 @@ function compileTemplate(options) {
655
649
  : false;
656
650
  if (preprocessor) {
657
651
  try {
658
- return doCompileTemplate({
659
- ...options,
660
- source: preprocess(options, preprocessor)
661
- });
652
+ return doCompileTemplate(Object.assign(Object.assign({}, options), { source: preprocess(options, preprocessor) }));
662
653
  }
663
654
  catch (e) {
664
655
  return {
@@ -709,23 +700,9 @@ function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ssr =
709
700
  }
710
701
  const shortId = id.replace(/^data-v-/, '');
711
702
  const longId = `data-v-${shortId}`;
712
- let { code, ast, preamble, map } = compiler.compile(source, {
713
- mode: 'module',
714
- prefixIdentifiers: true,
715
- hoistStatic: true,
716
- cacheHandlers: true,
717
- ssrCssVars: ssr && ssrCssVars && ssrCssVars.length
703
+ let { code, ast, preamble, map } = compiler.compile(source, Object.assign(Object.assign({ mode: 'module', prefixIdentifiers: true, hoistStatic: true, cacheHandlers: true, ssrCssVars: ssr && ssrCssVars && ssrCssVars.length
718
704
  ? genCssVarsFromList(ssrCssVars, shortId, isProd)
719
- : '',
720
- scopeId: scoped ? longId : undefined,
721
- slotted,
722
- ...compilerOptions,
723
- nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []),
724
- filename,
725
- sourceMap: true,
726
- onError: e => errors.push(e),
727
- onWarn: w => warnings.push(w)
728
- });
705
+ : '', scopeId: scoped ? longId : undefined, slotted }, compilerOptions), { nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []), filename, sourceMap: true, onError: e => errors.push(e), onWarn: w => warnings.push(w) }));
729
706
  // inMap should be the map produced by ./parse.ts which is a simple line-only
730
707
  // mapping. If it is present, we need to adjust the final map and errors to
731
708
  // reflect the original line numbers.
@@ -1002,13 +979,7 @@ scopedPlugin.postcss = true;
1002
979
  // .scss/.sass processor
1003
980
  const scss = (source, map, options, load = require) => {
1004
981
  const nodeSass = load('sass');
1005
- const finalOptions = {
1006
- ...options,
1007
- data: getSource(source, options.filename, options.additionalData),
1008
- file: options.filename,
1009
- outFile: options.filename,
1010
- sourceMap: !!map
1011
- };
982
+ const finalOptions = Object.assign(Object.assign({}, options), { data: getSource(source, options.filename, options.additionalData), file: options.filename, outFile: options.filename, sourceMap: !!map });
1012
983
  try {
1013
984
  const result = nodeSass.renderSync(finalOptions);
1014
985
  const dependencies = result.stats.includedFiles;
@@ -1026,16 +997,13 @@ const scss = (source, map, options, load = require) => {
1026
997
  return { code: '', errors: [e], dependencies: [] };
1027
998
  }
1028
999
  };
1029
- const sass = (source, map, options, load) => scss(source, map, {
1030
- ...options,
1031
- indentedSyntax: true
1032
- }, load);
1000
+ const sass = (source, map, options, load) => scss(source, map, Object.assign(Object.assign({}, options), { indentedSyntax: true }), load);
1033
1001
  // .less
1034
1002
  const less = (source, map, options, load = require) => {
1035
1003
  const nodeLess = load('less');
1036
1004
  let result;
1037
1005
  let error = null;
1038
- nodeLess.render(getSource(source, options.filename, options.additionalData), { ...options, syncImport: true }, (err, output) => {
1006
+ nodeLess.render(getSource(source, options.filename, options.additionalData), Object.assign(Object.assign({}, options), { syncImport: true }), (err, output) => {
1039
1007
  error = err;
1040
1008
  result = output;
1041
1009
  });
@@ -1097,13 +1065,10 @@ const processors = {
1097
1065
  };
1098
1066
 
1099
1067
  function compileStyle(options) {
1100
- return doCompileStyle({
1101
- ...options,
1102
- isAsync: false
1103
- });
1068
+ return doCompileStyle(Object.assign(Object.assign({}, options), { isAsync: false }));
1104
1069
  }
1105
1070
  function compileStyleAsync(options) {
1106
- return doCompileStyle({ ...options, isAsync: true });
1071
+ return doCompileStyle(Object.assign(Object.assign({}, options), { isAsync: true }));
1107
1072
  }
1108
1073
  function doCompileStyle(options) {
1109
1074
  const { filename, id, scoped = false, trim = true, isProd = false, modules = false, modulesOptions = {}, preprocessLang, postcssOptions, postcssPlugins } = options;
@@ -1128,18 +1093,11 @@ function doCompileStyle(options) {
1128
1093
  if (!options.isAsync) {
1129
1094
  throw new Error('[@vue/compiler-sfc] `modules` option can only be used with compileStyleAsync().');
1130
1095
  }
1131
- plugins.push(require('postcss-modules')({
1132
- ...modulesOptions,
1133
- getJSON: (_cssFileName, json) => {
1096
+ plugins.push(require('postcss-modules')(Object.assign(Object.assign({}, modulesOptions), { getJSON: (_cssFileName, json) => {
1134
1097
  cssModules = json;
1135
- }
1136
- }));
1098
+ } })));
1137
1099
  }
1138
- const postCSSOptions = {
1139
- ...postcssOptions,
1140
- to: filename,
1141
- from: filename
1142
- };
1100
+ const postCSSOptions = Object.assign(Object.assign({}, postcssOptions), { to: filename, from: filename });
1143
1101
  if (map) {
1144
1102
  postCSSOptions.map = {
1145
1103
  inline: false,
@@ -1205,10 +1163,7 @@ function doCompileStyle(options) {
1205
1163
  };
1206
1164
  }
1207
1165
  function preprocess$1(options, preprocessor) {
1208
- return preprocessor(options.source, options.inMap || options.map, {
1209
- filename: options.filename,
1210
- ...options.preprocessOptions
1211
- }, options.preprocessCustomRequire);
1166
+ return preprocessor(options.source, options.inMap || options.map, Object.assign({ filename: options.filename }, options.preprocessOptions), options.preprocessCustomRequire);
1212
1167
  }
1213
1168
 
1214
1169
  const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/;
@@ -1290,7 +1245,7 @@ function compileScript(sfc, options) {
1290
1245
  type: 'script',
1291
1246
  content: '',
1292
1247
  attrs: {},
1293
- loc: null
1248
+ loc: compilerCore.locStub
1294
1249
  };
1295
1250
  }
1296
1251
  // for backwards compat
@@ -1344,12 +1299,9 @@ function compileScript(sfc, options) {
1344
1299
  }
1345
1300
  content += `\nexport default __default__`;
1346
1301
  }
1347
- return {
1348
- ...script,
1349
- content,
1302
+ return Object.assign(Object.assign({}, script), { content,
1350
1303
  bindings,
1351
- scriptAst
1352
- };
1304
+ scriptAst });
1353
1305
  }
1354
1306
  catch (e) {
1355
1307
  // silently fallback if parse fails since user may be using custom
@@ -1973,12 +1925,9 @@ function compileScript(sfc, options) {
1973
1925
  if (propsRuntimeDefaults) {
1974
1926
  ranges.withDefaultsArg = toTextRange(propsRuntimeDefaults);
1975
1927
  }
1976
- return {
1977
- ...scriptSetup,
1978
- ranges,
1928
+ return Object.assign(Object.assign({}, scriptSetup), { ranges,
1979
1929
  scriptAst,
1980
- scriptSetupAst
1981
- };
1930
+ scriptSetupAst });
1982
1931
  }
1983
1932
  // 3. Do a full walk to rewrite identifiers referencing let exports with ref
1984
1933
  // value access
@@ -2099,23 +2048,9 @@ function compileScript(sfc, options) {
2099
2048
  }
2100
2049
  // inline render function mode - we are going to compile the template and
2101
2050
  // inline it right here
2102
- const { code, ast, preamble, tips, errors } = compileTemplate({
2103
- filename,
2104
- source: sfc.template.content,
2105
- inMap: sfc.template.map,
2106
- ...options.templateOptions,
2107
- id: scopeId,
2108
- scoped: sfc.styles.some(s => s.scoped),
2109
- isProd: options.isProd,
2110
- ssrCssVars: sfc.cssVars,
2111
- compilerOptions: {
2112
- ...(options.templateOptions &&
2113
- options.templateOptions.compilerOptions),
2114
- inline: true,
2115
- isTS,
2116
- bindingMetadata
2117
- }
2118
- });
2051
+ const { code, ast, preamble, tips, errors } = compileTemplate(Object.assign(Object.assign({ filename, source: sfc.template.content, inMap: sfc.template.map }, options.templateOptions), { id: scopeId, scoped: sfc.styles.some(s => s.scoped), isProd: options.isProd, ssrCssVars: sfc.cssVars, compilerOptions: Object.assign(Object.assign({}, (options.templateOptions &&
2052
+ options.templateOptions.compilerOptions)), { inline: true, isTS,
2053
+ bindingMetadata }) }));
2119
2054
  if (tips.length) {
2120
2055
  tips.forEach(warnOnce);
2121
2056
  }
@@ -2151,7 +2086,7 @@ function compileScript(sfc, options) {
2151
2086
  }
2152
2087
  else {
2153
2088
  // return bindings from setup
2154
- const allBindings = { ...setupBindings };
2089
+ const allBindings = Object.assign({}, setupBindings);
2155
2090
  for (const key in userImports) {
2156
2091
  if (!userImports[key].isType) {
2157
2092
  allBindings[key] = true;
@@ -2225,18 +2160,12 @@ function compileScript(sfc, options) {
2225
2160
  .join(', ')} } from 'vue'\n`);
2226
2161
  }
2227
2162
  s.trim();
2228
- return {
2229
- ...scriptSetup,
2230
- bindings: bindingMetadata,
2231
- content: s.toString(),
2232
- map: s.generateMap({
2163
+ return Object.assign(Object.assign({}, scriptSetup), { bindings: bindingMetadata, content: s.toString(), map: s.generateMap({
2233
2164
  source: filename,
2234
2165
  hires: true,
2235
2166
  includeContent: true
2236
- }),
2237
- scriptAst,
2238
- scriptSetupAst
2239
- };
2167
+ }), scriptAst,
2168
+ scriptSetupAst });
2240
2169
  }
2241
2170
  function registerBinding(bindings, node, type) {
2242
2171
  bindings[node.name] = {
@@ -5574,7 +5574,7 @@ var sourceMap = {
5574
5574
 
5575
5575
  const PURE_ANNOTATION = `/*#__PURE__*/`;
5576
5576
  const WITH_ID = `_withId`;
5577
- function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssr = false }) {
5577
+ function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssr = false, isTS = false }) {
5578
5578
  const context = {
5579
5579
  mode,
5580
5580
  prefixIdentifiers,
@@ -5585,6 +5585,7 @@ function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode
5585
5585
  runtimeGlobalName,
5586
5586
  runtimeModuleName,
5587
5587
  ssr,
5588
+ isTS,
5588
5589
  source: ast.loc.source,
5589
5590
  code: ``,
5590
5591
  column: 1,
@@ -5859,7 +5860,7 @@ function genModulePreamble(ast, context, genScopeId, inline) {
5859
5860
  push(`export `);
5860
5861
  }
5861
5862
  }
5862
- function genAssets(assets, type, { helper, push, newline }) {
5863
+ function genAssets(assets, type, { helper, push, newline, isTS }) {
5863
5864
  const resolver = helper(type === 'component'
5864
5865
  ? RESOLVE_COMPONENT
5865
5866
  : RESOLVE_DIRECTIVE);
@@ -5870,7 +5871,7 @@ function genAssets(assets, type, { helper, push, newline }) {
5870
5871
  if (maybeSelfReference) {
5871
5872
  id = id.slice(0, -6);
5872
5873
  }
5873
- push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})`);
5874
+ push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`);
5874
5875
  if (i < assets.length - 1) {
5875
5876
  newline();
5876
5877
  }
@@ -30687,15 +30688,9 @@ const defaultAssetUrlOptions = {
30687
30688
  const normalizeOptions = (options) => {
30688
30689
  if (Object.keys(options).some(key => isArray(options[key]))) {
30689
30690
  // legacy option format which directly passes in tags config
30690
- return {
30691
- ...defaultAssetUrlOptions,
30692
- tags: options
30693
- };
30691
+ return Object.assign(Object.assign({}, defaultAssetUrlOptions), { tags: options });
30694
30692
  }
30695
- return {
30696
- ...defaultAssetUrlOptions,
30697
- ...options
30698
- };
30693
+ return Object.assign(Object.assign({}, defaultAssetUrlOptions), options);
30699
30694
  };
30700
30695
  const createAssetUrlTransformWithOptions = (options) => {
30701
30696
  return (node, context) => transformAssetUrl(node, context, options);
@@ -31288,25 +31283,16 @@ function ssrProcessComponent(node, context) {
31288
31283
  const rawOptionsMap = new WeakMap();
31289
31284
  const [baseNodeTransforms, baseDirectiveTransforms] = getBaseTransformPreset(true);
31290
31285
  const vnodeNodeTransforms = [...baseNodeTransforms, ...DOMNodeTransforms];
31291
- const vnodeDirectiveTransforms = {
31292
- ...baseDirectiveTransforms,
31293
- ...DOMDirectiveTransforms
31294
- };
31286
+ const vnodeDirectiveTransforms = Object.assign(Object.assign({}, baseDirectiveTransforms), DOMDirectiveTransforms);
31295
31287
  function createVNodeSlotBranch(props, children, parentContext) {
31296
31288
  // apply a sub-transform using vnode-based transforms.
31297
31289
  const rawOptions = rawOptionsMap.get(parentContext.root);
31298
- const subOptions = {
31299
- ...rawOptions,
31290
+ const subOptions = Object.assign(Object.assign({}, rawOptions), {
31300
31291
  // overwrite with vnode-based transforms
31301
31292
  nodeTransforms: [
31302
31293
  ...vnodeNodeTransforms,
31303
31294
  ...(rawOptions.nodeTransforms || [])
31304
- ],
31305
- directiveTransforms: {
31306
- ...vnodeDirectiveTransforms,
31307
- ...(rawOptions.directiveTransforms || {})
31308
- }
31309
- };
31295
+ ], directiveTransforms: Object.assign(Object.assign({}, vnodeDirectiveTransforms), (rawOptions.directiveTransforms || {})) });
31310
31296
  // wrap the children with a wrapper template for proper children treatment.
31311
31297
  const wrapperNode = {
31312
31298
  type: 1 /* ELEMENT */,
@@ -31340,8 +31326,8 @@ function subTransform(node, options, parentContext) {
31340
31326
  // like normal render functions
31341
31327
  childContext.ssr = false;
31342
31328
  // inherit parent scope analysis state
31343
- childContext.scopes = { ...parentContext.scopes };
31344
- childContext.identifiers = { ...parentContext.identifiers };
31329
+ childContext.scopes = Object.assign({}, parentContext.scopes);
31330
+ childContext.identifiers = Object.assign({}, parentContext.identifiers);
31345
31331
  childContext.imports = parentContext.imports;
31346
31332
  // traverse
31347
31333
  traverseNode(childRoot, childContext);
@@ -31985,26 +31971,16 @@ function injectCssVars(node) {
31985
31971
  }
31986
31972
 
31987
31973
  function compile$1(template, options = {}) {
31988
- options = {
31989
- ...options,
31990
- // apply DOM-specific parsing options
31991
- ...parserOptions,
31992
- ssr: true,
31993
- scopeId: options.mode === 'function' ? null : options.scopeId,
31974
+ options = Object.assign(Object.assign(Object.assign({}, options), parserOptions), { ssr: true, scopeId: options.mode === 'function' ? null : options.scopeId,
31994
31975
  // always prefix since compiler-ssr doesn't have size concern
31995
- prefixIdentifiers: true,
31976
+ prefixIdentifiers: true,
31996
31977
  // disable optimizations that are unnecessary for ssr
31997
- cacheHandlers: false,
31998
- hoistStatic: false
31999
- };
31978
+ cacheHandlers: false, hoistStatic: false });
32000
31979
  const ast = baseParse(template, options);
32001
31980
  // Save raw options for AST. This is needed when performing sub-transforms
32002
31981
  // on slot vnode branches.
32003
31982
  rawOptionsMap.set(ast, options);
32004
- transform(ast, {
32005
- ...options,
32006
- hoistStatic: false,
32007
- nodeTransforms: [
31983
+ transform(ast, Object.assign(Object.assign({}, options), { hoistStatic: false, nodeTransforms: [
32008
31984
  ssrTransformIf,
32009
31985
  ssrTransformFor,
32010
31986
  trackVForSlotScopes,
@@ -32017,20 +31993,14 @@ function compile$1(template, options = {}) {
32017
31993
  trackSlotScopes,
32018
31994
  transformStyle,
32019
31995
  ...(options.nodeTransforms || []) // user transforms
32020
- ],
32021
- directiveTransforms: {
31996
+ ], directiveTransforms: Object.assign({
32022
31997
  // reusing core v-bind
32023
- bind: transformBind,
31998
+ bind: transformBind,
32024
31999
  // model and show has dedicated SSR handling
32025
- model: ssrTransformModel,
32026
- show: ssrTransformShow,
32000
+ model: ssrTransformModel, show: ssrTransformShow,
32027
32001
  // the following are ignored during SSR
32028
- on: noopDirectiveTransform,
32029
- cloak: noopDirectiveTransform,
32030
- once: noopDirectiveTransform,
32031
- ...(options.directiveTransforms || {}) // user transforms
32032
- }
32033
- });
32002
+ on: noopDirectiveTransform, cloak: noopDirectiveTransform, once: noopDirectiveTransform }, (options.directiveTransforms || {}) // user transforms
32003
+ ) }));
32034
32004
  // traverse the template AST and convert into SSR codegen AST
32035
32005
  // by replacing ast.codegenNode.
32036
32006
  ssrCodegenTransform(ast, options);
@@ -32049,7 +32019,7 @@ function preprocess({ source, filename, preprocessOptions }, preprocessor) {
32049
32019
  // have to be sync because they are applied via Node.js require hooks)
32050
32020
  let res = '';
32051
32021
  let err = null;
32052
- preprocessor.render(source, { filename, ...preprocessOptions }, (_err, _res) => {
32022
+ preprocessor.render(source, Object.assign({ filename }, preprocessOptions), (_err, _res) => {
32053
32023
  if (_err)
32054
32024
  err = _err;
32055
32025
  res = _res;
@@ -32073,10 +32043,7 @@ function compileTemplate(options) {
32073
32043
  : false;
32074
32044
  if (preprocessor) {
32075
32045
  try {
32076
- return doCompileTemplate({
32077
- ...options,
32078
- source: preprocess(options, preprocessor)
32079
- });
32046
+ return doCompileTemplate(Object.assign(Object.assign({}, options), { source: preprocess(options, preprocessor) }));
32080
32047
  }
32081
32048
  catch (e) {
32082
32049
  return {
@@ -32127,23 +32094,9 @@ function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ssr =
32127
32094
  }
32128
32095
  const shortId = id.replace(/^data-v-/, '');
32129
32096
  const longId = `data-v-${shortId}`;
32130
- let { code, ast, preamble, map } = compiler.compile(source, {
32131
- mode: 'module',
32132
- prefixIdentifiers: true,
32133
- hoistStatic: true,
32134
- cacheHandlers: true,
32135
- ssrCssVars: ssr && ssrCssVars && ssrCssVars.length
32097
+ let { code, ast, preamble, map } = compiler.compile(source, Object.assign(Object.assign({ mode: 'module', prefixIdentifiers: true, hoistStatic: true, cacheHandlers: true, ssrCssVars: ssr && ssrCssVars && ssrCssVars.length
32136
32098
  ? genCssVarsFromList(ssrCssVars, shortId, isProd)
32137
- : '',
32138
- scopeId: scoped ? longId : undefined,
32139
- slotted,
32140
- ...compilerOptions,
32141
- nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []),
32142
- filename,
32143
- sourceMap: true,
32144
- onError: e => errors.push(e),
32145
- onWarn: w => warnings.push(w)
32146
- });
32099
+ : '', scopeId: scoped ? longId : undefined, slotted }, compilerOptions), { nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []), filename, sourceMap: true, onError: e => errors.push(e), onWarn: w => warnings.push(w) }));
32147
32100
  // inMap should be the map produced by ./parse.ts which is a simple line-only
32148
32101
  // mapping. If it is present, we need to adjust the final map and errors to
32149
32102
  // reflect the original line numbers.
@@ -43904,13 +43857,7 @@ function merge$1(oldMap, newMap) {
43904
43857
  // .scss/.sass processor
43905
43858
  const scss = (source, map, options, load = require) => {
43906
43859
  const nodeSass = load('sass');
43907
- const finalOptions = {
43908
- ...options,
43909
- data: getSource(source, options.filename, options.additionalData),
43910
- file: options.filename,
43911
- outFile: options.filename,
43912
- sourceMap: !!map
43913
- };
43860
+ const finalOptions = Object.assign(Object.assign({}, options), { data: getSource(source, options.filename, options.additionalData), file: options.filename, outFile: options.filename, sourceMap: !!map });
43914
43861
  try {
43915
43862
  const result = nodeSass.renderSync(finalOptions);
43916
43863
  const dependencies = result.stats.includedFiles;
@@ -43928,16 +43875,13 @@ const scss = (source, map, options, load = require) => {
43928
43875
  return { code: '', errors: [e], dependencies: [] };
43929
43876
  }
43930
43877
  };
43931
- const sass = (source, map, options, load) => scss(source, map, {
43932
- ...options,
43933
- indentedSyntax: true
43934
- }, load);
43878
+ const sass = (source, map, options, load) => scss(source, map, Object.assign(Object.assign({}, options), { indentedSyntax: true }), load);
43935
43879
  // .less
43936
43880
  const less = (source, map, options, load = require) => {
43937
43881
  const nodeLess = load('less');
43938
43882
  let result;
43939
43883
  let error = null;
43940
- nodeLess.render(getSource(source, options.filename, options.additionalData), { ...options, syncImport: true }, (err, output) => {
43884
+ nodeLess.render(getSource(source, options.filename, options.additionalData), Object.assign(Object.assign({}, options), { syncImport: true }), (err, output) => {
43941
43885
  error = err;
43942
43886
  result = output;
43943
43887
  });
@@ -43999,13 +43943,10 @@ const processors = {
43999
43943
  };
44000
43944
 
44001
43945
  function compileStyle(options) {
44002
- return doCompileStyle({
44003
- ...options,
44004
- isAsync: false
44005
- });
43946
+ return doCompileStyle(Object.assign(Object.assign({}, options), { isAsync: false }));
44006
43947
  }
44007
43948
  function compileStyleAsync(options) {
44008
- return doCompileStyle({ ...options, isAsync: true });
43949
+ return doCompileStyle(Object.assign(Object.assign({}, options), { isAsync: true }));
44009
43950
  }
44010
43951
  function doCompileStyle(options) {
44011
43952
  const { filename, id, scoped = false, trim = true, isProd = false, modules = false, modulesOptions = {}, preprocessLang, postcssOptions, postcssPlugins } = options;
@@ -44031,11 +43972,7 @@ function doCompileStyle(options) {
44031
43972
  throw new Error('[@vue/compiler-sfc] `modules` option is not supported in the browser build.');
44032
43973
  }
44033
43974
  }
44034
- const postCSSOptions = {
44035
- ...postcssOptions,
44036
- to: filename,
44037
- from: filename
44038
- };
43975
+ const postCSSOptions = Object.assign(Object.assign({}, postcssOptions), { to: filename, from: filename });
44039
43976
  if (map) {
44040
43977
  postCSSOptions.map = {
44041
43978
  inline: false,
@@ -44106,10 +44043,7 @@ function preprocess$1(options, preprocessor) {
44106
44043
  `provide the \`preprocessCustomRequire\` option to return the in-browser ` +
44107
44044
  `version of the preprocessor.`);
44108
44045
  }
44109
- return preprocessor(options.source, options.inMap || options.map, {
44110
- filename: options.filename,
44111
- ...options.preprocessOptions
44112
- }, options.preprocessCustomRequire);
44046
+ return preprocessor(options.source, options.inMap || options.map, Object.assign({ filename: options.filename }, options.preprocessOptions), options.preprocessCustomRequire);
44113
44047
  }
44114
44048
 
44115
44049
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -45260,7 +45194,7 @@ function compileScript(sfc, options) {
45260
45194
  type: 'script',
45261
45195
  content: '',
45262
45196
  attrs: {},
45263
- loc: null
45197
+ loc: locStub
45264
45198
  };
45265
45199
  }
45266
45200
  // for backwards compat
@@ -45314,12 +45248,9 @@ function compileScript(sfc, options) {
45314
45248
  }
45315
45249
  content += `\nexport default __default__`;
45316
45250
  }
45317
- return {
45318
- ...script,
45319
- content,
45251
+ return Object.assign(Object.assign({}, script), { content,
45320
45252
  bindings,
45321
- scriptAst
45322
- };
45253
+ scriptAst });
45323
45254
  }
45324
45255
  catch (e) {
45325
45256
  // silently fallback if parse fails since user may be using custom
@@ -45943,12 +45874,9 @@ function compileScript(sfc, options) {
45943
45874
  if (propsRuntimeDefaults) {
45944
45875
  ranges.withDefaultsArg = toTextRange(propsRuntimeDefaults);
45945
45876
  }
45946
- return {
45947
- ...scriptSetup,
45948
- ranges,
45877
+ return Object.assign(Object.assign({}, scriptSetup), { ranges,
45949
45878
  scriptAst,
45950
- scriptSetupAst
45951
- };
45879
+ scriptSetupAst });
45952
45880
  }
45953
45881
  // 3. Do a full walk to rewrite identifiers referencing let exports with ref
45954
45882
  // value access
@@ -46069,23 +45997,9 @@ function compileScript(sfc, options) {
46069
45997
  }
46070
45998
  // inline render function mode - we are going to compile the template and
46071
45999
  // inline it right here
46072
- const { code, ast, preamble, tips, errors } = compileTemplate({
46073
- filename,
46074
- source: sfc.template.content,
46075
- inMap: sfc.template.map,
46076
- ...options.templateOptions,
46077
- id: scopeId,
46078
- scoped: sfc.styles.some(s => s.scoped),
46079
- isProd: options.isProd,
46080
- ssrCssVars: sfc.cssVars,
46081
- compilerOptions: {
46082
- ...(options.templateOptions &&
46083
- options.templateOptions.compilerOptions),
46084
- inline: true,
46085
- isTS,
46086
- bindingMetadata
46087
- }
46088
- });
46000
+ const { code, ast, preamble, tips, errors } = compileTemplate(Object.assign(Object.assign({ filename, source: sfc.template.content, inMap: sfc.template.map }, options.templateOptions), { id: scopeId, scoped: sfc.styles.some(s => s.scoped), isProd: options.isProd, ssrCssVars: sfc.cssVars, compilerOptions: Object.assign(Object.assign({}, (options.templateOptions &&
46001
+ options.templateOptions.compilerOptions)), { inline: true, isTS,
46002
+ bindingMetadata }) }));
46089
46003
  if (tips.length) {
46090
46004
  tips.forEach(warnOnce);
46091
46005
  }
@@ -46121,7 +46035,7 @@ function compileScript(sfc, options) {
46121
46035
  }
46122
46036
  else {
46123
46037
  // return bindings from setup
46124
- const allBindings = { ...setupBindings };
46038
+ const allBindings = Object.assign({}, setupBindings);
46125
46039
  for (const key in userImports) {
46126
46040
  if (!userImports[key].isType) {
46127
46041
  allBindings[key] = true;
@@ -46195,18 +46109,12 @@ function compileScript(sfc, options) {
46195
46109
  .join(', ')} } from 'vue'\n`);
46196
46110
  }
46197
46111
  s.trim();
46198
- return {
46199
- ...scriptSetup,
46200
- bindings: bindingMetadata,
46201
- content: s.toString(),
46202
- map: s.generateMap({
46112
+ return Object.assign(Object.assign({}, scriptSetup), { bindings: bindingMetadata, content: s.toString(), map: s.generateMap({
46203
46113
  source: filename,
46204
46114
  hires: true,
46205
46115
  includeContent: true
46206
- }),
46207
- scriptAst,
46208
- scriptSetupAst
46209
- };
46116
+ }), scriptAst,
46117
+ scriptSetupAst });
46210
46118
  }
46211
46119
  function registerBinding(bindings, node, type) {
46212
46120
  bindings[node.name] = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "types": "dist/compiler-sfc.d.ts",
@@ -31,16 +31,16 @@
31
31
  },
32
32
  "homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc#readme",
33
33
  "peerDependencies": {
34
- "vue": "3.1.3"
34
+ "vue": "3.1.4"
35
35
  },
36
36
  "dependencies": {
37
37
  "@babel/parser": "^7.13.9",
38
38
  "@babel/types": "^7.13.0",
39
39
  "@types/estree": "^0.0.48",
40
- "@vue/compiler-core": "3.1.3",
41
- "@vue/compiler-dom": "3.1.3",
42
- "@vue/compiler-ssr": "3.1.3",
43
- "@vue/shared": "3.1.3",
40
+ "@vue/compiler-core": "3.1.4",
41
+ "@vue/compiler-dom": "3.1.4",
42
+ "@vue/compiler-ssr": "3.1.4",
43
+ "@vue/shared": "3.1.4",
44
44
  "consolidate": "^0.16.0",
45
45
  "estree-walker": "^2.0.1",
46
46
  "hash-sum": "^2.0.0",