@i18nprune/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +165 -0
  3. package/dist/adapters-gp1lXp0T.d.ts +12 -0
  4. package/dist/capabilities-x74cD2Hu.d.ts +48 -0
  5. package/dist/cleanup.d.ts +64 -0
  6. package/dist/cleanup.js +3999 -0
  7. package/dist/config.d.ts +201 -0
  8. package/dist/config.js +2865 -0
  9. package/dist/coreContext-DMaWLvmB.d.ts +388 -0
  10. package/dist/fs-BUYD8ZhA.d.ts +20 -0
  11. package/dist/generate.d.ts +487 -0
  12. package/dist/generate.js +9389 -0
  13. package/dist/humanEmit-ygNlYX-S.d.ts +79 -0
  14. package/dist/index-BQuLEQ9b.d.ts +7 -0
  15. package/dist/index-B_ow_Xvr.d.ts +97 -0
  16. package/dist/index-BgG01AKL.d.ts +287 -0
  17. package/dist/index-CIzZl4W8.d.ts +124 -0
  18. package/dist/index-Csm1w7XD.d.ts +58 -0
  19. package/dist/index-DLwTogCo.d.ts +43 -0
  20. package/dist/index-DVT26v11.d.ts +61 -0
  21. package/dist/index-DdjljwMj.d.ts +39 -0
  22. package/dist/index-DeIw-cZd.d.ts +52 -0
  23. package/dist/index-X50E1FIX.d.ts +50 -0
  24. package/dist/index.d.ts +9180 -0
  25. package/dist/index.js +21888 -0
  26. package/dist/init.d.ts +86 -0
  27. package/dist/init.js +848 -0
  28. package/dist/listWindow-XEFxQZi1.d.ts +30 -0
  29. package/dist/localeTargetCodes-BBIQjauw.d.ts +11 -0
  30. package/dist/locales.d.ts +39 -0
  31. package/dist/locales.js +2288 -0
  32. package/dist/missing-BVCvgUC8.d.ts +10 -0
  33. package/dist/missing.d.ts +85 -0
  34. package/dist/missing.js +5892 -0
  35. package/dist/modeResolve-cGVaY5Hh.d.ts +25 -0
  36. package/dist/path-Bfn3SAts.d.ts +11 -0
  37. package/dist/profile-BwOP9WKh.d.ts +9 -0
  38. package/dist/providers-0uMEfT6q.d.ts +82 -0
  39. package/dist/prune-c6hKZCv_.d.ts +33 -0
  40. package/dist/quality.d.ts +36 -0
  41. package/dist/quality.js +3868 -0
  42. package/dist/report-D5-6bVFj.d.ts +8 -0
  43. package/dist/report-schema.d.ts +102 -0
  44. package/dist/report-schema.js +42 -0
  45. package/dist/resumeCandidates-xR13eEwt.d.ts +200 -0
  46. package/dist/root-2-kCaBvQ.d.ts +1110 -0
  47. package/dist/runtime/edge.d.ts +21 -0
  48. package/dist/runtime/edge.js +87 -0
  49. package/dist/runtime/helpers/sync.d.ts +16 -0
  50. package/dist/runtime/helpers/sync.js +117 -0
  51. package/dist/runtime/node.d.ts +24 -0
  52. package/dist/runtime/node.js +204 -0
  53. package/dist/runtime/web.d.ts +21 -0
  54. package/dist/runtime/web.js +84 -0
  55. package/dist/shared.d.ts +1177 -0
  56. package/dist/shared.js +4897 -0
  57. package/dist/sourceContext-1LQg3HiQ.d.ts +36 -0
  58. package/dist/sourceSurface-mDtwGo1E.d.ts +122 -0
  59. package/dist/sync.d.ts +86 -0
  60. package/dist/sync.js +4971 -0
  61. package/dist/syncSegment-Bx6He2Mu.d.ts +149 -0
  62. package/dist/targets-EmtKyr6F.d.ts +23 -0
  63. package/dist/template-CGM-_WLT.d.ts +139 -0
  64. package/dist/translate-CIHYp7wi.d.ts +77 -0
  65. package/dist/types/shared.d.ts +21 -0
  66. package/dist/types/shared.js +1 -0
  67. package/dist/types.d.ts +1345 -0
  68. package/dist/types.js +1 -0
  69. package/dist/validate.d.ts +126 -0
  70. package/dist/validate.js +3717 -0
  71. package/package.json +128 -0
@@ -0,0 +1,21 @@
1
+ import { b as RuntimeReadFsPort, R as RuntimeFsPort } from '../fs-BUYD8ZhA.js';
2
+ import { R as RuntimeAdapters } from '../adapters-gp1lXp0T.js';
3
+ import { a as RuntimeSystemPort } from '../capabilities-x74cD2Hu.js';
4
+ import { R as RuntimePathPort } from '../path-Bfn3SAts.js';
5
+
6
+ declare function createEdgeRuntimeAdapters(input: {
7
+ fs: RuntimeReadFsPort & Partial<RuntimeFsPort>;
8
+ cwd?: string;
9
+ now?: () => number;
10
+ }): RuntimeAdapters;
11
+
12
+ declare function createEdgeSystemRuntime(input?: {
13
+ cwd?: string;
14
+ now?: () => number;
15
+ }): RuntimeSystemPort;
16
+
17
+ declare const edgePathRuntime: RuntimePathPort;
18
+
19
+ declare function createEdgeReadFsRuntime(input: RuntimeReadFsPort & Partial<RuntimeFsPort>): RuntimeFsPort;
20
+
21
+ export { createEdgeReadFsRuntime, createEdgeRuntimeAdapters, createEdgeSystemRuntime, edgePathRuntime };
@@ -0,0 +1,87 @@
1
+ // src/runtime/edge/system.ts
2
+ function createEdgeSystemRuntime(input) {
3
+ return {
4
+ cwd: () => input?.cwd ?? "/",
5
+ now: () => input?.now ? input.now() : Date.now()
6
+ };
7
+ }
8
+
9
+ // src/runtime/web/path.ts
10
+ function split(value) {
11
+ return value.replace(/\\/g, "/").split("/").filter((s) => s.length > 0);
12
+ }
13
+ var webPathRuntime = {
14
+ join: (...parts) => parts.join("/").replace(/\/+/g, "/"),
15
+ dirname: (value) => {
16
+ const parts = split(value);
17
+ return parts.length <= 1 ? "/" : `/${parts.slice(0, -1).join("/")}`;
18
+ },
19
+ basename: (value, ext) => {
20
+ const parts = split(value);
21
+ const base = parts[parts.length - 1] ?? "";
22
+ return ext && base.endsWith(ext) ? base.slice(0, -ext.length) : base;
23
+ },
24
+ normalize: (value) => value.replace(/\\/g, "/").replace(/\/+/g, "/"),
25
+ relative: (_from, to) => to,
26
+ resolve: (...parts) => webPathRuntime.normalize(parts.join("/")),
27
+ isAbsolute: (value) => value.startsWith("/")
28
+ };
29
+
30
+ // src/runtime/edge/path.ts
31
+ var edgePathRuntime = webPathRuntime;
32
+
33
+ // src/shared/errors/internal.ts
34
+ var I18nPruneError = class extends Error {
35
+ code;
36
+ issueCode;
37
+ constructor(message, code, options) {
38
+ super(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);
39
+ this.name = "I18nPruneError";
40
+ this.code = code;
41
+ this.issueCode = options?.issueCode;
42
+ }
43
+ };
44
+
45
+ // src/runtime/edge/fs.ts
46
+ function createEdgeReadFsRuntime(input) {
47
+ return {
48
+ exists: input.exists,
49
+ readText: input.readText,
50
+ statKind: input.statKind ?? ((filePath) => input.exists(filePath) ? "other" : "missing"),
51
+ listDir: input.listDir ?? (() => []),
52
+ writeText: input.writeText ?? (() => {
53
+ throw new I18nPruneError("Edge runtime fs.writeText is not available for this host adapter", "USAGE");
54
+ }),
55
+ deleteFile: input.deleteFile ?? (() => {
56
+ throw new I18nPruneError("Edge runtime fs.deleteFile is not available for this host adapter", "USAGE");
57
+ }),
58
+ mkdirp: input.mkdirp ?? (() => {
59
+ throw new I18nPruneError("Edge runtime fs.mkdirp is not available for this host adapter", "USAGE");
60
+ })
61
+ };
62
+ }
63
+
64
+ // src/runtime/shared/network.ts
65
+ function createAmbientNetworkPort() {
66
+ return {
67
+ fetch: globalThis.fetch.bind(globalThis)
68
+ };
69
+ }
70
+
71
+ // src/runtime/edge/index.ts
72
+ function createRuntimeAdapters(input) {
73
+ return {
74
+ kind: "edge",
75
+ system: createEdgeSystemRuntime({ cwd: input.cwd, now: input.now }),
76
+ path: edgePathRuntime,
77
+ fs: createEdgeReadFsRuntime(input.fs),
78
+ network: createAmbientNetworkPort()
79
+ };
80
+ }
81
+
82
+ // src/runtime/factory/adapters.edge.ts
83
+ function createEdgeRuntimeAdapters(input) {
84
+ return createRuntimeAdapters(input);
85
+ }
86
+
87
+ export { createEdgeReadFsRuntime, createEdgeRuntimeAdapters, createEdgeSystemRuntime, edgePathRuntime };
@@ -0,0 +1,16 @@
1
+ import { R as RuntimeFsPort, a as RuntimeDirEntry } from '../../fs-BUYD8ZhA.js';
2
+
3
+ declare function isThenable(value: unknown): value is PromiseLike<unknown>;
4
+ declare function assertSyncPortResult<T>(value: T | Promise<T>, label: string, at: string): T;
5
+
6
+ declare function readRuntimeFsTextSync(filePath: string, fs: RuntimeFsPort): string;
7
+ declare function existsRuntimeFsSync(filePath: string, fs: RuntimeFsPort): boolean;
8
+ declare function listRuntimeFsDirSync(dirPath: string, fs: RuntimeFsPort): RuntimeDirEntry[];
9
+
10
+ /**
11
+ * Parse JSON from a host `RuntimeFsPort` using a **synchronous** `readText` result.
12
+ * Used by CLI-style runners that are not async end-to-end yet.
13
+ */
14
+ declare function readJsonFromRuntimeFsSync(filePath: string, fs: RuntimeFsPort): unknown;
15
+
16
+ export { assertSyncPortResult, existsRuntimeFsSync, isThenable, listRuntimeFsDirSync, readJsonFromRuntimeFsSync, readRuntimeFsTextSync };
@@ -0,0 +1,117 @@
1
+ // src/shared/errors/internal.ts
2
+ var I18nPruneError = class extends Error {
3
+ code;
4
+ issueCode;
5
+ constructor(message, code, options) {
6
+ super(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);
7
+ this.name = "I18nPruneError";
8
+ this.code = code;
9
+ this.issueCode = options?.issueCode;
10
+ }
11
+ };
12
+
13
+ // src/runtime/helpers/sync/assert.ts
14
+ function isThenable(value) {
15
+ return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
16
+ }
17
+ function assertSyncPortResult(value, label, at) {
18
+ if (isThenable(value)) {
19
+ throw new I18nPruneError(
20
+ `Synchronous ${label} requires a plain value (got a Promise at ${at})`,
21
+ "USAGE"
22
+ );
23
+ }
24
+ return value;
25
+ }
26
+
27
+ // src/runtime/helpers/sync/fs.ts
28
+ function readRuntimeFsTextSync(filePath, fs) {
29
+ return assertSyncPortResult(fs.readText(filePath), "fs.readText", filePath);
30
+ }
31
+ function existsRuntimeFsSync(filePath, fs) {
32
+ return assertSyncPortResult(fs.exists(filePath), "fs.exists", filePath);
33
+ }
34
+ function listRuntimeFsDirSync(dirPath, fs) {
35
+ return assertSyncPortResult(fs.listDir(dirPath), "fs.listDir", dirPath);
36
+ }
37
+
38
+ // src/shared/constants/issueCodes.ts
39
+ var ISSUE_IO_READ_FAILED = "i18nprune.io.read_failed";
40
+
41
+ // src/shared/json/parse.ts
42
+ var I18nPruneJsonParseError = class extends I18nPruneError {
43
+ filePath;
44
+ line;
45
+ column;
46
+ offset;
47
+ constructor(input) {
48
+ const options = input.issueCode !== void 0 ? { cause: input.cause, issueCode: input.issueCode } : { cause: input.cause };
49
+ super(input.message, input.code, options);
50
+ this.name = "I18nPruneJsonParseError";
51
+ this.filePath = input.filePath;
52
+ this.line = input.location.line;
53
+ this.column = input.location.column;
54
+ this.offset = input.location.offset;
55
+ }
56
+ };
57
+ function locationFromOffset(text, offset) {
58
+ let line = 1;
59
+ let column = 1;
60
+ const capped = Math.max(0, Math.min(offset, text.length));
61
+ for (let i = 0; i < capped; i += 1) {
62
+ if (text.charCodeAt(i) === 10) {
63
+ line += 1;
64
+ column = 1;
65
+ } else {
66
+ column += 1;
67
+ }
68
+ }
69
+ return { line, column, offset };
70
+ }
71
+ function getJsonParseLocation(error, text) {
72
+ const message = error instanceof Error ? error.message : String(error);
73
+ const positionMatch = /\bposition\s+(\d+)\b/i.exec(message);
74
+ if (positionMatch?.[1]) {
75
+ return locationFromOffset(text, Number.parseInt(positionMatch[1], 10));
76
+ }
77
+ const lineColumnMatch = /\bline\s+(\d+)\s+column\s+(\d+)\b/i.exec(message);
78
+ if (lineColumnMatch?.[1] && lineColumnMatch[2]) {
79
+ return {
80
+ line: Number.parseInt(lineColumnMatch[1], 10),
81
+ column: Number.parseInt(lineColumnMatch[2], 10)
82
+ };
83
+ }
84
+ return {};
85
+ }
86
+ function formatJsonParseMessage(filePath, location, cause) {
87
+ const subject = filePath ? `Invalid JSON in ${filePath}` : "Invalid JSON";
88
+ const at = location.line !== void 0 && location.column !== void 0 ? ` at line ${String(location.line)}, column ${String(location.column)}` : location.offset !== void 0 ? ` at offset ${String(location.offset)}` : "";
89
+ const detail = cause instanceof Error ? cause.message : String(cause);
90
+ return `${subject}${at}: ${detail}`;
91
+ }
92
+ function parseJsonText(text, options = {}) {
93
+ try {
94
+ return JSON.parse(text);
95
+ } catch (cause) {
96
+ const location = getJsonParseLocation(cause, text);
97
+ throw new I18nPruneJsonParseError({
98
+ message: formatJsonParseMessage(options.filePath, location, cause),
99
+ code: options.code ?? "IO",
100
+ cause,
101
+ location,
102
+ ...options.issueCode !== void 0 ? { issueCode: options.issueCode } : {},
103
+ ...options.filePath !== void 0 ? { filePath: options.filePath } : {}
104
+ });
105
+ }
106
+ }
107
+
108
+ // src/runtime/helpers/sync/readJson.ts
109
+ function readJsonFromRuntimeFsSync(filePath, fs) {
110
+ return parseJsonText(readRuntimeFsTextSync(filePath, fs), {
111
+ filePath,
112
+ code: "IO",
113
+ issueCode: ISSUE_IO_READ_FAILED
114
+ });
115
+ }
116
+
117
+ export { assertSyncPortResult, existsRuntimeFsSync, isThenable, listRuntimeFsDirSync, readJsonFromRuntimeFsSync, readRuntimeFsTextSync };
@@ -0,0 +1,24 @@
1
+ import { a as RuntimeSystemPort } from '../capabilities-x74cD2Hu.js';
2
+ import { R as RuntimePathPort } from '../path-Bfn3SAts.js';
3
+ import { R as RuntimeFsPort, b as RuntimeReadFsPort } from '../fs-BUYD8ZhA.js';
4
+ import { R as RuntimeAdapters, a as RuntimeKind } from '../adapters-gp1lXp0T.js';
5
+
6
+ declare const nodeSystemRuntime: RuntimeSystemPort;
7
+
8
+ declare const nodePathRuntime: RuntimePathPort;
9
+
10
+ declare const nodeReadFsRuntime: RuntimeFsPort;
11
+
12
+ declare function createNodeRuntimeAdapters(): RuntimeAdapters;
13
+
14
+ declare function createRuntimeAdaptersForKind(kind: 'node', input?: {
15
+ cwd?: string;
16
+ now?: () => number;
17
+ }): RuntimeAdapters;
18
+ declare function createRuntimeAdaptersForKind(kind: Exclude<RuntimeKind, 'node'>, input: {
19
+ fs: RuntimeReadFsPort & Partial<RuntimeFsPort>;
20
+ cwd?: string;
21
+ now?: () => number;
22
+ }): RuntimeAdapters;
23
+
24
+ export { createNodeRuntimeAdapters, createRuntimeAdaptersForKind, nodePathRuntime, nodeReadFsRuntime, nodeSystemRuntime };
@@ -0,0 +1,204 @@
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+
4
+ // src/runtime/node/system.ts
5
+ var nodeSystemRuntime = {
6
+ cwd: () => process.cwd(),
7
+ now: () => Date.now()
8
+ };
9
+ var nodePathRuntime = {
10
+ join: (...parts) => path.join(...parts),
11
+ dirname: (value) => path.dirname(value),
12
+ basename: (value, ext) => path.basename(value, ext),
13
+ normalize: (value) => path.normalize(value),
14
+ relative: (from, to) => path.relative(from, to),
15
+ resolve: (...parts) => path.resolve(...parts),
16
+ isAbsolute: (value) => path.isAbsolute(value)
17
+ };
18
+ var nodeReadFsRuntime = {
19
+ exists: (filePath) => fs.existsSync(filePath),
20
+ readText: (filePath) => fs.readFileSync(filePath, "utf8"),
21
+ statKind: (filePath) => {
22
+ if (!fs.existsSync(filePath)) return "missing";
23
+ const st = fs.statSync(filePath);
24
+ if (st.isFile()) return "file";
25
+ if (st.isDirectory()) return "directory";
26
+ return "other";
27
+ },
28
+ listDir: (dirPath) => fs.readdirSync(dirPath, { withFileTypes: true }).map((entry) => {
29
+ const full = path.join(dirPath, entry.name);
30
+ if (entry.isFile()) return { name: entry.name, kind: "file" };
31
+ if (entry.isDirectory()) return { name: entry.name, kind: "directory" };
32
+ if (entry.isSymbolicLink()) {
33
+ try {
34
+ const st = fs.statSync(full);
35
+ if (st.isDirectory()) return { name: entry.name, kind: "directory" };
36
+ if (st.isFile()) return { name: entry.name, kind: "file" };
37
+ } catch {
38
+ }
39
+ }
40
+ return { name: entry.name, kind: "other" };
41
+ }),
42
+ writeText: (filePath, content) => fs.writeFileSync(filePath, content, "utf8"),
43
+ deleteFile: (filePath) => fs.unlinkSync(filePath),
44
+ mkdirp: (dirPath) => {
45
+ fs.mkdirSync(path.resolve(dirPath), { recursive: true });
46
+ },
47
+ realpath: (filePath) => fs.realpathSync.native(filePath)
48
+ };
49
+
50
+ // src/runtime/shared/network.ts
51
+ function createAmbientNetworkPort() {
52
+ return {
53
+ fetch: globalThis.fetch.bind(globalThis)
54
+ };
55
+ }
56
+
57
+ // src/runtime/node/index.ts
58
+ function createRuntimeAdapters() {
59
+ return {
60
+ kind: "node",
61
+ system: nodeSystemRuntime,
62
+ path: nodePathRuntime,
63
+ fs: nodeReadFsRuntime,
64
+ network: createAmbientNetworkPort()
65
+ };
66
+ }
67
+
68
+ // src/runtime/factory/adapters.node.ts
69
+ function createNodeRuntimeAdapters() {
70
+ return createRuntimeAdapters();
71
+ }
72
+
73
+ // src/runtime/web/system.ts
74
+ function createWebSystemRuntime(input) {
75
+ return {
76
+ cwd: () => input?.cwd ?? "/",
77
+ now: () => input?.now ? input.now() : Date.now()
78
+ };
79
+ }
80
+
81
+ // src/runtime/web/path.ts
82
+ function split(value) {
83
+ return value.replace(/\\/g, "/").split("/").filter((s) => s.length > 0);
84
+ }
85
+ var webPathRuntime = {
86
+ join: (...parts) => parts.join("/").replace(/\/+/g, "/"),
87
+ dirname: (value) => {
88
+ const parts = split(value);
89
+ return parts.length <= 1 ? "/" : `/${parts.slice(0, -1).join("/")}`;
90
+ },
91
+ basename: (value, ext) => {
92
+ const parts = split(value);
93
+ const base = parts[parts.length - 1] ?? "";
94
+ return ext && base.endsWith(ext) ? base.slice(0, -ext.length) : base;
95
+ },
96
+ normalize: (value) => value.replace(/\\/g, "/").replace(/\/+/g, "/"),
97
+ relative: (_from, to) => to,
98
+ resolve: (...parts) => webPathRuntime.normalize(parts.join("/")),
99
+ isAbsolute: (value) => value.startsWith("/")
100
+ };
101
+
102
+ // src/shared/errors/internal.ts
103
+ var I18nPruneError = class extends Error {
104
+ code;
105
+ issueCode;
106
+ constructor(message, code, options) {
107
+ super(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);
108
+ this.name = "I18nPruneError";
109
+ this.code = code;
110
+ this.issueCode = options?.issueCode;
111
+ }
112
+ };
113
+
114
+ // src/runtime/web/fs.ts
115
+ function createWebReadFsRuntime(input) {
116
+ return {
117
+ exists: input.exists,
118
+ readText: input.readText,
119
+ statKind: input.statKind ?? ((filePath) => input.exists(filePath) ? "other" : "missing"),
120
+ listDir: input.listDir ?? (() => []),
121
+ writeText: input.writeText ?? (() => {
122
+ throw new I18nPruneError("Web runtime fs.writeText is not available for this host adapter", "USAGE");
123
+ }),
124
+ deleteFile: input.deleteFile ?? (() => {
125
+ throw new I18nPruneError("Web runtime fs.deleteFile is not available for this host adapter", "USAGE");
126
+ }),
127
+ mkdirp: input.mkdirp ?? (() => {
128
+ throw new I18nPruneError("Web runtime fs.mkdirp is not available for this host adapter", "USAGE");
129
+ })
130
+ };
131
+ }
132
+
133
+ // src/runtime/web/index.ts
134
+ function createRuntimeAdapters2(input) {
135
+ return {
136
+ kind: "web",
137
+ system: createWebSystemRuntime({ cwd: input.cwd, now: input.now }),
138
+ path: webPathRuntime,
139
+ fs: createWebReadFsRuntime(input.fs),
140
+ network: createAmbientNetworkPort()
141
+ };
142
+ }
143
+
144
+ // src/runtime/factory/adapters.web.ts
145
+ function createWebRuntimeAdapters(input) {
146
+ return createRuntimeAdapters2(input);
147
+ }
148
+
149
+ // src/runtime/edge/system.ts
150
+ function createEdgeSystemRuntime(input) {
151
+ return {
152
+ cwd: () => input?.cwd ?? "/",
153
+ now: () => input?.now ? input.now() : Date.now()
154
+ };
155
+ }
156
+
157
+ // src/runtime/edge/path.ts
158
+ var edgePathRuntime = webPathRuntime;
159
+
160
+ // src/runtime/edge/fs.ts
161
+ function createEdgeReadFsRuntime(input) {
162
+ return {
163
+ exists: input.exists,
164
+ readText: input.readText,
165
+ statKind: input.statKind ?? ((filePath) => input.exists(filePath) ? "other" : "missing"),
166
+ listDir: input.listDir ?? (() => []),
167
+ writeText: input.writeText ?? (() => {
168
+ throw new I18nPruneError("Edge runtime fs.writeText is not available for this host adapter", "USAGE");
169
+ }),
170
+ deleteFile: input.deleteFile ?? (() => {
171
+ throw new I18nPruneError("Edge runtime fs.deleteFile is not available for this host adapter", "USAGE");
172
+ }),
173
+ mkdirp: input.mkdirp ?? (() => {
174
+ throw new I18nPruneError("Edge runtime fs.mkdirp is not available for this host adapter", "USAGE");
175
+ })
176
+ };
177
+ }
178
+
179
+ // src/runtime/edge/index.ts
180
+ function createRuntimeAdapters3(input) {
181
+ return {
182
+ kind: "edge",
183
+ system: createEdgeSystemRuntime({ cwd: input.cwd, now: input.now }),
184
+ path: edgePathRuntime,
185
+ fs: createEdgeReadFsRuntime(input.fs),
186
+ network: createAmbientNetworkPort()
187
+ };
188
+ }
189
+
190
+ // src/runtime/factory/adapters.edge.ts
191
+ function createEdgeRuntimeAdapters(input) {
192
+ return createRuntimeAdapters3(input);
193
+ }
194
+
195
+ // src/runtime/factory/adapters.dispatch.ts
196
+ function createRuntimeAdaptersForKind(kind, input) {
197
+ if (kind === "node") return createNodeRuntimeAdapters();
198
+ if (!input?.fs) {
199
+ throw new Error(`Runtime "${kind}" requires fs adapter input`);
200
+ }
201
+ return kind === "web" ? createWebRuntimeAdapters({ fs: input.fs, cwd: input.cwd, now: input.now }) : createEdgeRuntimeAdapters({ fs: input.fs, cwd: input.cwd, now: input.now });
202
+ }
203
+
204
+ export { createNodeRuntimeAdapters, createRuntimeAdaptersForKind, nodePathRuntime, nodeReadFsRuntime, nodeSystemRuntime };
@@ -0,0 +1,21 @@
1
+ import { b as RuntimeReadFsPort, R as RuntimeFsPort } from '../fs-BUYD8ZhA.js';
2
+ import { R as RuntimeAdapters } from '../adapters-gp1lXp0T.js';
3
+ import { a as RuntimeSystemPort } from '../capabilities-x74cD2Hu.js';
4
+ import { R as RuntimePathPort } from '../path-Bfn3SAts.js';
5
+
6
+ declare function createWebRuntimeAdapters(input: {
7
+ fs: RuntimeReadFsPort & Partial<RuntimeFsPort>;
8
+ cwd?: string;
9
+ now?: () => number;
10
+ }): RuntimeAdapters;
11
+
12
+ declare function createWebSystemRuntime(input?: {
13
+ cwd?: string;
14
+ now?: () => number;
15
+ }): RuntimeSystemPort;
16
+
17
+ declare const webPathRuntime: RuntimePathPort;
18
+
19
+ declare function createWebReadFsRuntime(input: RuntimeReadFsPort & Partial<RuntimeFsPort>): RuntimeFsPort;
20
+
21
+ export { createWebReadFsRuntime, createWebRuntimeAdapters, createWebSystemRuntime, webPathRuntime };
@@ -0,0 +1,84 @@
1
+ // src/runtime/web/system.ts
2
+ function createWebSystemRuntime(input) {
3
+ return {
4
+ cwd: () => input?.cwd ?? "/",
5
+ now: () => input?.now ? input.now() : Date.now()
6
+ };
7
+ }
8
+
9
+ // src/runtime/web/path.ts
10
+ function split(value) {
11
+ return value.replace(/\\/g, "/").split("/").filter((s) => s.length > 0);
12
+ }
13
+ var webPathRuntime = {
14
+ join: (...parts) => parts.join("/").replace(/\/+/g, "/"),
15
+ dirname: (value) => {
16
+ const parts = split(value);
17
+ return parts.length <= 1 ? "/" : `/${parts.slice(0, -1).join("/")}`;
18
+ },
19
+ basename: (value, ext) => {
20
+ const parts = split(value);
21
+ const base = parts[parts.length - 1] ?? "";
22
+ return ext && base.endsWith(ext) ? base.slice(0, -ext.length) : base;
23
+ },
24
+ normalize: (value) => value.replace(/\\/g, "/").replace(/\/+/g, "/"),
25
+ relative: (_from, to) => to,
26
+ resolve: (...parts) => webPathRuntime.normalize(parts.join("/")),
27
+ isAbsolute: (value) => value.startsWith("/")
28
+ };
29
+
30
+ // src/shared/errors/internal.ts
31
+ var I18nPruneError = class extends Error {
32
+ code;
33
+ issueCode;
34
+ constructor(message, code, options) {
35
+ super(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);
36
+ this.name = "I18nPruneError";
37
+ this.code = code;
38
+ this.issueCode = options?.issueCode;
39
+ }
40
+ };
41
+
42
+ // src/runtime/web/fs.ts
43
+ function createWebReadFsRuntime(input) {
44
+ return {
45
+ exists: input.exists,
46
+ readText: input.readText,
47
+ statKind: input.statKind ?? ((filePath) => input.exists(filePath) ? "other" : "missing"),
48
+ listDir: input.listDir ?? (() => []),
49
+ writeText: input.writeText ?? (() => {
50
+ throw new I18nPruneError("Web runtime fs.writeText is not available for this host adapter", "USAGE");
51
+ }),
52
+ deleteFile: input.deleteFile ?? (() => {
53
+ throw new I18nPruneError("Web runtime fs.deleteFile is not available for this host adapter", "USAGE");
54
+ }),
55
+ mkdirp: input.mkdirp ?? (() => {
56
+ throw new I18nPruneError("Web runtime fs.mkdirp is not available for this host adapter", "USAGE");
57
+ })
58
+ };
59
+ }
60
+
61
+ // src/runtime/shared/network.ts
62
+ function createAmbientNetworkPort() {
63
+ return {
64
+ fetch: globalThis.fetch.bind(globalThis)
65
+ };
66
+ }
67
+
68
+ // src/runtime/web/index.ts
69
+ function createRuntimeAdapters(input) {
70
+ return {
71
+ kind: "web",
72
+ system: createWebSystemRuntime({ cwd: input.cwd, now: input.now }),
73
+ path: webPathRuntime,
74
+ fs: createWebReadFsRuntime(input.fs),
75
+ network: createAmbientNetworkPort()
76
+ };
77
+ }
78
+
79
+ // src/runtime/factory/adapters.web.ts
80
+ function createWebRuntimeAdapters(input) {
81
+ return createRuntimeAdapters(input);
82
+ }
83
+
84
+ export { createWebReadFsRuntime, createWebRuntimeAdapters, createWebSystemRuntime, webPathRuntime };