wp-typia 0.19.0 → 0.20.1

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 (43) hide show
  1. package/README.md +4 -2
  2. package/dist-bunli/.bunli/commands.gen.js +2117 -1465
  3. package/dist-bunli/.bunli/commands.gen.js.map +42 -35
  4. package/dist-bunli/cli-03j0axbt.js +163 -0
  5. package/dist-bunli/cli-03j0axbt.js.map +11 -0
  6. package/dist-bunli/{cli-yw0mq0wq.js → cli-93wd227r.js} +108 -3
  7. package/dist-bunli/cli-93wd227r.js.map +10 -0
  8. package/dist-bunli/{cli-kan7a6db.js → cli-a6dwqnhq.js} +24 -2
  9. package/dist-bunli/cli-a6dwqnhq.js.map +11 -0
  10. package/dist-bunli/{cli-add-j2c81sh1.js → cli-add-gcwww85p.js} +263 -250
  11. package/dist-bunli/cli-add-gcwww85p.js.map +18 -0
  12. package/dist-bunli/{cli-7svz19s1.js → cli-cfx3gm1r.js} +417 -129
  13. package/dist-bunli/{cli-7svz19s1.js.map → cli-cfx3gm1r.js.map} +18 -15
  14. package/dist-bunli/{cli-diagnostics-c65hhyhx.js → cli-diagnostics-e5gxeprp.js} +8 -4
  15. package/dist-bunli/{cli-diagnostics-c65hhyhx.js.map → cli-diagnostics-e5gxeprp.js.map} +1 -1
  16. package/dist-bunli/{cli-doctor-hft0wr0e.js → cli-doctor-qk6fwpds.js} +14 -13
  17. package/dist-bunli/{cli-doctor-hft0wr0e.js.map → cli-doctor-qk6fwpds.js.map} +3 -3
  18. package/dist-bunli/{cli-572d6g4m.js → cli-hv2yedw2.js} +2 -157
  19. package/dist-bunli/{cli-572d6g4m.js.map → cli-hv2yedw2.js.map} +4 -6
  20. package/dist-bunli/cli-mgh3f3k5.js +427 -0
  21. package/dist-bunli/cli-mgh3f3k5.js.map +12 -0
  22. package/dist-bunli/{cli-scaffold-vcg6wem5.js → cli-scaffold-f1bdt68d.js} +9 -7
  23. package/dist-bunli/cli-scaffold-f1bdt68d.js.map +10 -0
  24. package/dist-bunli/cli-t73q5aqz.js +103 -0
  25. package/dist-bunli/cli-t73q5aqz.js.map +10 -0
  26. package/dist-bunli/{cli-templates-4qxszbmc.js → cli-templates-j65r4k9v.js} +1 -1
  27. package/dist-bunli/{cli-wtrvnce5.js → cli-w4r0rr8a.js} +8 -8
  28. package/dist-bunli/cli-w4r0rr8a.js.map +10 -0
  29. package/dist-bunli/cli.js +127 -2863
  30. package/dist-bunli/cli.js.map +5 -56
  31. package/dist-bunli/command-list-66cqt7y8.js +2485 -0
  32. package/dist-bunli/command-list-66cqt7y8.js.map +58 -0
  33. package/dist-bunli/node-cli.js +432 -323
  34. package/dist-bunli/node-cli.js.map +11 -10
  35. package/dist-bunli/{sync-x91y9jtv.js → sync-k2k8svyc.js} +3 -2
  36. package/dist-bunli/{sync-x91y9jtv.js.map → sync-k2k8svyc.js.map} +1 -1
  37. package/package.json +6 -3
  38. package/dist-bunli/cli-add-j2c81sh1.js.map +0 -16
  39. package/dist-bunli/cli-kan7a6db.js.map +0 -11
  40. package/dist-bunli/cli-scaffold-vcg6wem5.js.map +0 -10
  41. package/dist-bunli/cli-wtrvnce5.js.map +0 -10
  42. package/dist-bunli/cli-yw0mq0wq.js.map +0 -10
  43. /package/dist-bunli/{cli-templates-4qxszbmc.js.map → cli-templates-j65r4k9v.js.map} +0 -0
@@ -0,0 +1,103 @@
1
+ // @bun
2
+ // ../wp-typia-project-tools/src/runtime/temp-roots.ts
3
+ import fs from "fs";
4
+ import * as fsp from "fs/promises";
5
+ import os from "os";
6
+ import path from "path";
7
+ var WP_TYPIA_TEMP_ROOT_PREFIX = "wp-typia-";
8
+ var STALE_TEMP_ROOT_MAX_AGE_MS = 1000 * 60 * 60 * 24;
9
+ var trackedTempRoots = new Set;
10
+ var cleanupHandlersInstalled = false;
11
+ var staleCleanupRan = false;
12
+ var signalCleanupInProgress = false;
13
+ function getTempDir(tmpDir) {
14
+ return tmpDir ?? os.tmpdir();
15
+ }
16
+ function cleanupTrackedTempRootsSync() {
17
+ for (const tempRoot of [...trackedTempRoots]) {
18
+ trackedTempRoots.delete(tempRoot);
19
+ try {
20
+ fs.rmSync(tempRoot, { force: true, recursive: true });
21
+ } catch {}
22
+ }
23
+ }
24
+ function installCleanupHandlers() {
25
+ if (cleanupHandlersInstalled) {
26
+ return;
27
+ }
28
+ cleanupHandlersInstalled = true;
29
+ process.on("exit", cleanupTrackedTempRootsSync);
30
+ for (const [signal, exitCode] of [
31
+ ["SIGHUP", 129],
32
+ ["SIGINT", 130],
33
+ ["SIGTERM", 143]
34
+ ]) {
35
+ process.once(signal, () => {
36
+ if (signalCleanupInProgress) {
37
+ return;
38
+ }
39
+ signalCleanupInProgress = true;
40
+ cleanupTrackedTempRootsSync();
41
+ process.exitCode = exitCode;
42
+ process.exit();
43
+ });
44
+ }
45
+ }
46
+ async function cleanupManagedTempRoot(tempRoot) {
47
+ trackedTempRoots.delete(tempRoot);
48
+ await fsp.rm(tempRoot, { force: true, recursive: true });
49
+ }
50
+ async function cleanupStaleTempRoots({
51
+ maxAgeMs = STALE_TEMP_ROOT_MAX_AGE_MS,
52
+ now = Date.now(),
53
+ tmpDir
54
+ } = {}) {
55
+ const resolvedTmpDir = getTempDir(tmpDir);
56
+ const removedRoots = [];
57
+ const entries = await fsp.readdir(resolvedTmpDir, { withFileTypes: true });
58
+ for (const entry of entries) {
59
+ if (!entry.isDirectory() || !entry.name.startsWith(WP_TYPIA_TEMP_ROOT_PREFIX)) {
60
+ continue;
61
+ }
62
+ const tempRoot = path.join(resolvedTmpDir, entry.name);
63
+ if (trackedTempRoots.has(tempRoot)) {
64
+ continue;
65
+ }
66
+ let stats;
67
+ try {
68
+ stats = await fsp.stat(tempRoot);
69
+ } catch {
70
+ continue;
71
+ }
72
+ if (now - stats.mtimeMs < maxAgeMs) {
73
+ continue;
74
+ }
75
+ try {
76
+ await fsp.rm(tempRoot, { force: true, recursive: true });
77
+ removedRoots.push(tempRoot);
78
+ } catch {
79
+ continue;
80
+ }
81
+ }
82
+ return removedRoots;
83
+ }
84
+ async function createManagedTempRoot(prefix, options = {}) {
85
+ if (!prefix.startsWith(WP_TYPIA_TEMP_ROOT_PREFIX)) {
86
+ throw new Error(`Managed wp-typia temp roots must use the "${WP_TYPIA_TEMP_ROOT_PREFIX}" prefix.`);
87
+ }
88
+ installCleanupHandlers();
89
+ if (!staleCleanupRan) {
90
+ staleCleanupRan = true;
91
+ await cleanupStaleTempRoots({ tmpDir: options.tmpDir });
92
+ }
93
+ const tempRoot = await fsp.mkdtemp(path.join(getTempDir(options.tmpDir), prefix));
94
+ trackedTempRoots.add(tempRoot);
95
+ return {
96
+ cleanup: async () => cleanupManagedTempRoot(tempRoot),
97
+ path: tempRoot
98
+ };
99
+ }
100
+
101
+ export { createManagedTempRoot };
102
+
103
+ //# debugId=2A7A0EBFD7CAC42664756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../wp-typia-project-tools/src/runtime/temp-roots.ts"],
4
+ "sourcesContent": [
5
+ "import fs from \"node:fs\";\nimport * as fsp from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/**\n * Required prefix for managed wp-typia temporary directories.\n */\nexport const WP_TYPIA_TEMP_ROOT_PREFIX = \"wp-typia-\";\n\n/**\n * Default age threshold for pruning stale wp-typia temp roots.\n */\nexport const STALE_TEMP_ROOT_MAX_AGE_MS = 1000 * 60 * 60 * 24;\n\nconst trackedTempRoots = new Set<string>();\n\nlet cleanupHandlersInstalled = false;\nlet staleCleanupRan = false;\nlet signalCleanupInProgress = false;\n\ntype TempRootOptions = {\n\tmaxAgeMs?: number;\n\tnow?: number;\n\ttmpDir?: string;\n};\n\nfunction getTempDir(tmpDir?: string): string {\n\treturn tmpDir ?? os.tmpdir();\n}\n\nfunction cleanupTrackedTempRootsSync(): void {\n\tfor (const tempRoot of [...trackedTempRoots]) {\n\t\ttrackedTempRoots.delete(tempRoot);\n\t\ttry {\n\t\t\tfs.rmSync(tempRoot, { force: true, recursive: true });\n\t\t} catch {}\n\t}\n}\n\nfunction installCleanupHandlers(): void {\n\tif (cleanupHandlersInstalled) {\n\t\treturn;\n\t}\n\n\tcleanupHandlersInstalled = true;\n\tprocess.on(\"exit\", cleanupTrackedTempRootsSync);\n\n\tfor (const [signal, exitCode] of [\n\t\t[\"SIGHUP\", 129],\n\t\t[\"SIGINT\", 130],\n\t\t[\"SIGTERM\", 143],\n\t] as const) {\n\t\tprocess.once(signal, () => {\n\t\t\tif (signalCleanupInProgress) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsignalCleanupInProgress = true;\n\t\t\tcleanupTrackedTempRootsSync();\n\t\t\tprocess.exitCode = exitCode;\n\t\t\tprocess.exit();\n\t\t});\n\t}\n}\n\n/**\n * Remove a managed temp root and stop tracking it for process-level cleanup.\n *\n * @param tempRoot Absolute temporary directory path to remove.\n */\nexport async function cleanupManagedTempRoot(tempRoot: string): Promise<void> {\n\ttrackedTempRoots.delete(tempRoot);\n\tawait fsp.rm(tempRoot, { force: true, recursive: true });\n}\n\n/**\n * Remove stale `wp-typia-*` temp directories from the target temp root.\n *\n * @param options Optional temp directory, age threshold, and clock override.\n * @returns Absolute temp-root paths removed during the cleanup pass.\n */\nexport async function cleanupStaleTempRoots({\n\tmaxAgeMs = STALE_TEMP_ROOT_MAX_AGE_MS,\n\tnow = Date.now(),\n\ttmpDir,\n}: TempRootOptions = {}): Promise<string[]> {\n\tconst resolvedTmpDir = getTempDir(tmpDir);\n\tconst removedRoots: string[] = [];\n\tconst entries = await fsp.readdir(resolvedTmpDir, { withFileTypes: true });\n\n\tfor (const entry of entries) {\n\t\tif (\n\t\t\t!entry.isDirectory() ||\n\t\t\t!entry.name.startsWith(WP_TYPIA_TEMP_ROOT_PREFIX)\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst tempRoot = path.join(resolvedTmpDir, entry.name);\n\t\tif (trackedTempRoots.has(tempRoot)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet stats;\n\t\ttry {\n\t\t\tstats = await fsp.stat(tempRoot);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (now - stats.mtimeMs < maxAgeMs) {\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tawait fsp.rm(tempRoot, { force: true, recursive: true });\n\t\t\tremovedRoots.push(tempRoot);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t}\n\n\treturn removedRoots;\n}\n\n/**\n * Create a managed wp-typia temp root and install process cleanup handlers.\n *\n * @param prefix Temp directory prefix. Must start with `wp-typia-`.\n * @param options Optional temp directory override.\n * @returns The created temp-root path plus an async cleanup helper.\n */\nexport async function createManagedTempRoot(\n\tprefix: string,\n\toptions: Pick<TempRootOptions, \"tmpDir\"> = {},\n): Promise<{\n\tcleanup: () => Promise<void>;\n\tpath: string;\n}> {\n\tif (!prefix.startsWith(WP_TYPIA_TEMP_ROOT_PREFIX)) {\n\t\tthrow new Error(\n\t\t\t`Managed wp-typia temp roots must use the \"${WP_TYPIA_TEMP_ROOT_PREFIX}\" prefix.`,\n\t\t);\n\t}\n\n\tinstallCleanupHandlers();\n\tif (!staleCleanupRan) {\n\t\tstaleCleanupRan = true;\n\t\tawait cleanupStaleTempRoots({ tmpDir: options.tmpDir });\n\t}\n\n\tconst tempRoot = await fsp.mkdtemp(\n\t\tpath.join(getTempDir(options.tmpDir), prefix),\n\t);\n\ttrackedTempRoots.add(tempRoot);\n\n\treturn {\n\t\tcleanup: async () => cleanupManagedTempRoot(tempRoot),\n\t\tpath: tempRoot,\n\t};\n}\n\n/**\n * Snapshot the currently tracked temp roots for diagnostics and tests.\n *\n * @returns Absolute paths for temp roots currently registered for cleanup.\n */\nexport function getTrackedTempRoots(): string[] {\n\treturn [...trackedTempRoots];\n}\n"
6
+ ],
7
+ "mappings": ";;AAAA;AACA;AACA;AACA;AAKO,IAAM,4BAA4B;AAKlC,IAAM,6BAA6B,OAA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2164756E21",
9
+ "names": []
10
+ }
@@ -5,7 +5,7 @@ import {
5
5
  getTemplateSelectOptions,
6
6
  isBuiltInTemplateId,
7
7
  listTemplates
8
- } from "./cli-kan7a6db.js";
8
+ } from "./cli-a6dwqnhq.js";
9
9
  import"./cli-xnn9xjcy.js";
10
10
 
11
11
  // ../wp-typia-project-tools/src/runtime/cli-templates.ts
@@ -8,11 +8,13 @@ import {
8
8
  SHARED_REST_HELPER_TEMPLATE_ROOT,
9
9
  SHARED_WORKSPACE_TEMPLATE_ROOT,
10
10
  getTemplateById
11
- } from "./cli-kan7a6db.js";
11
+ } from "./cli-a6dwqnhq.js";
12
+ import {
13
+ createManagedTempRoot
14
+ } from "./cli-t73q5aqz.js";
12
15
 
13
16
  // ../wp-typia-project-tools/src/runtime/template-builtins.ts
14
17
  import fs from "fs";
15
- import os from "os";
16
18
  import path from "path";
17
19
  import { promises as fsp } from "fs";
18
20
  var BUILT_IN_SHARED_TEMPLATE_LAYERS = Object.freeze([
@@ -148,7 +150,7 @@ function resolveMaterializedTemplateLayerDirs(templateId, layerDirs) {
148
150
  async function materializeBuiltInTemplateSource(templateId, layerDirs) {
149
151
  const template = getTemplateById(templateId);
150
152
  const materializedLayerDirs = resolveMaterializedTemplateLayerDirs(templateId, layerDirs);
151
- const tempRoot = await fsp.mkdtemp(path.join(os.tmpdir(), "wp-typia-template-"));
153
+ const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-template-");
152
154
  const templateDir = path.join(tempRoot, templateId);
153
155
  try {
154
156
  await fsp.mkdir(templateDir, { recursive: true });
@@ -159,7 +161,7 @@ async function materializeBuiltInTemplateSource(templateId, layerDirs) {
159
161
  });
160
162
  }
161
163
  } catch (error) {
162
- await fsp.rm(tempRoot, { force: true, recursive: true });
164
+ await cleanup();
163
165
  throw error;
164
166
  }
165
167
  return {
@@ -169,9 +171,7 @@ async function materializeBuiltInTemplateSource(templateId, layerDirs) {
169
171
  features: template.features,
170
172
  format: "wp-typia",
171
173
  templateDir,
172
- cleanup: async () => {
173
- await fsp.rm(tempRoot, { force: true, recursive: true });
174
- }
174
+ cleanup
175
175
  };
176
176
  }
177
177
  async function resolveBuiltInTemplateSourceFromLayerDirs(templateId, layerDirs) {
@@ -183,4 +183,4 @@ async function resolveBuiltInTemplateSource(templateId, options = {}) {
183
183
 
184
184
  export { isBuiltInSharedTemplateLayerId, getBuiltInSharedTemplateLayerDir, getBuiltInTemplateOverlayDir, getBuiltInTemplateSharedLayerDirs, getBuiltInTemplateLayerDirs, isOmittableBuiltInTemplateLayerDir, resolveBuiltInTemplateSourceFromLayerDirs, resolveBuiltInTemplateSource };
185
185
 
186
- //# debugId=D91CC684007ADD2464756E2164756E21
186
+ //# debugId=B05DD72780E5C06E64756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../wp-typia-project-tools/src/runtime/template-builtins.ts"],
4
+ "sourcesContent": [
5
+ "import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { promises as fsp } from \"node:fs\";\n\nimport { createManagedTempRoot } from \"./temp-roots.js\";\nimport {\n\tgetTemplateById,\n\tSHARED_BASE_TEMPLATE_ROOT,\n\tSHARED_COMPOUND_TEMPLATE_ROOT,\n\tSHARED_MIGRATION_UI_TEMPLATE_ROOT,\n\tSHARED_PERSISTENCE_TEMPLATE_ROOT,\n\tSHARED_PRESET_TEMPLATE_ROOT,\n\tSHARED_REST_HELPER_TEMPLATE_ROOT,\n\tSHARED_WORKSPACE_TEMPLATE_ROOT,\n\ttype BuiltInTemplateId,\n} from \"./template-registry.js\";\n\n/**\n * Controls which persistence layer is applied when materializing the built-in\n * `persistence` template.\n */\nexport type BuiltInPersistencePolicy = \"authenticated\" | \"public\";\n\nexport interface BuiltInTemplateVariantOptions {\n\tpersistenceEnabled?: boolean;\n\tpersistencePolicy?: BuiltInPersistencePolicy;\n}\n\nexport interface MaterializedBuiltInTemplateSource {\n\tid: BuiltInTemplateId;\n\tdefaultCategory: string;\n\tdescription: string;\n\tfeatures: string[];\n\tformat: \"wp-typia\";\n\ttemplateDir: string;\n\tcleanup?: () => Promise<void>;\n\tselectedVariant?: string | null;\n\twarnings?: string[];\n}\n\nexport interface BuiltInSharedTemplateLayer {\n\tdir: string;\n\tid: string;\n}\n\nconst BUILT_IN_SHARED_TEMPLATE_LAYERS = Object.freeze<BuiltInSharedTemplateLayer[]>([\n\t{\n\t\tdir: SHARED_BASE_TEMPLATE_ROOT,\n\t\tid: \"builtin:shared/base\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_REST_HELPER_TEMPLATE_ROOT, \"shared\"),\n\t\tid: \"builtin:shared/rest-helpers/shared\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_REST_HELPER_TEMPLATE_ROOT, \"public\"),\n\t\tid: \"builtin:shared/rest-helpers/public\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_REST_HELPER_TEMPLATE_ROOT, \"auth\"),\n\t\tid: \"builtin:shared/rest-helpers/auth\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_PERSISTENCE_TEMPLATE_ROOT, \"core\"),\n\t\tid: \"builtin:shared/persistence/core\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_PERSISTENCE_TEMPLATE_ROOT, \"public\"),\n\t\tid: \"builtin:shared/persistence/public\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_PERSISTENCE_TEMPLATE_ROOT, \"auth\"),\n\t\tid: \"builtin:shared/persistence/auth\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_COMPOUND_TEMPLATE_ROOT, \"core\"),\n\t\tid: \"builtin:shared/compound/core\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_COMPOUND_TEMPLATE_ROOT, \"persistence\"),\n\t\tid: \"builtin:shared/compound/persistence\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_COMPOUND_TEMPLATE_ROOT, \"persistence-public\"),\n\t\tid: \"builtin:shared/compound/persistence-public\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_COMPOUND_TEMPLATE_ROOT, \"persistence-auth\"),\n\t\tid: \"builtin:shared/compound/persistence-auth\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_MIGRATION_UI_TEMPLATE_ROOT, \"common\"),\n\t\tid: \"builtin:shared/migration-ui/common\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_PRESET_TEMPLATE_ROOT, \"wp-env\"),\n\t\tid: \"builtin:shared/presets/wp-env\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_PRESET_TEMPLATE_ROOT, \"test-preset\"),\n\t\tid: \"builtin:shared/presets/test-preset\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_WORKSPACE_TEMPLATE_ROOT, \"persistence-public\"),\n\t\tid: \"builtin:shared/workspace/persistence-public\",\n\t},\n\t{\n\t\tdir: path.join(SHARED_WORKSPACE_TEMPLATE_ROOT, \"persistence-auth\"),\n\t\tid: \"builtin:shared/workspace/persistence-auth\",\n\t},\n]);\n\nconst BUILT_IN_SHARED_TEMPLATE_LAYER_DIRS = new Map(\n\tBUILT_IN_SHARED_TEMPLATE_LAYERS.map((layer) => [layer.id, layer.dir] as const),\n);\n\nconst OMITTABLE_BUILT_IN_OVERLAY_TEMPLATE_IDS = new Set<BuiltInTemplateId>([\n\t\"basic\",\n\t\"persistence\",\n\t\"compound\",\n]);\n\nexport function listBuiltInSharedTemplateLayers(): readonly BuiltInSharedTemplateLayer[] {\n\treturn BUILT_IN_SHARED_TEMPLATE_LAYERS;\n}\n\nexport function isBuiltInSharedTemplateLayerId(layerId: string): boolean {\n\treturn BUILT_IN_SHARED_TEMPLATE_LAYER_DIRS.has(layerId);\n}\n\nexport function getBuiltInSharedTemplateLayerDir(layerId: string): string {\n\tconst layerDir = BUILT_IN_SHARED_TEMPLATE_LAYER_DIRS.get(layerId);\n\tif (!layerDir) {\n\t\tthrow new Error(`Unknown built-in shared template layer id: ${layerId}`);\n\t}\n\treturn layerDir;\n}\n\nexport function getBuiltInTemplateOverlayDir(templateId: BuiltInTemplateId): string {\n\treturn getTemplateById(templateId).templateDir;\n}\n\nexport function getBuiltInTemplateSharedLayerDirs(\n\ttemplateId: BuiltInTemplateId,\n\t{\n\t\tpersistenceEnabled = false,\n\t\tpersistencePolicy = \"authenticated\",\n\t}: BuiltInTemplateVariantOptions = {},\n): string[] {\n\tif (templateId === \"persistence\") {\n\t\treturn [\n\t\t\tSHARED_BASE_TEMPLATE_ROOT,\n\t\t\tpath.join(SHARED_REST_HELPER_TEMPLATE_ROOT, \"shared\"),\n\t\t\tpath.join(SHARED_PERSISTENCE_TEMPLATE_ROOT, \"core\"),\n\t\t\tpath.join(\n\t\t\t\tSHARED_REST_HELPER_TEMPLATE_ROOT,\n\t\t\t\tpersistencePolicy === \"public\" ? \"public\" : \"auth\",\n\t\t\t),\n\t\t\tpath.join(\n\t\t\t\tSHARED_PERSISTENCE_TEMPLATE_ROOT,\n\t\t\t\tpersistencePolicy === \"public\" ? \"public\" : \"auth\",\n\t\t\t),\n\t\t];\n\t}\n\n\tif (templateId === \"compound\") {\n\t\tconst layers = [\n\t\t\tSHARED_BASE_TEMPLATE_ROOT,\n\t\t\tpath.join(SHARED_COMPOUND_TEMPLATE_ROOT, \"core\"),\n\t\t];\n\n\t\tif (persistenceEnabled) {\n\t\t\tlayers.push(\n\t\t\t\tpath.join(SHARED_REST_HELPER_TEMPLATE_ROOT, \"shared\"),\n\t\t\t\tpath.join(SHARED_COMPOUND_TEMPLATE_ROOT, \"persistence\"),\n\t\t\t\tpath.join(\n\t\t\t\t\tSHARED_REST_HELPER_TEMPLATE_ROOT,\n\t\t\t\t\tpersistencePolicy === \"public\" ? \"public\" : \"auth\",\n\t\t\t\t),\n\t\t\t\tpath.join(\n\t\t\t\t\tSHARED_COMPOUND_TEMPLATE_ROOT,\n\t\t\t\t\tpersistencePolicy === \"public\" ? \"persistence-public\" : \"persistence-auth\",\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\treturn layers;\n\t}\n\n\treturn [SHARED_BASE_TEMPLATE_ROOT];\n}\n\n/**\n * Returns the ordered overlay directories for a built-in template.\n *\n * Persistence templates include the shared base, the persistence core layer,\n * the selected policy layer, and the thin template overlay. All other built-ins\n * resolve to the shared base plus their own template directory.\n */\nexport function getBuiltInTemplateLayerDirs(\n\ttemplateId: BuiltInTemplateId,\n\toptions: BuiltInTemplateVariantOptions = {},\n): string[] {\n\treturn [\n\t\t...getBuiltInTemplateSharedLayerDirs(templateId, options),\n\t\tgetBuiltInTemplateOverlayDir(templateId),\n\t];\n}\n\n/**\n * Returns whether a missing built-in overlay directory is expected because the\n * template family no longer ships any Mustache assets in that layer.\n *\n * @param templateId Built-in template family being resolved.\n * @param layerDir Candidate overlay directory for that family.\n * @returns True when the missing layer can be skipped safely.\n */\nexport function isOmittableBuiltInTemplateLayerDir(\n\ttemplateId: BuiltInTemplateId,\n\tlayerDir: string,\n): boolean {\n\treturn (\n\t\tOMITTABLE_BUILT_IN_OVERLAY_TEMPLATE_IDS.has(templateId) &&\n\t\tlayerDir === getTemplateById(templateId).templateDir\n\t);\n}\n\nfunction resolveMaterializedTemplateLayerDirs(\n\ttemplateId: BuiltInTemplateId,\n\tlayerDirs: readonly string[],\n): string[] {\n\treturn layerDirs.flatMap((layerDir) => {\n\t\tif (fs.existsSync(layerDir)) {\n\t\t\treturn [layerDir];\n\t\t}\n\n\t\tif (isOmittableBuiltInTemplateLayerDir(templateId, layerDir)) {\n\t\t\treturn [];\n\t\t}\n\n\t\tthrow new Error(`Built-in template layer is missing: ${layerDir}`);\n\t});\n}\n\nasync function materializeBuiltInTemplateSource(\n\ttemplateId: BuiltInTemplateId,\n\tlayerDirs: readonly string[],\n): Promise<MaterializedBuiltInTemplateSource> {\n\tconst template = getTemplateById(templateId);\n\tconst materializedLayerDirs = resolveMaterializedTemplateLayerDirs(\n\t\ttemplateId,\n\t\tlayerDirs,\n\t);\n\tconst { path: tempRoot, cleanup } = await createManagedTempRoot(\n\t\t\"wp-typia-template-\",\n\t);\n\tconst templateDir = path.join(tempRoot, templateId);\n\n\ttry {\n\t\tawait fsp.mkdir(templateDir, { recursive: true });\n\n\t\tfor (const layerDir of materializedLayerDirs) {\n\t\t\tawait fsp.cp(layerDir, templateDir, {\n\t\t\t\trecursive: true,\n\t\t\t\tforce: true,\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tawait cleanup();\n\t\tthrow error;\n\t}\n\n\treturn {\n\t\tid: templateId,\n\t\tdefaultCategory: template.defaultCategory,\n\t\tdescription: template.description,\n\t\tfeatures: template.features,\n\t\tformat: \"wp-typia\",\n\t\ttemplateDir,\n\t\tcleanup,\n\t};\n}\n\nexport async function resolveBuiltInTemplateSourceFromLayerDirs(\n\ttemplateId: BuiltInTemplateId,\n\tlayerDirs: readonly string[],\n): Promise<MaterializedBuiltInTemplateSource> {\n\treturn materializeBuiltInTemplateSource(templateId, layerDirs);\n}\n\n/**\n * Materializes a built-in template into a temporary directory by copying each\n * resolved layer in order.\n *\n * Callers should invoke the returned `cleanup` function when they no longer\n * need the materialized directory. If copying fails, the temporary directory is\n * removed before the error is rethrown.\n */\nexport async function resolveBuiltInTemplateSource(\n\ttemplateId: BuiltInTemplateId,\n\toptions: BuiltInTemplateVariantOptions = {},\n): Promise<MaterializedBuiltInTemplateSource> {\n\treturn materializeBuiltInTemplateSource(\n\t\ttemplateId,\n\t\tgetBuiltInTemplateLayerDirs(templateId, options),\n\t);\n}\n"
6
+ ],
7
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AACA;AACA,qBAAS;AA2CT,IAAM,kCAAkC,OAAO,OAAqC;AAAA,EACnF;AAAA,IACC,KAAK;AAAA,IACL,IAAI;AAAA,EACL;AAAA,EACA;AAAA,IACC,KAAK,KAAK,KAAK,kCAAkC,QAAQ;AAAA,IACzD,IAAI;AAAA,EACL;AAAA,EACA;AAAA,IACC,KAAK,KAAK,KAAK,kCAAkC,QAAQ;AAAA,IACzD,IAAI;AAAA,EACL;AAAA,EACA;AAAA,IACC,KAAK,KAAK,KAAK,kCAAkC,MAA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