setupin 3.1.2 → 3.2.0

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 (3) hide show
  1. package/dist/main.js +238 -209
  2. package/dist/main.prod.js +124 -126
  3. package/package.json +6 -8
package/dist/main.js CHANGED
@@ -51,31 +51,8 @@ var __async = (__this, __arguments, generator) => {
51
51
  };
52
52
  (function() {
53
53
  "use strict";
54
- const ASCII_LOGO = "/***************************************\r\n** _ _ **\r\n** ___ ___| |_ _ _ _ __ (_)_ __ **\r\n** / __|/ _ \\ __| | | | '_ \\| | '_ \\ **\r\n** \\__ \\ __/ |_| |_| | |_/ | | | | | **\r\n** |___/\\___|\\__|\\__,_| .__/|_|_| |_| **\r\n** |_| **\r\n***************************************/";
55
- const APP_VAR_NAME = "APP$";
56
- const REPO_NAME = "setupin";
57
- const IMPORTS_TAG_CODE = `
58
- <script ${REPO_NAME} type="importmap">
59
- ${JSON.stringify({ imports: { vue: "https://unpkg.com/vue@latest/dist/vue.runtime.esm-browser.js" } })}
60
- <\/script>
61
- `;
62
- const INIT_CODE = `
63
- let ${APP_VAR_NAME} = {}
64
- `;
65
- const CREATE_APP_CODE = `
66
- import { createApp as _createApp, defineComponent as _defineComponent, h as _h, Suspense as _Suspense } from 'vue'
67
- _createApp(_defineComponent(
68
- String(${APP_VAR_NAME}.setup).startsWith('async')
69
- ? () => () => _h(_Suspense, null, {
70
- default: _h(${APP_VAR_NAME}),
71
- fallback: _h('div', 'Loading...'),
72
- })
73
- : ${APP_VAR_NAME}
74
- )).mount(document.body)
75
- `;
76
- const SCOPED_ID_CODE = `${APP_VAR_NAME}.__scopeId = "data-v-${REPO_NAME}"`;
77
54
  /**
78
- * @vue/compiler-sfc v3.5.12
55
+ * @vue/compiler-sfc v3.5.13
79
56
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
80
57
  * @license MIT
81
58
  **/
@@ -243,10 +220,9 @@ var __async = (__this, __arguments, generator) => {
243
220
  return ret;
244
221
  }
245
222
  function stringifyStyle(styles) {
223
+ if (!styles) return "";
224
+ if (isString$1(styles)) return styles;
246
225
  let ret = "";
247
- if (!styles || isString$1(styles)) {
248
- return ret;
249
- }
250
226
  for (const key in styles) {
251
227
  const value = styles[key];
252
228
  if (isString$1(value) || typeof value === "number") {
@@ -724,12 +700,13 @@ var __async = (__this, __arguments, generator) => {
724
700
  loc: locStub
725
701
  };
726
702
  }
727
- function createCacheExpression(index, value, needPauseTracking = false) {
703
+ function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) {
728
704
  return {
729
705
  type: 20,
730
706
  index,
731
707
  value,
732
708
  needPauseTracking,
709
+ inVOnce,
733
710
  needArraySpread: false,
734
711
  loc: locStub
735
712
  };
@@ -18210,11 +18187,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18210
18187
  identifier.hoisted = exp;
18211
18188
  return identifier;
18212
18189
  },
18213
- cache(exp, isVNode = false) {
18190
+ cache(exp, isVNode = false, inVOnce = false) {
18214
18191
  const cacheExp = createCacheExpression(
18215
18192
  context.cached.length,
18216
18193
  exp,
18217
- isVNode
18194
+ isVNode,
18195
+ inVOnce
18218
18196
  );
18219
18197
  context.cached.push(cacheExp);
18220
18198
  return cacheExp;
@@ -21000,7 +20978,9 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
21000
20978
  push(`_cache[${node2.index}] || (`);
21001
20979
  if (needPauseTracking) {
21002
20980
  indent();
21003
- push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
20981
+ push(`${helper(SET_BLOCK_TRACKING)}(-1`);
20982
+ if (node2.inVOnce) push(`, true`);
20983
+ push(`),`);
21004
20984
  newline();
21005
20985
  push(`(`);
21006
20986
  }
@@ -21091,12 +21071,14 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
21091
21071
  context
21092
21072
  );
21093
21073
  } else if (node2.type === 1) {
21074
+ const memo = findDir(node2, "memo");
21094
21075
  for (let i = 0; i < node2.props.length; i++) {
21095
21076
  const dir = node2.props[i];
21096
21077
  if (dir.type === 7 && dir.name !== "for") {
21097
21078
  const exp = dir.exp;
21098
21079
  const arg = dir.arg;
21099
- if (exp && exp.type === 4 && !(dir.name === "on" && arg)) {
21080
+ if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
21081
+ !(memo && arg && arg.type === 4 && arg.content === "key")) {
21100
21082
  dir.exp = processExpression(
21101
21083
  exp,
21102
21084
  context,
@@ -21618,10 +21600,19 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
21618
21600
  const isTemplate = isTemplateNode(node2);
21619
21601
  const memo = findDir(node2, "memo");
21620
21602
  const keyProp = findProp(node2, `key`, false, true);
21621
- if (keyProp && keyProp.type === 7 && !keyProp.exp) {
21603
+ const isDirKey = keyProp && keyProp.type === 7;
21604
+ if (isDirKey && !keyProp.exp) {
21622
21605
  transformBindShorthand(keyProp, context);
21623
21606
  }
21624
- const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
21607
+ let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
21608
+ if (memo && keyExp && isDirKey) {
21609
+ {
21610
+ keyProp.exp = keyExp = processExpression(
21611
+ keyExp,
21612
+ context
21613
+ );
21614
+ }
21615
+ }
21625
21616
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
21626
21617
  if (isTemplate) {
21627
21618
  if (memo) {
@@ -22965,8 +22956,8 @@ const ${helpers.map((s) => `_${helperNameMap[s]} = ${helperNameMap[s]}`).join(",
22965
22956
  if (cur.codegenNode) {
22966
22957
  cur.codegenNode = context.cache(
22967
22958
  cur.codegenNode,
22959
+ true,
22968
22960
  true
22969
- /* isVNode */
22970
22961
  );
22971
22962
  }
22972
22963
  };
@@ -28566,24 +28557,27 @@ ${defaultVar}.setup = __setup__
28566
28557
  ];
28567
28558
  }
28568
28559
  } else if (directives.length && !node2.children.length) {
28569
- const tempId = `_temp${context.temps++}`;
28570
- propsExp.arguments = [
28571
- createAssignmentExpression(
28572
- createSimpleExpression(tempId, false),
28573
- mergedProps
28574
- )
28575
- ];
28576
- rawChildrenMap.set(
28577
- node2,
28578
- createConditionalExpression(
28579
- createSimpleExpression(`"textContent" in ${tempId}`, false),
28580
- createCallExpression(context.helper(SSR_INTERPOLATE), [
28581
- createSimpleExpression(`${tempId}.textContent`, false)
28582
- ]),
28583
- createSimpleExpression(`${tempId}.innerHTML ?? ''`, false),
28584
- false
28585
- )
28586
- );
28560
+ const vText = findDir(node2, "text");
28561
+ if (!vText) {
28562
+ const tempId = `_temp${context.temps++}`;
28563
+ propsExp.arguments = [
28564
+ createAssignmentExpression(
28565
+ createSimpleExpression(tempId, false),
28566
+ mergedProps
28567
+ )
28568
+ ];
28569
+ rawChildrenMap.set(
28570
+ node2,
28571
+ createConditionalExpression(
28572
+ createSimpleExpression(`"textContent" in ${tempId}`, false),
28573
+ createCallExpression(context.helper(SSR_INTERPOLATE), [
28574
+ createSimpleExpression(`${tempId}.textContent`, false)
28575
+ ]),
28576
+ createSimpleExpression(`${tempId}.innerHTML ?? ''`, false),
28577
+ false
28578
+ )
28579
+ );
28580
+ }
28587
28581
  }
28588
28582
  if (needTagForRuntime) {
28589
28583
  propsExp.arguments.push(`"${node2.tag}"`);
@@ -29407,11 +29401,18 @@ ${defaultVar}.setup = __setup__
29407
29401
  checkDuplicatedValue();
29408
29402
  node2.children = [createInterpolation(model, model.loc)];
29409
29403
  } else if (node2.tag === "select") {
29410
- node2.children.forEach((child) => {
29411
- if (child.type === 1) {
29412
- processOption(child);
29413
- }
29414
- });
29404
+ const processChildren2 = (children) => {
29405
+ children.forEach((child) => {
29406
+ if (child.type === 1) {
29407
+ processOption(child);
29408
+ } else if (child.type === 11) {
29409
+ processChildren2(child.children);
29410
+ } else if (child.type === 9) {
29411
+ child.branches.forEach((b) => processChildren2(b.children));
29412
+ }
29413
+ });
29414
+ };
29415
+ processChildren2(node2.children);
29415
29416
  } else {
29416
29417
  context.onError(
29417
29418
  createDOMCompilerError(
@@ -29615,17 +29616,14 @@ ${defaultVar}.setup = __setup__
29615
29616
  __proto__: null,
29616
29617
  compile
29617
29618
  });
29618
- function commonjsRequire(path2) {
29619
- throw new Error('Could not dynamically require "' + path2 + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
29620
- }
29621
29619
  var _polyfillNode_fs = {};
29622
29620
  var _polyfillNode_fs$1 = /* @__PURE__ */ Object.freeze({
29623
29621
  __proto__: null,
29624
29622
  default: _polyfillNode_fs
29625
29623
  });
29626
- var require$$0$2 = /* @__PURE__ */ getAugmentedNamespace(_polyfillNode_fs$1);
29624
+ var require$$0$1 = /* @__PURE__ */ getAugmentedNamespace(_polyfillNode_fs$1);
29627
29625
  var require$$1 = /* @__PURE__ */ getAugmentedNamespace(_polyfillNode_path);
29628
- var require$$0$1 = /* @__PURE__ */ getAugmentedNamespace(_polyfillNode_util$1);
29626
+ var require$$0 = /* @__PURE__ */ getAugmentedNamespace(_polyfillNode_util$1);
29629
29627
  const hasWarned = {};
29630
29628
  function warnOnce$1(msg) {
29631
29629
  const isNodeProd = typeof process !== "undefined" && process.env.NODE_ENV === "production";
@@ -29865,42 +29863,18 @@ ${generateCodeFrame(
29865
29863
  });
29866
29864
  }
29867
29865
  var picocolors = { exports: {} };
29868
- function isatty() {
29869
- return false;
29870
- }
29871
- function ReadStream() {
29872
- throw new Error("tty.ReadStream is not implemented");
29873
- }
29874
- function WriteStream() {
29875
- throw new Error("tty.ReadStream is not implemented");
29876
- }
29877
- var _polyfillNode_tty = {
29878
- isatty,
29879
- ReadStream,
29880
- WriteStream
29881
- };
29882
- var _polyfillNode_tty$1 = /* @__PURE__ */ Object.freeze({
29883
- __proto__: null,
29884
- ReadStream,
29885
- WriteStream,
29886
- default: _polyfillNode_tty,
29887
- isatty
29888
- });
29889
- var require$$0 = /* @__PURE__ */ getAugmentedNamespace(_polyfillNode_tty$1);
29890
29866
  var hasRequiredPicocolors;
29891
29867
  function requirePicocolors() {
29892
29868
  if (hasRequiredPicocolors) return picocolors.exports;
29893
29869
  hasRequiredPicocolors = 1;
29894
- let argv2 = browser$1.argv || [], env2 = {};
29895
- let isColorSupported = !("NO_COLOR" in env2 || argv2.includes("--no-color")) && ("FORCE_COLOR" in env2 || argv2.includes("--color") || false || commonjsRequire != null && require$$0.isatty(1) && env2.TERM !== "dumb" || "CI" in env2);
29870
+ let p = browser$1 || {}, argv2 = p.argv || [], env2 = p.env || {};
29871
+ let isColorSupported = !(!!env2.NO_COLOR || argv2.includes("--no-color")) && (!!env2.FORCE_COLOR || argv2.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
29896
29872
  let formatter = (open, close, replace = open) => (input2) => {
29897
- let string2 = "" + input2;
29898
- let index = string2.indexOf(close, open.length);
29873
+ let string2 = "" + input2, index = string2.indexOf(close, open.length);
29899
29874
  return ~index ? open + replaceClose(string2, close, replace, index) + close : open + string2 + close;
29900
29875
  };
29901
29876
  let replaceClose = (string2, close, replace, index) => {
29902
- let result2 = "";
29903
- let cursor = 0;
29877
+ let result2 = "", cursor = 0;
29904
29878
  do {
29905
29879
  result2 += string2.substring(cursor, index) + replace;
29906
29880
  cursor = index + close.length;
@@ -29909,50 +29883,50 @@ ${generateCodeFrame(
29909
29883
  return result2 + string2.substring(cursor);
29910
29884
  };
29911
29885
  let createColors = (enabled = isColorSupported) => {
29912
- let init2 = enabled ? formatter : () => String;
29886
+ let f = enabled ? formatter : () => String;
29913
29887
  return {
29914
29888
  isColorSupported: enabled,
29915
- reset: init2("\x1B[0m", "\x1B[0m"),
29916
- bold: init2("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
29917
- dim: init2("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
29918
- italic: init2("\x1B[3m", "\x1B[23m"),
29919
- underline: init2("\x1B[4m", "\x1B[24m"),
29920
- inverse: init2("\x1B[7m", "\x1B[27m"),
29921
- hidden: init2("\x1B[8m", "\x1B[28m"),
29922
- strikethrough: init2("\x1B[9m", "\x1B[29m"),
29923
- black: init2("\x1B[30m", "\x1B[39m"),
29924
- red: init2("\x1B[31m", "\x1B[39m"),
29925
- green: init2("\x1B[32m", "\x1B[39m"),
29926
- yellow: init2("\x1B[33m", "\x1B[39m"),
29927
- blue: init2("\x1B[34m", "\x1B[39m"),
29928
- magenta: init2("\x1B[35m", "\x1B[39m"),
29929
- cyan: init2("\x1B[36m", "\x1B[39m"),
29930
- white: init2("\x1B[37m", "\x1B[39m"),
29931
- gray: init2("\x1B[90m", "\x1B[39m"),
29932
- bgBlack: init2("\x1B[40m", "\x1B[49m"),
29933
- bgRed: init2("\x1B[41m", "\x1B[49m"),
29934
- bgGreen: init2("\x1B[42m", "\x1B[49m"),
29935
- bgYellow: init2("\x1B[43m", "\x1B[49m"),
29936
- bgBlue: init2("\x1B[44m", "\x1B[49m"),
29937
- bgMagenta: init2("\x1B[45m", "\x1B[49m"),
29938
- bgCyan: init2("\x1B[46m", "\x1B[49m"),
29939
- bgWhite: init2("\x1B[47m", "\x1B[49m"),
29940
- blackBright: init2("\x1B[90m", "\x1B[39m"),
29941
- redBright: init2("\x1B[91m", "\x1B[39m"),
29942
- greenBright: init2("\x1B[92m", "\x1B[39m"),
29943
- yellowBright: init2("\x1B[93m", "\x1B[39m"),
29944
- blueBright: init2("\x1B[94m", "\x1B[39m"),
29945
- magentaBright: init2("\x1B[95m", "\x1B[39m"),
29946
- cyanBright: init2("\x1B[96m", "\x1B[39m"),
29947
- whiteBright: init2("\x1B[97m", "\x1B[39m"),
29948
- bgBlackBright: init2("\x1B[100m", "\x1B[49m"),
29949
- bgRedBright: init2("\x1B[101m", "\x1B[49m"),
29950
- bgGreenBright: init2("\x1B[102m", "\x1B[49m"),
29951
- bgYellowBright: init2("\x1B[103m", "\x1B[49m"),
29952
- bgBlueBright: init2("\x1B[104m", "\x1B[49m"),
29953
- bgMagentaBright: init2("\x1B[105m", "\x1B[49m"),
29954
- bgCyanBright: init2("\x1B[106m", "\x1B[49m"),
29955
- bgWhiteBright: init2("\x1B[107m", "\x1B[49m")
29889
+ reset: f("\x1B[0m", "\x1B[0m"),
29890
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
29891
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
29892
+ italic: f("\x1B[3m", "\x1B[23m"),
29893
+ underline: f("\x1B[4m", "\x1B[24m"),
29894
+ inverse: f("\x1B[7m", "\x1B[27m"),
29895
+ hidden: f("\x1B[8m", "\x1B[28m"),
29896
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
29897
+ black: f("\x1B[30m", "\x1B[39m"),
29898
+ red: f("\x1B[31m", "\x1B[39m"),
29899
+ green: f("\x1B[32m", "\x1B[39m"),
29900
+ yellow: f("\x1B[33m", "\x1B[39m"),
29901
+ blue: f("\x1B[34m", "\x1B[39m"),
29902
+ magenta: f("\x1B[35m", "\x1B[39m"),
29903
+ cyan: f("\x1B[36m", "\x1B[39m"),
29904
+ white: f("\x1B[37m", "\x1B[39m"),
29905
+ gray: f("\x1B[90m", "\x1B[39m"),
29906
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
29907
+ bgRed: f("\x1B[41m", "\x1B[49m"),
29908
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
29909
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
29910
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
29911
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
29912
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
29913
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
29914
+ blackBright: f("\x1B[90m", "\x1B[39m"),
29915
+ redBright: f("\x1B[91m", "\x1B[39m"),
29916
+ greenBright: f("\x1B[92m", "\x1B[39m"),
29917
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
29918
+ blueBright: f("\x1B[94m", "\x1B[39m"),
29919
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
29920
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
29921
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
29922
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
29923
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
29924
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
29925
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
29926
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
29927
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
29928
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
29929
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
29956
29930
  };
29957
29931
  };
29958
29932
  picocolors.exports = createColors();
@@ -30813,20 +30787,21 @@ ${generateCodeFrame(
30813
30787
  positionBy(opts, stringRepresentation) {
30814
30788
  let pos = this.source.start;
30815
30789
  if (opts.index) {
30816
- pos = this.positionInside(opts.index, stringRepresentation);
30790
+ pos = this.positionInside(opts.index);
30817
30791
  } else if (opts.word) {
30818
- stringRepresentation = this.toString();
30792
+ stringRepresentation = this.source.input.css.slice(this.source.start.offset, this.source.end.offset);
30819
30793
  let index = stringRepresentation.indexOf(opts.word);
30820
- if (index !== -1) pos = this.positionInside(index, stringRepresentation);
30794
+ if (index !== -1) pos = this.positionInside(index);
30821
30795
  }
30822
30796
  return pos;
30823
30797
  }
30824
- positionInside(index, stringRepresentation) {
30825
- let string2 = stringRepresentation || this.toString();
30798
+ positionInside(index) {
30826
30799
  let column = this.source.start.column;
30827
30800
  let line = this.source.start.line;
30828
- for (let i = 0; i < index; i++) {
30829
- if (string2[i] === "\n") {
30801
+ let offset = this.source.start.offset;
30802
+ let end = offset + index;
30803
+ for (let i = offset; i < end; i++) {
30804
+ if (this.source.input.css[i] === "\n") {
30830
30805
  column = 1;
30831
30806
  line += 1;
30832
30807
  } else {
@@ -30853,7 +30828,7 @@ ${generateCodeFrame(
30853
30828
  line: start.line
30854
30829
  };
30855
30830
  if (opts.word) {
30856
- let stringRepresentation = this.toString();
30831
+ let stringRepresentation = this.source.input.css.slice(this.source.start.offset, this.source.end.offset);
30857
30832
  let index = stringRepresentation.indexOf(opts.word);
30858
30833
  if (index !== -1) {
30859
30834
  start = this.positionInside(index, stringRepresentation);
@@ -33418,7 +33393,7 @@ ${generateCodeFrame(
33418
33393
  function requirePreviousMap() {
33419
33394
  if (hasRequiredPreviousMap) return previousMap;
33420
33395
  hasRequiredPreviousMap = 1;
33421
- let { existsSync, readFileSync } = require$$0$2;
33396
+ let { existsSync, readFileSync } = require$$0$1;
33422
33397
  let { dirname: dirname2, join: join2 } = require$$1;
33423
33398
  let { SourceMapConsumer, SourceMapGenerator } = /* @__PURE__ */ requireSourceMap$1();
33424
33399
  function fromBase64(str) {
@@ -35508,7 +35483,7 @@ ${generateCodeFrame(
35508
35483
  let Root = /* @__PURE__ */ requireRoot$1();
35509
35484
  class Processor {
35510
35485
  constructor(plugins = []) {
35511
- this.version = "8.4.47";
35486
+ this.version = "8.4.48";
35512
35487
  this.plugins = this.normalize(plugins);
35513
35488
  }
35514
35489
  normalize(plugins) {
@@ -36182,6 +36157,9 @@ ${generateCodeFrame(
36182
36157
  _proto.prepend = function prepend(selector2) {
36183
36158
  selector2.parent = this;
36184
36159
  this.nodes.unshift(selector2);
36160
+ for (var id2 in this.indexes) {
36161
+ this.indexes[id2]++;
36162
+ }
36185
36163
  return this;
36186
36164
  };
36187
36165
  _proto.at = function at(index) {
@@ -36225,7 +36203,7 @@ ${generateCodeFrame(
36225
36203
  var index;
36226
36204
  for (var id2 in this.indexes) {
36227
36205
  index = this.indexes[id2];
36228
- if (oldIndex <= index) {
36206
+ if (oldIndex < index) {
36229
36207
  this.indexes[id2] = index + 1;
36230
36208
  }
36231
36209
  }
@@ -36239,7 +36217,7 @@ ${generateCodeFrame(
36239
36217
  var index;
36240
36218
  for (var id2 in this.indexes) {
36241
36219
  index = this.indexes[id2];
36242
- if (index <= oldIndex) {
36220
+ if (index >= oldIndex) {
36243
36221
  this.indexes[id2] = index + 1;
36244
36222
  }
36245
36223
  }
@@ -37055,7 +37033,7 @@ ${generateCodeFrame(
37055
37033
  function requireNode() {
37056
37034
  if (hasRequiredNode) return node;
37057
37035
  hasRequiredNode = 1;
37058
- node = require$$0$1.deprecate;
37036
+ node = require$$0.deprecate;
37059
37037
  return node;
37060
37038
  }
37061
37039
  var hasRequiredAttribute;
@@ -39415,8 +39393,7 @@ ${generateCodeFrame(
39415
39393
  return false;
39416
39394
  }
39417
39395
  if (value === ":global" || value === "::v-global") {
39418
- selectorRoot.insertAfter(selector2, n2.nodes[0]);
39419
- selectorRoot.removeChild(selector2);
39396
+ selector2.replaceWith(n2.nodes[0]);
39420
39397
  return false;
39421
39398
  }
39422
39399
  }
@@ -45874,41 +45851,109 @@ ${exposeCall}`
45874
45851
  };
45875
45852
  __spreadValues2(__spreadValues2({}, errorMessages$1), DOMErrorMessages);
45876
45853
  libExports.parse;
45877
- function appCompiler(descriptor, info) {
45878
- const sfcAppBlock = compileScript(descriptor, __spreadProps(__spreadValues({}, info), {
45879
- isProd: false
45880
- }));
45881
- sfcAppBlock.isScoped = descriptor.styles.some((s) => s.scoped);
45882
- return sfcAppBlock;
45883
- }
45884
- function stylesCompiler(styles, info) {
45885
- return styles.map((style) => {
45886
- const sfcStyleCompileResults = compileStyle(__spreadProps(__spreadValues({}, info), {
45887
- source: style.content,
45888
- scoped: style.scoped,
45889
- isProd: false
45890
- }));
45891
- sfcStyleCompileResults.errors.forEach((e) => console.warn(e));
45892
- return sfcStyleCompileResults;
45854
+ function scriptCompiler(descriptor, id2) {
45855
+ var _a2;
45856
+ const sfcScriptBlock = compileScript(descriptor, {
45857
+ id: id2
45893
45858
  });
45859
+ (_a2 = sfcScriptBlock.warnings) == null ? void 0 : _a2.forEach((w) => console.warn(w));
45860
+ return sfcScriptBlock;
45894
45861
  }
45895
- function templateCompiler(template, info) {
45896
- var _a2;
45897
- const sfcTemplateCompileResults = compileTemplate(__spreadProps(__spreadValues({}, info), {
45898
- source: (_a2 = template == null ? void 0 : template.content) != null ? _a2 : "",
45899
- isProd: false
45900
- }));
45901
- sfcTemplateCompileResults.errors.forEach((e) => console.warn(e));
45862
+ function styleCompiler(style, id2, filename) {
45863
+ const sfcStyleCompileResults = compileStyle({
45864
+ id: id2,
45865
+ filename,
45866
+ source: style.content,
45867
+ scoped: style.scoped
45868
+ });
45869
+ sfcStyleCompileResults.errors.forEach((e) => console.error(e));
45870
+ return sfcStyleCompileResults;
45871
+ }
45872
+ function templateCompiler(descriptor, id2, filename) {
45873
+ var _a2, _b2;
45874
+ const sfcTemplateCompileResults = compileTemplate({
45875
+ id: id2,
45876
+ filename,
45877
+ source: (_b2 = (_a2 = descriptor.template) == null ? void 0 : _a2.content) != null ? _b2 : ""
45878
+ });
45879
+ sfcTemplateCompileResults.errors.forEach((e) => console.error(e));
45902
45880
  return sfcTemplateCompileResults;
45903
45881
  }
45904
- function compilerSfc(source) {
45905
- const info = { id: REPO_NAME, filename: `${REPO_NAME}.vue` };
45906
- const { descriptor, errors: errors2 } = parse$2(source, info);
45907
- errors2.forEach((e) => console.warn(e));
45882
+ function compilerSfc(source, id2) {
45883
+ const filename = `${id2}.vue`;
45884
+ const { descriptor, errors: errors2 } = parse$2(source, { filename });
45885
+ if (!descriptor.script && !descriptor.scriptSetup) {
45886
+ return compilerSfc(`<script>/* empty script */<\/script>${source}`, id2);
45887
+ }
45888
+ const isScoped = descriptor.styles.some((s) => s.scoped);
45889
+ errors2.forEach((e) => console.error(e));
45890
+ return {
45891
+ compiled: {
45892
+ sfcAppBlock: scriptCompiler(descriptor, id2),
45893
+ sfcTemplateCompileResults: templateCompiler(descriptor, id2, filename),
45894
+ sfcStyleCompileResultsList: descriptor.styles.map((s) => styleCompiler(s, id2, filename))
45895
+ },
45896
+ isScoped
45897
+ };
45898
+ }
45899
+ function scriptTransformer({ content }, appName) {
45900
+ return content.replace("export default", `${appName} =`).replace(/Object\.defineProperty\(__returned__.*/, "");
45901
+ }
45902
+ function stylesTransformer(sfcStyleCompileResultsList) {
45903
+ return sfcStyleCompileResultsList.map((style) => style.code).join("\n");
45904
+ }
45905
+ function templateTransformer({ code }, appName) {
45906
+ return code.replace("export function render", `${appName}.render = function`);
45907
+ }
45908
+ function convertor(sfcSource, { id: id2 = "sfc2esm", appName = id2, cache } = { cache: {} }) {
45909
+ if (cache[sfcSource])
45910
+ return cache[sfcSource];
45911
+ const { isScoped, compiled: c } = compilerSfc(sfcSource, id2);
45908
45912
  return {
45909
- sfcStyleCompileResultsList: stylesCompiler(descriptor.styles, info),
45910
- sfcAppBlock: appCompiler(descriptor, info),
45911
- sfcTemplateCompileResults: templateCompiler(descriptor.template, info)
45913
+ code: {
45914
+ app: scriptTransformer(c.sfcAppBlock, appName),
45915
+ render: templateTransformer(c.sfcTemplateCompileResults, appName),
45916
+ css: stylesTransformer(c.sfcStyleCompileResultsList)
45917
+ },
45918
+ isScoped
45919
+ };
45920
+ }
45921
+ function generator({ id: id2, appName, isScoped, mount }) {
45922
+ return {
45923
+ initCode: `let ${appName} = {}`,
45924
+ createAppCode: `
45925
+ import { createApp as _createApp, defineComponent as _defineComponent, h as _h, Suspense as _Suspense } from 'vue'
45926
+ _createApp(_defineComponent(
45927
+ String(${appName}.setup).startsWith('async')
45928
+ ? () => () => _h(_Suspense, null, {
45929
+ default: _h(${appName}),
45930
+ fallback: _h('div', 'Loading...'),
45931
+ })
45932
+ : ${appName}
45933
+ )).mount("${mount}")
45934
+ `,
45935
+ scopeIdCode: isScoped ? `${appName}.__scopeId = "data-v-${id2}"` : ""
45936
+ };
45937
+ }
45938
+ function useXxx2x({ id: id2 = "sfc2esm", appName = id2 } = {}) {
45939
+ const cache = /* @__PURE__ */ Object.create(null);
45940
+ const opt = { id: id2, appName };
45941
+ const h = (tag2, attrs, inner) => `<${tag2} ${Object.keys(attrs).map((k) => attrs[k] ? k : "").join(" ")}>${inner}</${tag2}>`;
45942
+ const a2b = (source, b) => convertor(source, __spreadValues({ cache }, opt)).code[b];
45943
+ return {
45944
+ scr2app: (scriptSource, setup = true) => a2b(h("script", { setup }, scriptSource), "app"),
45945
+ tem2render: (templateSource) => a2b(h("template", {}, templateSource), "render"),
45946
+ sty2css: (styleSource, scoped = false) => a2b(h("style", { scoped }, styleSource), "css"),
45947
+ sfc2x: (sfcSource, mount = "#app") => {
45948
+ const { isScoped, code: { app, render, css } } = convertor(sfcSource, __spreadValues({ cache }, opt));
45949
+ const { initCode, scopeIdCode, createAppCode } = generator(__spreadProps(__spreadValues({}, opt), { isScoped, mount }));
45950
+ return {
45951
+ esm: [initCode, app, render, scopeIdCode, createAppCode].join("\n"),
45952
+ app,
45953
+ render,
45954
+ css
45955
+ };
45956
+ }
45912
45957
  };
45913
45958
  }
45914
45959
  function createDom(row, inner) {
@@ -45939,46 +45984,30 @@ ${exposeCall}`
45939
45984
  });
45940
45985
  });
45941
45986
  }
45942
- function awaitCompileSfc(handler) {
45987
+ function awaitClientCode(handler) {
45943
45988
  return __async(this, null, function* () {
45944
- const clientCodeList = yield watchRoot((node2, clientCodeList2) => {
45989
+ const sfcCode = yield watchRoot((node2, carrier) => {
45945
45990
  if (!/^(?:script|template|style)$/.test(node2.localName)) return;
45946
45991
  if (node2.hasAttribute("src")) return;
45947
- clientCodeList2.push(node2.outerHTML);
45992
+ carrier.push(node2.outerHTML);
45948
45993
  node2.localName === "style" ? node2.onload = node2.remove : node2.remove();
45949
45994
  });
45950
- const hasScript = clientCodeList.some((code) => code.slice(1, 7) === "script");
45951
- hasScript || clientCodeList.unshift("<script>/* empty script */<\/script>");
45952
- handler(compilerSfc(clientCodeList.join("\n")));
45995
+ handler(sfcCode.join("\n"));
45953
45996
  });
45954
45997
  }
45955
- function generateCssCode(sfcStyleCompileResultsList) {
45956
- return sfcStyleCompileResultsList.map((style) => style.code).join("\n");
45957
- }
45958
- function generateEsmCode(sfcAppBlock, sfcTemplateCompileResults) {
45959
- const _scriptTransform = ({ content }) => content.replace("export default", `${APP_VAR_NAME} =`).replace(/Object\.defineProperty\(__returned__.*/, "");
45960
- const _templateTransform = ({ code }) => code.replace("export function render", `${APP_VAR_NAME}.render = function`);
45961
- return [
45962
- INIT_CODE,
45963
- _scriptTransform(sfcAppBlock),
45964
- _templateTransform(sfcTemplateCompileResults),
45965
- sfcAppBlock.isScoped ? SCOPED_ID_CODE : "",
45966
- CREATE_APP_CODE
45967
- ].join("\n");
45968
- }
45969
- function generator(compiledSfc) {
45970
- const { sfcAppBlock, sfcStyleCompileResultsList, sfcTemplateCompileResults } = compiledSfc;
45971
- return {
45972
- esmCode: generateEsmCode(sfcAppBlock, sfcTemplateCompileResults),
45973
- cssCode: generateCssCode(sfcStyleCompileResultsList)
45974
- };
45975
- }
45976
- awaitCompileSfc((compiledSfc) => {
45998
+ const ASCII_LOGO = "/***************************************\r\n** _ _ **\r\n** ___ ___| |_ _ _ _ __ (_)_ __ **\r\n** / __|/ _ \\ __| | | | '_ \\| | '_ \\ **\r\n** \\__ \\ __/ |_| |_| | |_/ | | | | | **\r\n** |___/\\___|\\__|\\__,_| .__/|_|_| |_| **\r\n** |_| **\r\n***************************************/";
45999
+ const REPO_NAME = "setupin";
46000
+ const IMPORTS_TAG_CODE = `
46001
+ <script ${REPO_NAME} type="importmap">
46002
+ ${JSON.stringify({ imports: { vue: "https://unpkg.com/vue@latest/dist/vue.runtime.esm-browser.js" } })}
46003
+ <\/script>
46004
+ `;
46005
+ awaitClientCode((sfcCode) => {
45977
46006
  var _a2, _b2, _c;
45978
46007
  const site = document["head"];
45979
- const { cssCode, esmCode } = generator(compiledSfc);
46008
+ const { esm, css } = useXxx2x({ id: REPO_NAME, appName: "APP$" }).sfc2x(sfcCode, "body");
45980
46009
  (_a2 = createDom(IMPORTS_TAG_CODE)) == null ? void 0 : _a2.mount(site);
45981
- (_b2 = createDom(`<script ${REPO_NAME} type="module">`, ASCII_LOGO + esmCode)) == null ? void 0 : _b2.mount(site);
45982
- (_c = createDom(cssCode && `<style ${REPO_NAME}>`, cssCode)) == null ? void 0 : _c.mount(document.head);
46010
+ (_b2 = createDom(`<script ${REPO_NAME} type="module">`, ASCII_LOGO + esm)) == null ? void 0 : _b2.mount(site);
46011
+ (_c = createDom(css && `<style ${REPO_NAME}>`, css)) == null ? void 0 : _c.mount(document.head);
45983
46012
  });
45984
46013
  })();