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