round-core 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,5 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
3
  import fs from "node:fs";
2
4
  import path from "node:path";
3
5
  function transform(code, initialDepth = 0) {
@@ -70,10 +72,12 @@ function transform(code, initialDepth = 0) {
70
72
  }
71
73
  return null;
72
74
  }
75
+ __name(parseBlock, "parseBlock");
73
76
  function consumeWhitespace(str, idx) {
74
77
  while (idx < str.length && /\s/.test(str[idx])) idx++;
75
78
  return idx;
76
79
  }
80
+ __name(consumeWhitespace, "consumeWhitespace");
77
81
  function extractCondition(str, startIndex) {
78
82
  if (str[startIndex] !== "(") return null;
79
83
  let depth = 1;
@@ -93,6 +97,7 @@ function transform(code, initialDepth = 0) {
93
97
  if (depth !== 0) return null;
94
98
  return { cond: str.substring(startIndex + 1, j - 1), end: j };
95
99
  }
100
+ __name(extractCondition, "extractCondition");
96
101
  function handleIf(currI, isBare = false) {
97
102
  let startPtr = currI;
98
103
  if (!isBare) {
@@ -163,6 +168,7 @@ function transform(code, initialDepth = 0) {
163
168
  expr += elseContent ? `(<Fragment>${elseContent}</Fragment>)` : "null";
164
169
  return { end: endIdx, replacement: `{(() => ${expr})}` };
165
170
  }
171
+ __name(handleIf, "handleIf");
166
172
  function handleFor(currI, isBare = false) {
167
173
  let ptr = currI;
168
174
  if (!isBare) ptr = consumeWhitespace(code, currI + 1);
@@ -191,6 +197,7 @@ function transform(code, initialDepth = 0) {
191
197
  const replacement = `{(() => ${list}.map(${item} => (<Fragment>${transformedContent}</Fragment>)))}`;
192
198
  return { end: endIdx, replacement };
193
199
  }
200
+ __name(handleFor, "handleFor");
194
201
  function handleSwitch(currI, isBare = false) {
195
202
  let ptr = currI;
196
203
  if (!isBare) ptr = consumeWhitespace(code, currI + 1);
@@ -221,6 +228,7 @@ function transform(code, initialDepth = 0) {
221
228
  const replacement = `{function() { __ROUND_SWITCH_TOKEN__(${cond}) { ${finalContent} } }}`;
222
229
  return { end: endIdx, replacement };
223
230
  }
231
+ __name(handleSwitch, "handleSwitch");
224
232
  let inSingle = false, inDouble = false, inTemplate = false;
225
233
  let inCommentLine = false, inCommentMulti = false;
226
234
  while (i < code.length) {
@@ -380,6 +388,7 @@ function transform(code, initialDepth = 0) {
380
388
  }
381
389
  return -1;
382
390
  }
391
+ __name(findJsxTagEnd, "findJsxTagEnd");
383
392
  function transformSuspenseBlocks(str) {
384
393
  let out = str;
385
394
  let cursor = 0;
@@ -415,6 +424,7 @@ function transform(code, initialDepth = 0) {
415
424
  }
416
425
  return out;
417
426
  }
427
+ __name(transformSuspenseBlocks, "transformSuspenseBlocks");
418
428
  function transformProviderBlocks(str) {
419
429
  let out = str;
420
430
  let cursor = 0;
@@ -463,28 +473,35 @@ function transform(code, initialDepth = 0) {
463
473
  }
464
474
  return out;
465
475
  }
476
+ __name(transformProviderBlocks, "transformProviderBlocks");
466
477
  result = transformSuspenseBlocks(result);
467
478
  result = transformProviderBlocks(result);
468
479
  result = result.replace(/\{\s*([A-Za-z_$][\w$]*)\s*\(\s*\)\s*\}/g, "{() => $1()}").replace(/=\{\s*([A-Za-z_$][\w$]*)\s*\(\s*\)\s*\}/g, "={() => $1()}");
469
480
  return result.replace(/__ROUND_SWITCH_TOKEN__/g, "switch");
470
481
  }
482
+ __name(transform, "transform");
471
483
  function normalizePath(p) {
472
484
  return p.replaceAll("\\", "/");
473
485
  }
486
+ __name(normalizePath, "normalizePath");
474
487
  function isMdRawRequest(id) {
475
488
  return typeof id === "string" && id.includes(".md") && id.includes("?raw");
476
489
  }
490
+ __name(isMdRawRequest, "isMdRawRequest");
477
491
  function stripQuery(id) {
478
492
  return id.split("?")[0];
479
493
  }
494
+ __name(stripQuery, "stripQuery");
480
495
  function escapeForJsString(s) {
481
496
  return String(s).replaceAll("\\", "\\\\").replaceAll("`", "\\`").replaceAll("${", "\\${");
482
497
  }
498
+ __name(escapeForJsString, "escapeForJsString");
483
499
  function resolveMaybeRelative(baseDir, p) {
484
500
  if (!p) return null;
485
501
  if (path.isAbsolute(p)) return p;
486
502
  return path.resolve(baseDir, p);
487
503
  }
504
+ __name(resolveMaybeRelative, "resolveMaybeRelative");
488
505
  function inlineMarkdownInRound(code, fileAbs, addWatchFile) {
489
506
  if (typeof code !== "string" || typeof fileAbs !== "string") return code;
490
507
  const dir = path.dirname(fileAbs);
@@ -512,6 +529,7 @@ ${msg}`);
512
529
  }
513
530
  });
514
531
  }
532
+ __name(inlineMarkdownInRound, "inlineMarkdownInRound");
515
533
  function isExcluded(fileAbsPath, excludeAbs) {
516
534
  const file = normalizePath(fileAbsPath);
517
535
  for (const pat of excludeAbs) {
@@ -521,6 +539,7 @@ function isExcluded(fileAbsPath, excludeAbs) {
521
539
  }
522
540
  return false;
523
541
  }
542
+ __name(isExcluded, "isExcluded");
524
543
  function isIncluded(fileAbsPath, includeAbs) {
525
544
  if (!includeAbs.length) return true;
526
545
  const file = normalizePath(fileAbsPath);
@@ -531,6 +550,7 @@ function isIncluded(fileAbsPath, includeAbs) {
531
550
  }
532
551
  return false;
533
552
  }
553
+ __name(isIncluded, "isIncluded");
534
554
  function RoundPlugin(pluginOptions = {}) {
535
555
  const state = {
536
556
  rootDir: process.cwd(),
@@ -581,6 +601,7 @@ function RoundPlugin(pluginOptions = {}) {
581
601
  state.includeAbs = Array.isArray(include) ? include.map((p) => resolveMaybeRelative(includeBase, p)).filter(Boolean) : [];
582
602
  state.excludeAbs = Array.isArray(exclude) ? exclude.map((p) => resolveMaybeRelative(excludeBase, p)).filter(Boolean) : [];
583
603
  }
604
+ __name(loadConfigOnce, "loadConfigOnce");
584
605
  function findBlock(str, startIndex) {
585
606
  let open = 0;
586
607
  let inSingle = false;
@@ -606,6 +627,7 @@ function RoundPlugin(pluginOptions = {}) {
606
627
  }
607
628
  return null;
608
629
  }
630
+ __name(findBlock, "findBlock");
609
631
  function parseStartHeadCallArgument(str, fromIndex) {
610
632
  const idx = str.indexOf("startHead", fromIndex);
611
633
  if (idx === -1) return null;
@@ -634,6 +656,7 @@ function RoundPlugin(pluginOptions = {}) {
634
656
  }
635
657
  return null;
636
658
  }
659
+ __name(parseStartHeadCallArgument, "parseStartHeadCallArgument");
637
660
  function parseStartHeadInDefaultExport(code) {
638
661
  const m = code.match(/export\s+default\s+function\b/);
639
662
  const hasAnyCall = /\bstartHead\s*\(/.test(code);
@@ -647,6 +670,7 @@ function RoundPlugin(pluginOptions = {}) {
647
670
  const call = parseStartHeadCallArgument(body, 0);
648
671
  return { headExpr: call ? call.arg : null, hasAny: hasAnyCall, hasOutside: hasAnyCall && !call };
649
672
  }
673
+ __name(parseStartHeadInDefaultExport, "parseStartHeadInDefaultExport");
650
674
  function headToHtml(head) {
651
675
  if (!head || typeof head !== "object") return "";
652
676
  let out = "";
@@ -656,10 +680,10 @@ function RoundPlugin(pluginOptions = {}) {
656
680
  }
657
681
  const meta = head.meta;
658
682
  const links = head.links;
659
- const renderAttrs = (attrs) => {
683
+ const renderAttrs = /* @__PURE__ */ __name((attrs) => {
660
684
  if (!attrs || typeof attrs !== "object") return "";
661
685
  return Object.entries(attrs).filter(([, v]) => v !== null && v !== void 0).map(([k, v]) => ` ${k}="${String(v).replaceAll('"', "&quot;")}"`).join("");
662
- };
686
+ }, "renderAttrs");
663
687
  if (Array.isArray(meta)) {
664
688
  meta.forEach((m) => {
665
689
  if (!m) return;
@@ -692,6 +716,7 @@ ${head.raw}`;
692
716
  }
693
717
  return out;
694
718
  }
719
+ __name(headToHtml, "headToHtml");
695
720
  return {
696
721
  name: "vite-plugin-round",
697
722
  enforce: "pre",
@@ -852,6 +877,7 @@ Found: ${trimmed.slice(0, 60)}...`));
852
877
  }
853
878
  };
854
879
  }
880
+ __name(RoundPlugin, "RoundPlugin");
855
881
  export {
856
882
  RoundPlugin as default
857
883
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "round-core",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A lightweight frontend framework for SPA with signals and fine grained reactivity",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -9,6 +9,11 @@
9
9
  ".": "./dist/index.js",
10
10
  "./vite-plugin": "./dist/vite-plugin.js"
11
11
  },
12
+ "files": [
13
+ "dist",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
12
17
  "type": "module",
13
18
  "icon": "Round.png",
14
19
  "repository": {
@@ -33,11 +38,7 @@
33
38
  ],
34
39
  "author": "Round Framework Team",
35
40
  "license": "MIT",
36
- "files": [
37
- "dist"
38
- ],
39
41
  "dependencies": {
40
- "marked": "^12.0.2",
41
42
  "vite": "^5.0.0"
42
43
  },
43
44
  "devDependencies": {