plgg-bundle 0.0.1 → 0.0.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.
Files changed (185) hide show
  1. package/package.json +1 -4
  2. package/dist/Dev/fixtures/devPoc.spec.d.ts +0 -2
  3. package/dist/Dev/fixtures/devPoc.spec.d.ts.map +0 -1
  4. package/dist/Dev/fixtures/devPoc.spec.js +0 -145
  5. package/dist/Dev/fixtures/devPoc.spec.js.map +0 -1
  6. package/dist/Dev/model/Fetch.d.ts +0 -20
  7. package/dist/Dev/model/Fetch.d.ts.map +0 -1
  8. package/dist/Dev/model/Fetch.js +0 -8
  9. package/dist/Dev/model/Fetch.js.map +0 -1
  10. package/dist/Dev/model/ModuleGraph.d.ts +0 -27
  11. package/dist/Dev/model/ModuleGraph.d.ts.map +0 -1
  12. package/dist/Dev/model/ModuleGraph.js +0 -2
  13. package/dist/Dev/model/ModuleGraph.js.map +0 -1
  14. package/dist/Dev/model/Protocol.d.ts +0 -22
  15. package/dist/Dev/model/Protocol.d.ts.map +0 -1
  16. package/dist/Dev/model/Protocol.js +0 -31
  17. package/dist/Dev/model/Protocol.js.map +0 -1
  18. package/dist/Dev/node/devServer.d.ts +0 -21
  19. package/dist/Dev/node/devServer.d.ts.map +0 -1
  20. package/dist/Dev/node/devServer.js +0 -298
  21. package/dist/Dev/node/devServer.js.map +0 -1
  22. package/dist/Dev/node/httpAdapter.d.ts +0 -19
  23. package/dist/Dev/node/httpAdapter.d.ts.map +0 -1
  24. package/dist/Dev/node/httpAdapter.js +0 -76
  25. package/dist/Dev/node/httpAdapter.js.map +0 -1
  26. package/dist/Dev/node/scanGraph.d.ts +0 -21
  27. package/dist/Dev/node/scanGraph.d.ts.map +0 -1
  28. package/dist/Dev/node/scanGraph.js +0 -145
  29. package/dist/Dev/node/scanGraph.js.map +0 -1
  30. package/dist/Dev/node/watch.d.ts +0 -10
  31. package/dist/Dev/node/watch.d.ts.map +0 -1
  32. package/dist/Dev/node/watch.js +0 -44
  33. package/dist/Dev/node/watch.js.map +0 -1
  34. package/dist/Dev/usecase/allowedHost.d.ts +0 -16
  35. package/dist/Dev/usecase/allowedHost.d.ts.map +0 -1
  36. package/dist/Dev/usecase/allowedHost.js +0 -33
  37. package/dist/Dev/usecase/allowedHost.js.map +0 -1
  38. package/dist/Dev/usecase/allowedHost.spec.d.ts +0 -2
  39. package/dist/Dev/usecase/allowedHost.spec.d.ts.map +0 -1
  40. package/dist/Dev/usecase/allowedHost.spec.js +0 -13
  41. package/dist/Dev/usecase/allowedHost.spec.js.map +0 -1
  42. package/dist/Dev/usecase/buildGraph.d.ts +0 -12
  43. package/dist/Dev/usecase/buildGraph.d.ts.map +0 -1
  44. package/dist/Dev/usecase/buildGraph.js +0 -24
  45. package/dist/Dev/usecase/buildGraph.js.map +0 -1
  46. package/dist/Dev/usecase/buildGraph.spec.d.ts +0 -2
  47. package/dist/Dev/usecase/buildGraph.spec.d.ts.map +0 -1
  48. package/dist/Dev/usecase/buildGraph.spec.js +0 -16
  49. package/dist/Dev/usecase/buildGraph.spec.js.map +0 -1
  50. package/dist/Dev/usecase/decorateDevHtml.d.ts +0 -12
  51. package/dist/Dev/usecase/decorateDevHtml.d.ts.map +0 -1
  52. package/dist/Dev/usecase/decorateDevHtml.js +0 -15
  53. package/dist/Dev/usecase/decorateDevHtml.js.map +0 -1
  54. package/dist/Dev/usecase/decorateDevHtml.spec.d.ts +0 -2
  55. package/dist/Dev/usecase/decorateDevHtml.spec.d.ts.map +0 -1
  56. package/dist/Dev/usecase/decorateDevHtml.spec.js +0 -19
  57. package/dist/Dev/usecase/decorateDevHtml.spec.js.map +0 -1
  58. package/dist/Dev/usecase/invalidate.d.ts +0 -17
  59. package/dist/Dev/usecase/invalidate.d.ts.map +0 -1
  60. package/dist/Dev/usecase/invalidate.js +0 -57
  61. package/dist/Dev/usecase/invalidate.js.map +0 -1
  62. package/dist/Dev/usecase/invalidate.spec.d.ts +0 -2
  63. package/dist/Dev/usecase/invalidate.spec.d.ts.map +0 -1
  64. package/dist/Dev/usecase/invalidate.spec.js +0 -64
  65. package/dist/Dev/usecase/invalidate.spec.js.map +0 -1
  66. package/dist/Dev/usecase/parseImports.d.ts +0 -24
  67. package/dist/Dev/usecase/parseImports.d.ts.map +0 -1
  68. package/dist/Dev/usecase/parseImports.js +0 -40
  69. package/dist/Dev/usecase/parseImports.js.map +0 -1
  70. package/dist/Dev/usecase/parseImports.spec.d.ts +0 -2
  71. package/dist/Dev/usecase/parseImports.spec.d.ts.map +0 -1
  72. package/dist/Dev/usecase/parseImports.spec.js +0 -24
  73. package/dist/Dev/usecase/parseImports.spec.js.map +0 -1
  74. package/dist/Dev/usecase/reloadDecision.d.ts +0 -20
  75. package/dist/Dev/usecase/reloadDecision.d.ts.map +0 -1
  76. package/dist/Dev/usecase/reloadDecision.js +0 -52
  77. package/dist/Dev/usecase/reloadDecision.js.map +0 -1
  78. package/dist/Dev/usecase/reloadDecision.spec.d.ts +0 -2
  79. package/dist/Dev/usecase/reloadDecision.spec.d.ts.map +0 -1
  80. package/dist/Dev/usecase/reloadDecision.spec.js +0 -17
  81. package/dist/Dev/usecase/reloadDecision.spec.js.map +0 -1
  82. package/dist/domain/model/BundleConfig.d.ts +0 -136
  83. package/dist/domain/model/BundleConfig.d.ts.map +0 -1
  84. package/dist/domain/model/BundleConfig.js +0 -18
  85. package/dist/domain/model/BundleConfig.js.map +0 -1
  86. package/dist/domain/model/BundleConfig.spec.d.ts +0 -2
  87. package/dist/domain/model/BundleConfig.spec.d.ts.map +0 -1
  88. package/dist/domain/model/BundleConfig.spec.js +0 -8
  89. package/dist/domain/model/BundleConfig.spec.js.map +0 -1
  90. package/dist/domain/usecase/asBundleConfig.d.ts +0 -17
  91. package/dist/domain/usecase/asBundleConfig.d.ts.map +0 -1
  92. package/dist/domain/usecase/asBundleConfig.js +0 -179
  93. package/dist/domain/usecase/asBundleConfig.js.map +0 -1
  94. package/dist/domain/usecase/asBundleConfig.spec.d.ts +0 -2
  95. package/dist/domain/usecase/asBundleConfig.spec.d.ts.map +0 -1
  96. package/dist/domain/usecase/asBundleConfig.spec.js +0 -119
  97. package/dist/domain/usecase/asBundleConfig.spec.js.map +0 -1
  98. package/dist/domain/usecase/build.d.ts +0 -14
  99. package/dist/domain/usecase/build.d.ts.map +0 -1
  100. package/dist/domain/usecase/build.js +0 -177
  101. package/dist/domain/usecase/build.js.map +0 -1
  102. package/dist/domain/usecase/collectModules.d.ts +0 -53
  103. package/dist/domain/usecase/collectModules.d.ts.map +0 -1
  104. package/dist/domain/usecase/collectModules.js +0 -118
  105. package/dist/domain/usecase/collectModules.js.map +0 -1
  106. package/dist/domain/usecase/deriveExternal.d.ts +0 -25
  107. package/dist/domain/usecase/deriveExternal.d.ts.map +0 -1
  108. package/dist/domain/usecase/deriveExternal.js +0 -79
  109. package/dist/domain/usecase/deriveExternal.js.map +0 -1
  110. package/dist/domain/usecase/deriveExternal.spec.d.ts +0 -2
  111. package/dist/domain/usecase/deriveExternal.spec.d.ts.map +0 -1
  112. package/dist/domain/usecase/deriveExternal.spec.js +0 -56
  113. package/dist/domain/usecase/deriveExternal.spec.js.map +0 -1
  114. package/dist/domain/usecase/discoverWorkspace.d.ts +0 -27
  115. package/dist/domain/usecase/discoverWorkspace.d.ts.map +0 -1
  116. package/dist/domain/usecase/discoverWorkspace.js +0 -116
  117. package/dist/domain/usecase/discoverWorkspace.js.map +0 -1
  118. package/dist/domain/usecase/discoverWorkspace.spec.d.ts +0 -2
  119. package/dist/domain/usecase/discoverWorkspace.spec.d.ts.map +0 -1
  120. package/dist/domain/usecase/discoverWorkspace.spec.js +0 -23
  121. package/dist/domain/usecase/discoverWorkspace.spec.js.map +0 -1
  122. package/dist/domain/usecase/emitBundle.d.ts +0 -43
  123. package/dist/domain/usecase/emitBundle.d.ts.map +0 -1
  124. package/dist/domain/usecase/emitBundle.js +0 -157
  125. package/dist/domain/usecase/emitBundle.js.map +0 -1
  126. package/dist/domain/usecase/emitBundle.spec.d.ts +0 -2
  127. package/dist/domain/usecase/emitBundle.spec.d.ts.map +0 -1
  128. package/dist/domain/usecase/emitBundle.spec.js +0 -80
  129. package/dist/domain/usecase/emitBundle.spec.js.map +0 -1
  130. package/dist/domain/usecase/emitDts.d.ts +0 -32
  131. package/dist/domain/usecase/emitDts.d.ts.map +0 -1
  132. package/dist/domain/usecase/emitDts.js +0 -99
  133. package/dist/domain/usecase/emitDts.js.map +0 -1
  134. package/dist/domain/usecase/isExternal.d.ts +0 -12
  135. package/dist/domain/usecase/isExternal.d.ts.map +0 -1
  136. package/dist/domain/usecase/isExternal.js +0 -16
  137. package/dist/domain/usecase/isExternal.js.map +0 -1
  138. package/dist/domain/usecase/isExternal.spec.d.ts +0 -2
  139. package/dist/domain/usecase/isExternal.spec.d.ts.map +0 -1
  140. package/dist/domain/usecase/isExternal.spec.js +0 -16
  141. package/dist/domain/usecase/isExternal.spec.js.map +0 -1
  142. package/dist/domain/usecase/resolveSpecifier.d.ts +0 -35
  143. package/dist/domain/usecase/resolveSpecifier.d.ts.map +0 -1
  144. package/dist/domain/usecase/resolveSpecifier.js +0 -83
  145. package/dist/domain/usecase/resolveSpecifier.js.map +0 -1
  146. package/dist/domain/usecase/resolveSpecifier.spec.d.ts +0 -2
  147. package/dist/domain/usecase/resolveSpecifier.spec.d.ts.map +0 -1
  148. package/dist/domain/usecase/resolveSpecifier.spec.js +0 -44
  149. package/dist/domain/usecase/resolveSpecifier.spec.js.map +0 -1
  150. package/dist/domain/usecase/resolveWorkspaceSpecifier.d.ts +0 -29
  151. package/dist/domain/usecase/resolveWorkspaceSpecifier.d.ts.map +0 -1
  152. package/dist/domain/usecase/resolveWorkspaceSpecifier.js +0 -89
  153. package/dist/domain/usecase/resolveWorkspaceSpecifier.js.map +0 -1
  154. package/dist/domain/usecase/resolveWorkspaceSpecifier.spec.d.ts +0 -2
  155. package/dist/domain/usecase/resolveWorkspaceSpecifier.spec.d.ts.map +0 -1
  156. package/dist/domain/usecase/resolveWorkspaceSpecifier.spec.js +0 -27
  157. package/dist/domain/usecase/resolveWorkspaceSpecifier.spec.js.map +0 -1
  158. package/dist/domain/usecase/rewriteDtsAliases.d.ts +0 -25
  159. package/dist/domain/usecase/rewriteDtsAliases.d.ts.map +0 -1
  160. package/dist/domain/usecase/rewriteDtsAliases.js +0 -71
  161. package/dist/domain/usecase/rewriteDtsAliases.js.map +0 -1
  162. package/dist/domain/usecase/rewriteDtsAliases.spec.d.ts +0 -2
  163. package/dist/domain/usecase/rewriteDtsAliases.spec.d.ts.map +0 -1
  164. package/dist/domain/usecase/rewriteDtsAliases.spec.js +0 -35
  165. package/dist/domain/usecase/rewriteDtsAliases.spec.js.map +0 -1
  166. package/dist/entrypoints/cli.d.ts +0 -2
  167. package/dist/entrypoints/cli.d.ts.map +0 -1
  168. package/dist/entrypoints/cli.js +0 -79
  169. package/dist/entrypoints/cli.js.map +0 -1
  170. package/dist/index.d.ts +0 -21
  171. package/dist/index.d.ts.map +0 -1
  172. package/dist/index.js +0 -28
  173. package/dist/index.js.map +0 -1
  174. package/dist/vendors/runner.d.ts +0 -20
  175. package/dist/vendors/runner.d.ts.map +0 -1
  176. package/dist/vendors/runner.js +0 -60
  177. package/dist/vendors/runner.js.map +0 -1
  178. package/dist/vendors/runner.spec.d.ts +0 -2
  179. package/dist/vendors/runner.spec.d.ts.map +0 -1
  180. package/dist/vendors/runner.spec.js +0 -20
  181. package/dist/vendors/runner.spec.js.map +0 -1
  182. package/dist/vendors/transpiler.d.ts +0 -19
  183. package/dist/vendors/transpiler.d.ts.map +0 -1
  184. package/dist/vendors/transpiler.js +0 -42
  185. package/dist/vendors/transpiler.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"invalidate.d.ts","sourceRoot":"","sources":["../../../src/Dev/usecase/invalidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAErE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,WAAW,EAClB,SAAS,MAAM,KACd,WAAW,CAAC,MAAM,CAsBpB,CAAC"}
@@ -1,57 +0,0 @@
1
- import {} from "plgg-bundle/Dev/model/ModuleGraph";
2
- /**
3
- * The invalidation set for a changed file: the file itself
4
- * plus every module that transitively imports it (its
5
- * reverse-reachable closure in the {@link ModuleGraph}).
6
- * These are exactly the modules a cache-busted re-import
7
- * must re-evaluate for the edit to take effect — a change
8
- * to a deep leaf `B` invalidates every `A` that imports it
9
- * (directly or through a chain).
10
- *
11
- * Pure graph walk over reversed edges; cycle-safe via the
12
- * visited set. This is the "transitive invalidation" the
13
- * ticket flags as the hard part, isolated here as testable
14
- * logic (A imports B; invalidate(B) ⊇ {A, B}).
15
- */
16
- export const transitiveImporters = (graph, changed) => {
17
- const importers = reverseEdges(graph);
18
- const seen = new Set([changed]);
19
- // Breadth-first by layers: `for...of` over each frontier
20
- // yields a `string` directly (no indexed access, no
21
- // `.shift()` undefined case), keeping the walk `as`-free.
22
- let frontier = [changed];
23
- while (frontier.length > 0) {
24
- const next = [];
25
- for (const node of frontier) {
26
- for (const importer of importers.get(node) ?? []) {
27
- if (!seen.has(importer)) {
28
- seen.add(importer);
29
- next.push(importer);
30
- }
31
- }
32
- }
33
- frontier = next;
34
- }
35
- return seen;
36
- };
37
- /**
38
- * Invert the graph: for each `from → to` forward edge,
39
- * record `to → from` so a lookup answers "who imports
40
- * this file". Local helper for {@link transitiveImporters}.
41
- */
42
- const reverseEdges = (graph) => {
43
- const reversed = new Map();
44
- for (const [from, tos] of graph) {
45
- for (const to of tos) {
46
- const existing = reversed.get(to);
47
- if (existing === undefined) {
48
- reversed.set(to, [from]);
49
- }
50
- else {
51
- existing.push(from);
52
- }
53
- }
54
- }
55
- return reversed;
56
- };
57
- //# sourceMappingURL=invalidate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invalidate.js","sourceRoot":"","sources":["../../../src/Dev/usecase/invalidate.ts"],"names":[],"mappings":"AAA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3B,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=invalidate.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invalidate.spec.d.ts","sourceRoot":"","sources":["../../../src/Dev/usecase/invalidate.spec.ts"],"names":[],"mappings":""}
@@ -1,64 +0,0 @@
1
- import { test, check, all, toBe, } from "plgg-test";
2
- import { buildGraph } from "plgg-bundle/Dev/usecase/buildGraph";
3
- import { transitiveImporters } from "plgg-bundle/Dev/usecase/invalidate";
4
- /** A imports B; editing B must re-evaluate A (and B). */
5
- test("transitiveImporters: A imports B ⇒ invalidate(B) = {A, B}", () => {
6
- const graph = buildGraph([
7
- { from: "/a.ts", to: "/b.ts" },
8
- ]);
9
- const set = transitiveImporters(graph, "/b.ts");
10
- return all([
11
- check(set.has("/a.ts"), toBe(true)),
12
- check(set.has("/b.ts"), toBe(true)),
13
- check(set.size, toBe(2)),
14
- ]);
15
- });
16
- /** Deep chain A→B→C: editing C invalidates the whole chain. */
17
- test("transitiveImporters walks a transitive chain A→B→C", () => {
18
- const graph = buildGraph([
19
- { from: "/a.ts", to: "/b.ts" },
20
- { from: "/b.ts", to: "/c.ts" },
21
- ]);
22
- const set = transitiveImporters(graph, "/c.ts");
23
- return all([
24
- check(set.has("/a.ts"), toBe(true)),
25
- check(set.has("/b.ts"), toBe(true)),
26
- check(set.has("/c.ts"), toBe(true)),
27
- check(set.size, toBe(3)),
28
- ]);
29
- });
30
- /** A leaf's editor invalidates only itself. */
31
- test("transitiveImporters of a root importer is just itself", () => {
32
- const graph = buildGraph([
33
- { from: "/a.ts", to: "/b.ts" },
34
- ]);
35
- const set = transitiveImporters(graph, "/a.ts");
36
- return all([
37
- check(set.has("/a.ts"), toBe(true)),
38
- check(set.size, toBe(1)),
39
- ]);
40
- });
41
- /** Two importers of one leaf: editing C invalidates both A and B. */
42
- test("transitiveImporters collects multiple importers of one file", () => {
43
- const graph = buildGraph([
44
- { from: "/a.ts", to: "/c.ts" },
45
- { from: "/b.ts", to: "/c.ts" },
46
- ]);
47
- const set = transitiveImporters(graph, "/c.ts");
48
- return all([
49
- check(set.has("/a.ts"), toBe(true)),
50
- check(set.has("/b.ts"), toBe(true)),
51
- check(set.has("/c.ts"), toBe(true)),
52
- check(set.size, toBe(3)),
53
- ]);
54
- });
55
- /** A cycle (A↔B) terminates and includes both. */
56
- test("transitiveImporters is cycle-safe", () => {
57
- const graph = buildGraph([
58
- { from: "/a.ts", to: "/b.ts" },
59
- { from: "/b.ts", to: "/a.ts" },
60
- ]);
61
- const set = transitiveImporters(graph, "/a.ts");
62
- return check(set.size, toBe(2));
63
- });
64
- //# sourceMappingURL=invalidate.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invalidate.spec.js","sourceRoot":"","sources":["../../../src/Dev/usecase/invalidate.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,IAAI,GACL,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,yDAAyD;AACzD,IAAI,CAAC,2DAA2D,EAAE,GAAG,EAAE;IACrE,MAAM,KAAK,GAAG,UAAU,CAAC;QACvB,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE;KAC/B,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,mBAAmB,CAC7B,KAAK,EACL,OAAO,CACR,CAAC;IACF,OAAO,GAAG,CAAC;QACT,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,O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G,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Extract the import specifiers from a TypeScript/ESM
3
- * source string. Pure string analysis — no fs, no
4
- * `typescript` AST — matching the three import forms the
5
- * monorepo actually uses:
6
- *
7
- * - static `import ... from "spec"`,
8
- * - re-export `export ... from "spec"`,
9
- * - dynamic `import("spec")`.
10
- *
11
- * The node adapter feeds each watched file's contents
12
- * through this to build the local module graph. Returns
13
- * specifiers in source order (duplicates preserved);
14
- * resolution + local-only filtering is the adapter's job.
15
- *
16
- * This is intentionally a lightweight lexical scan, not a
17
- * full parser: the specifiers it yields drive only the
18
- * dev server's *reload decision* (which files are part of
19
- * the served graph), never the production build, so an
20
- * exotic un-matched form costs at most one conservative
21
- * extra reload — never a wrong bundle.
22
- */
23
- export declare const parseImports: (source: string) => ReadonlyArray<string>;
24
- //# sourceMappingURL=parseImports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseImports.d.ts","sourceRoot":"","sources":["../../../src/Dev/usecase/parseImports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,YAAY,GACvB,QAAQ,MAAM,KACb,aAAa,CAAC,MAAM,CAcpB,CAAC"}
@@ -1,40 +0,0 @@
1
- /**
2
- * Extract the import specifiers from a TypeScript/ESM
3
- * source string. Pure string analysis — no fs, no
4
- * `typescript` AST — matching the three import forms the
5
- * monorepo actually uses:
6
- *
7
- * - static `import ... from "spec"`,
8
- * - re-export `export ... from "spec"`,
9
- * - dynamic `import("spec")`.
10
- *
11
- * The node adapter feeds each watched file's contents
12
- * through this to build the local module graph. Returns
13
- * specifiers in source order (duplicates preserved);
14
- * resolution + local-only filtering is the adapter's job.
15
- *
16
- * This is intentionally a lightweight lexical scan, not a
17
- * full parser: the specifiers it yields drive only the
18
- * dev server's *reload decision* (which files are part of
19
- * the served graph), never the production build, so an
20
- * exotic un-matched form costs at most one conservative
21
- * extra reload — never a wrong bundle.
22
- */
23
- export const parseImports = (source) =>
24
- // Each pattern's first capture group is the quoted
25
- // specifier's inner text. `Array.from(..., mapFn)` +
26
- // a type-guard `filter` extracts it without an
27
- // `if`/`??` branch on the (unreachable) `undefined` a
28
- // capture group would only take if it were optional.
29
- PATTERNS.flatMap((pattern) => Array.from(source.matchAll(pattern), (m) => m[1]).filter((spec) => spec !== undefined));
30
- /**
31
- * The specifier-bearing forms. A `from "…"` clause covers
32
- * both `import` and `export`; a bare `import("…")` covers
33
- * dynamic import. `["']` matches either quote style; the
34
- * inner `[^"']+` is the specifier.
35
- */
36
- const PATTERNS = [
37
- /\bfrom\s*["']([^"']+)["']/g,
38
- /\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,
39
- ];
40
- //# sourceMappingURL=parseImports.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseImports.js","sourceRoot":"","sources":["../../../src/Dev/usecase/parseImports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAc,EACS,EAAE;AACzB,mDAAmD;AACnD,qDAAqD;AACrD,+CAA+C;AAC/C,sDAAsD;AACtD,qDAAqD;AACrD,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC3B,KAAK,CAAC,IAAI,CACR,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EACxB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACZ,CAAC,MAAM,CACN,CAAC,IAAI,EAAkB,EAAE,CACvB,IAAI,KAAK,SAAS,CACrB,CACF,CAAC;AAEJ;;;;;GAKG;AACH,MAAM,QAAQ,GAA0B;IACtC,4BAA4B;IAC5B,wCAAwC;CACzC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=parseImports.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseImports.spec.d.ts","sourceRoot":"","sources":["../../../src/Dev/usecase/parseImports.spec.ts"],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
1
- import { test, check, all, toBe, toEqual, } from "plgg-test";
2
- import { parseImports } from "plgg-bundle/Dev/usecase/parseImports";
3
- test("parseImports reads static import + re-export + dynamic forms", () => check(parseImports([
4
- `import { a } from "./a.ts";`,
5
- `import b from './b';`,
6
- `export { c } from "./c.ts";`,
7
- `const d = await import("./d.ts");`,
8
- `export * from "./e";`,
9
- ].join("\n")), toEqual([
10
- // `from "…"` matches (import/export/re-export) come
11
- // first, then the dynamic `import("…")` pass.
12
- "./a.ts",
13
- "./b",
14
- "./c.ts",
15
- "./e",
16
- "./d.ts",
17
- ])));
18
- test("parseImports returns empty for a source with no imports", () => check(parseImports("export const x = 1;\n").length, toBe(0)));
19
- test("parseImports captures bare package + node specifiers too (adapter filters locality)", () => check(parseImports(`import { x } from "node:fs";\nimport y from "some-pkg";`), toEqual(["node:fs", "some-pkg"])));
20
- test("parseImports handles single and double quotes", () => all([
21
- check(parseImports(`import("./x.ts")`), toEqual(["./x.ts"])),
22
- check(parseImports(`import('./y.ts')`), toEqual(["./y.ts"])),
23
- ]));
24
- //# sourceMappingURL=parseImports.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseImports.spec.js","sourceRoot":"","sources":["../../../src/Dev/usecase/parseImports.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,IAAI,EACJ,OAAO,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE,IAAI,CAAC,8DAA8D,EAAE,GAAG,EAAE,CACxE,KAAK,CACH,YAAY,CACV;IACE,6BAA6B;IAC7B,sBAAsB;IACtB,6BAA6B;IAC7B,mCAAmC;IACnC,sBAAsB;CACvB,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,EACD,OAAO,CAAC;IACN,oDAAoD;IACpD,8CAA8C;IAC9C,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,KAAK;IACL,QAAQ;CACT,CAAC,CACH,CAAC,CAAC;AAEL,IAAI,CAAC,yDAAyD,EAAE,GAAG,EAAE,CACnE,KAAK,CACH,YAAY,CACV,uBAAuB,CACxB,CAAC,MAAM,EACR,IAAI,CAAC,CAAC,CAAC,CACR,CAAC,CAAC;AAEL,IAAI,CAAC,qFAAqF,EAAE,GAAG,EAAE,CAC/F,KAAK,CACH,YAAY,CACV,yDAAyD,CAC1D,EACD,OAAO,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CACjC,CAAC,CAAC;AAEL,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE,CACzD,GAAG,CAAC;IACF,KAAK,CACH,YAAY,CAAC,kBAAkB,CAAC,EAChC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CACpB;IACD,KAAK,CACH,YAAY,CAAC,kBAAkB,CAAC,EAChC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CACpB;CACF,CAAC,CAAC,CAAC"}
@@ -1,20 +0,0 @@
1
- import { type ModuleGraph } from "plgg-bundle/Dev/model/ModuleGraph";
2
- /**
3
- * Whether a changed file warrants a hot-reload:
4
- *
5
- * - content (non-source-code, e.g. `.md`) → always, since
6
- * the render re-reads it;
7
- * - source code that participates in the app's served
8
- * {@link ModuleGraph} (a graph key it imports from, or a
9
- * graph value something imports) → yes;
10
- * - source code the app never imports (a stray scratch
11
- * `.ts`) → ignored, so the browser only reloads on edits
12
- * that can change the output.
13
- *
14
- * Conservative fallback: an EMPTY graph means the scan
15
- * could not map the app, so every change reloads rather
16
- * than silently going stale. Pure decision over the graph —
17
- * the adapter owns the fs.
18
- */
19
- export declare const shouldReload: (graph: ModuleGraph, changed: string) => boolean;
20
- //# sourceMappingURL=reloadDecision.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reloadDecision.d.ts","sourceRoot":"","sources":["../../../src/Dev/usecase/reloadDecision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAgBrE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,WAAW,EAClB,SAAS,MAAM,KACd,OAI+B,CAAC"}
@@ -1,52 +0,0 @@
1
- import {} from "plgg-bundle/Dev/model/ModuleGraph";
2
- /**
3
- * Source-code extensions — the files the module graph
4
- * tracks. A changed file with any OTHER extension is
5
- * content (Markdown, an asset) whose edit the app re-reads
6
- * at render time, so it always warrants a reload.
7
- */
8
- const SOURCE_EXT = [
9
- ".ts",
10
- ".tsx",
11
- ".mts",
12
- ".js",
13
- ".mjs",
14
- ];
15
- /**
16
- * Whether a changed file warrants a hot-reload:
17
- *
18
- * - content (non-source-code, e.g. `.md`) → always, since
19
- * the render re-reads it;
20
- * - source code that participates in the app's served
21
- * {@link ModuleGraph} (a graph key it imports from, or a
22
- * graph value something imports) → yes;
23
- * - source code the app never imports (a stray scratch
24
- * `.ts`) → ignored, so the browser only reloads on edits
25
- * that can change the output.
26
- *
27
- * Conservative fallback: an EMPTY graph means the scan
28
- * could not map the app, so every change reloads rather
29
- * than silently going stale. Pure decision over the graph —
30
- * the adapter owns the fs.
31
- */
32
- export const shouldReload = (graph, changed) => !isSourceCode(changed) ||
33
- graph.size === 0 ||
34
- graph.has(changed) ||
35
- importsSomewhere(graph, changed);
36
- /** Whether a path is a tracked source-code file (by extension). */
37
- const isSourceCode = (changed) => SOURCE_EXT.some((e) => changed.endsWith(e));
38
- /**
39
- * Whether any node in the graph imports `changed` (i.e. it
40
- * appears as an edge target). Local scan over the forward
41
- * edges — the reverse lookup is only needed once per
42
- * decision, so it is not memoised.
43
- */
44
- const importsSomewhere = (graph, changed) => {
45
- for (const tos of graph.values()) {
46
- if (tos.includes(changed)) {
47
- return true;
48
- }
49
- }
50
- return false;
51
- };
52
- //# sourceMappingURL=reloadDecision.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reloadDecision.js","sourceRoot":"","sources":["../../../src/Dev/usecase/reloadDecision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,mCAAmC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,UAAU,GAA0B;IACxC,KAAK;IACL,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;CACP,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAkB,EAClB,OAAe,EACN,EAAE,CACX,CAAC,YAAY,CAAC,OAAO,CAAC;IACtB,KAAK,CAAC,IAAI,KAAK,CAAC;IAChB,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IAClB,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAEnC,mEAAmE;AACnE,MAAM,YAAY,GAAG,CACnB,OAAe,EACN,EAAE,CACX,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CACvB,KAAkB,EAClB,OAAe,EACN,EAAE;IACX,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QACjC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=reloadDecision.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reloadDecision.spec.d.ts","sourceRoot":"","sources":["../../../src/Dev/usecase/reloadDecision.spec.ts"],"names":[],"mappings":""}
@@ -1,17 +0,0 @@
1
- import { test, check, all, toBe, } from "plgg-test";
2
- import { buildGraph } from "plgg-bundle/Dev/usecase/buildGraph";
3
- import { shouldReload } from "plgg-bundle/Dev/usecase/reloadDecision";
4
- const graph = buildGraph([
5
- { from: "/a.ts", to: "/b.ts" },
6
- ]);
7
- test("shouldReload is true for a file that imports (graph key)", () => check(shouldReload(graph, "/a.ts"), toBe(true)));
8
- test("shouldReload is true for an imported file (graph value)", () => check(shouldReload(graph, "/b.ts"), toBe(true)));
9
- test("shouldReload is false for a source file outside the served graph", () => check(shouldReload(graph, "/unrelated.ts"), toBe(false)));
10
- test("shouldReload is true for a content (non-code) file edit", () => all([
11
- check(shouldReload(graph, "/docs/guide.md"), toBe(true)),
12
- check(shouldReload(graph, "/assets/x.css"), toBe(true)),
13
- ]));
14
- test("shouldReload falls back to true for an empty graph", () => all([
15
- check(shouldReload(buildGraph([]), "/x.ts"), toBe(true)),
16
- ]));
17
- //# sourceMappingURL=reloadDecision.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reloadDecision.spec.js","sourceRoot":"","sources":["../../../src/Dev/usecase/reloadDecision.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,IAAI,GACL,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,MAAM,KAAK,GAAG,UAAU,CAAC;IACvB,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE;CAC/B,CAAC,CAAC;AAEH,IAAI,CAAC,0DAA0D,EAAE,GAAG,EAAE,CACpE,KAAK,CACH,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,EAC5B,IAAI,CAAC,IAAI,CAAC,CACX,CAAC,CAAC;AAEL,IAAI,CAAC,yDAAyD,EAAE,GAAG,EAAE,CACnE,KAAK,CACH,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,EAC5B,IAAI,CAAC,IAAI,CAAC,CACX,CAAC,CAAC;AAEL,IAAI,CAAC,kEAAkE,EAAE,GAAG,EAAE,CAC5E,KAAK,CACH,YAAY,CAAC,KAAK,EAAE,eAAe,CAAC,EACpC,IAAI,CAAC,KAAK,CAAC,CACZ,CAAC,CAAC;AAEL,IAAI,CAAC,yDAAyD,EAAE,GAAG,EAAE,CACnE,GAAG,CAAC;IACF,KAAK,CACH,YAAY,CAAC,KAAK,EAAE,gBAAgB,CAAC,EACrC,IAAI,CAAC,IAAI,CAAC,CACX;IACD,KAAK,CACH,YAAY,CAAC,KAAK,EAAE,eAAe,CAAC,EACpC,IAAI,CAAC,IAAI,CAAC,CACX;CACF,CAAC,CAAC,CAAC;AAEN,IAAI,CAAC,oDAAoD,EAAE,GAAG,EAAE,CAC9D,GAAG,CAAC;IACF,KAAK,CACH,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EACrC,IAAI,CAAC,IAAI,CAAC,CACX;CACF,CAAC,CAAC,CAAC"}
@@ -1,136 +0,0 @@
1
- /**
2
- * The output module formats. `"es"` → ESM, `"cjs"` →
3
- * CommonJS — both emitted today by every library
4
- * package.
5
- */
6
- export type Format = "es" | "cjs";
7
- /**
8
- * What kind of artifact a config builds.
9
- * - `"library"` (default): a consumed package — dual
10
- * `es`/`cjs` per entry, a per-file `.d.ts` tree, and
11
- * sibling/`node:*` deps left EXTERNAL (ruling B), so the
12
- * bundle stays faithful to its declared dependencies.
13
- * - `"app"`: the leaf application (the `example` client) —
14
- * a single self-contained `es` bundle with every
15
- * workspace sibling INLINED from source (the mirror of
16
- * the library decision: the app is where bundling deps
17
- * is correct, since a browser cannot resolve a bare
18
- * `import "plgg"`). No `.d.ts` (nothing consumes it) and
19
- * only `node:*` stays external.
20
- */
21
- export type Target = "library" | "app";
22
- /**
23
- * A way to decide whether an imported specifier is
24
- * *external* (left as a runtime `import`/`require`,
25
- * not inlined into the bundle). Mirrors the three
26
- * shapes used across the vite configs:
27
- * - a string array of exact specifiers,
28
- * - a `RegExp` (e.g. `/^node:/`),
29
- * - a predicate function (plgg-fetch's
30
- * `isFrameworkDep`).
31
- */
32
- export type External = ReadonlyArray<string> | RegExp | ((specifier: string) => boolean);
33
- /**
34
- * One build entry. `name` is the output key — for most
35
- * packages it equals the file stem, but `plgg-view`'s
36
- * `styleEntry` / `plgg-server`'s `ssgEntry` use a
37
- * distinct output key so `dist/styleEntry.*` does not
38
- * case-collide with the `dist/Style/` declaration tree
39
- * on case-insensitive filesystems (the U0 fix). The
40
- * emitted JS file is `name` run through the config's
41
- * `fileNamePattern`.
42
- */
43
- export type Entry = {
44
- name: string;
45
- input: string;
46
- };
47
- /**
48
- * The optional `dev` section: everything `plgg-bundle dev`
49
- * needs to serve + hot-reload an app. Absent for a plain
50
- * library config (build-only), so existing configs need no
51
- * change.
52
- *
53
- * - `entry` — the app's dev-entry module (absolute or
54
- * `root`-relative), default-exporting a `FetchFactory`.
55
- * - `port` — the port the node:http server binds.
56
- * - `watch` — source roots (absolute or `root`-relative)
57
- * watched for code/content edits.
58
- * - `allowedHosts` — extra `Host` headers accepted beyond
59
- * loopback (e.g. a tunnel domain).
60
- * - `sourceAliases` — cross-package self-aliases to resolve
61
- * to SOURCE during dev, so a dependency's `<prefix>/*`
62
- * imports (e.g. a theme package's) load from its `.ts`
63
- * and hot-reload, instead of its built dist. Empty for a
64
- * self-contained app.
65
- */
66
- export type DevConfig = Readonly<{
67
- entry: string;
68
- port: number;
69
- watch: ReadonlyArray<string>;
70
- allowedHosts: ReadonlyArray<string>;
71
- sourceAliases: ReadonlyArray<SourceAlias>;
72
- }>;
73
- /**
74
- * A dev-time source resolution rule: resolve `<prefix>`
75
- * and `<prefix>/<sub>` specifiers to `<srcDir>` /
76
- * `<srcDir>/<sub>` (`.ts`/`/index.ts`), so a dependency
77
- * package's source participates in hot-reload.
78
- */
79
- export type SourceAlias = Readonly<{
80
- prefix: string;
81
- srcDir: string;
82
- }>;
83
- /**
84
- * The bundler's typed configuration, replacing
85
- * vite.config's `lib` + `rollupOptions`. Parsed and
86
- * validated at the `unknown` boundary by
87
- * `asBundleConfig` before any build runs.
88
- */
89
- export type BundleConfig = Readonly<{
90
- /**
91
- * The artifact kind (see {@link Target}). Optional in
92
- * the config file; defaults to `"library"`.
93
- */
94
- target: Target;
95
- /** Package root (absolute). */
96
- root: string;
97
- /** Source root under `root` (e.g. "src"). */
98
- rootDir: string;
99
- /** Output dir under `root` (e.g. "dist"). */
100
- outDir: string;
101
- /** One entry (single-entry) or several (multi). */
102
- entries: ReadonlyArray<Entry>;
103
- /** Formats to emit (es and/or cjs). */
104
- formats: ReadonlyArray<Format>;
105
- /**
106
- * Output file-name template with `[name]` and
107
- * `[format]` placeholders, e.g.
108
- * `"[name].[format].js"` → `index.es.js` /
109
- * `index.cjs.js` for the `index` entry,
110
- * `styleEntry.es.js` for `styleEntry`. Reproduces
111
- * vite's `index.${format}.js` / `${name}.${format}.js`.
112
- */
113
- fileNamePattern: string;
114
- /**
115
- * The package self-alias prefix and its source root,
116
- * e.g. `{ prefix: "plgg", srcRoot: "src" }` so
117
- * `plgg/Atomics/Num` resolves to `src/Atomics/Num`.
118
- */
119
- alias: Readonly<{
120
- prefix: string;
121
- srcRoot: string;
122
- }>;
123
- /**
124
- * The dev-server section. Present only for a config that
125
- * `plgg-bundle dev` serves; a build-only library omits
126
- * it. See {@link DevConfig}.
127
- */
128
- dev?: DevConfig;
129
- }>;
130
- /**
131
- * Apply a {@link BundleConfig#fileNamePattern} to an
132
- * entry name and format, substituting `[name]` and
133
- * `[format]`. Pure string templating.
134
- */
135
- export declare const applyFileName: (pattern: string, name: string, format: Format) => string;
136
- //# sourceMappingURL=BundleConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BundleConfig.d.ts","sourceRoot":"","sources":["../../../src/domain/model/BundleConfig.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,KA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E,QAAQ,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH;;;;OAIG;IACH,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,CAAC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACxB,SAAS,MAAM,EACf,MAAM,MAAM,EACZ,QAAQ,MAAM,KACb,MAKc,CAAC"}
@@ -1,18 +0,0 @@
1
- // Plain-TS build tool: a foundation bundler must not
2
- // depend on the library it builds (plgg), so this
3
- // package is written in plain TypeScript — native
4
- // control flow, throw-on-failure caught at the bin
5
- // boundary — rather than plgg's Result/Option idiom.
6
- // See README. The CLAUDE.md no-`as`/`any`/`ts-ignore`
7
- // rule still holds.
8
- /**
9
- * Apply a {@link BundleConfig#fileNamePattern} to an
10
- * entry name and format, substituting `[name]` and
11
- * `[format]`. Pure string templating.
12
- */
13
- export const applyFileName = (pattern, name, format) => pattern
14
- .split("[name]")
15
- .join(name)
16
- .split("[format]")
17
- .join(format);
18
- //# sourceMappingURL=BundleConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BundleConfig.js","sourceRoot":"","sources":["../../../src/domain/model/BundleConfig.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,kDAAkD;AAClD,kDAAkD;AAClD,mDAAmD;AACnD,qDAAqD;AACrD,sDAAsD;AACtD,oBAAoB;AA6IpB;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,OAAe,EACf,IAAY,EACZ,MAAc,EACN,EAAE,CACV,OAAO;KACJ,KAAK,CAAC,QAAQ,CAAC;KACf,IAAI,CAAC,IAAI,CAAC;KACV,KAAK,CAAC,UAAU,CAAC;KACjB,IAAI,CAAC,MAAM,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=BundleConfig.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BundleConfig.spec.d.ts","sourceRoot":"","sources":["../../../src/domain/model/BundleConfig.spec.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import { test, check, all, toBe, } from "plgg-test";
2
- import { applyFileName } from "plgg-bundle/domain/model/BundleConfig";
3
- test("applyFileName substitutes name and format", () => all([
4
- check(applyFileName("[name].[format].js", "index", "es"), toBe("index.es.js")),
5
- check(applyFileName("[name].[format].js", "index", "cjs"), toBe("index.cjs.js")),
6
- check(applyFileName("[name].[format].js", "styleEntry", "es"), toBe("styleEntry.es.js")),
7
- ]));
8
- //# sourceMappingURL=BundleConfig.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BundleConfig.spec.js","sourceRoot":"","sources":["../../../src/domain/model/BundleConfig.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,IAAI,GACL,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE,CACrD,GAAG,CAAC;IACF,KAAK,CACH,aAAa,CACX,oBAAoB,EACpB,OAAO,EACP,IAAI,CACL,EACD,IAAI,CAAC,aAAa,CAAC,CACpB;IACD,KAAK,CACH,aAAa,CACX,oBAAoB,EACpB,OAAO,EACP,KAAK,CACN,EACD,IAAI,CAAC,cAAc,CAAC,CACrB;IACD,KAAK,CACH,aAAa,CACX,oBAAoB,EACpB,YAAY,EACZ,IAAI,CACL,EACD,IAAI,CAAC,kBAAkB,CAAC,CACzB;CACF,CAAC,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { type BundleConfig } from "plgg-bundle/domain/model/BundleConfig";
2
- /**
3
- * Validate an `unknown` value (a dynamically-imported
4
- * config module's default export) into a typed
5
- * {@link BundleConfig}. The config is the bundler's
6
- * `unknown` boundary, so every field is narrowed with a
7
- * real guard (`typeof`, `Array.isArray`) — no `as`, no
8
- * `any`. Throws a `ConfigError` on the first invalid
9
- * field.
10
- *
11
- * Externals are NOT a config field: the bundler derives
12
- * them from the package's `package.json` dependency
13
- * graph (see `deriveExternal`), so they cannot drift
14
- * from the manifest.
15
- */
16
- export declare const asBundleConfig: (value: unknown) => BundleConfig;
17
- //# sourceMappingURL=asBundleConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asBundleConfig.d.ts","sourceRoot":"","sources":["../../../src/domain/usecase/asBundleConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAMlB,MAAM,uCAAuC,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,OAAO,KACb,YAwBF,CAAC"}