npmdata 0.11.0 → 0.12.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 (153) hide show
  1. package/README.md +47 -42
  2. package/dist/cli/actions/check.d.ts +6 -0
  3. package/dist/cli/actions/check.d.ts.map +1 -0
  4. package/dist/cli/actions/check.js +57 -0
  5. package/dist/cli/actions/check.js.map +1 -0
  6. package/dist/cli/actions/extract.d.ts +7 -0
  7. package/dist/cli/actions/extract.d.ts.map +1 -0
  8. package/dist/cli/actions/extract.js +84 -0
  9. package/dist/cli/actions/extract.js.map +1 -0
  10. package/dist/cli/actions/init.d.ts +6 -0
  11. package/dist/cli/actions/init.d.ts.map +1 -0
  12. package/dist/cli/actions/init.js +36 -0
  13. package/dist/cli/actions/init.js.map +1 -0
  14. package/dist/cli/actions/list.d.ts +7 -0
  15. package/dist/cli/actions/list.d.ts.map +1 -0
  16. package/dist/cli/actions/list.js +42 -0
  17. package/dist/cli/actions/list.js.map +1 -0
  18. package/dist/cli/actions/purge.d.ts +6 -0
  19. package/dist/cli/actions/purge.d.ts.map +1 -0
  20. package/dist/cli/actions/purge.js +47 -0
  21. package/dist/cli/actions/purge.js.map +1 -0
  22. package/dist/cli/argv.d.ts +35 -0
  23. package/dist/cli/argv.d.ts.map +1 -0
  24. package/dist/cli/argv.js +125 -0
  25. package/dist/cli/argv.js.map +1 -0
  26. package/dist/cli/cli.d.ts +9 -0
  27. package/dist/cli/cli.d.ts.map +1 -0
  28. package/dist/cli/cli.js +69 -0
  29. package/dist/cli/cli.js.map +1 -0
  30. package/dist/cli/runner.d.ts +9 -0
  31. package/dist/cli/runner.d.ts.map +1 -0
  32. package/dist/cli/runner.js +106 -0
  33. package/dist/cli/runner.js.map +1 -0
  34. package/dist/cli/usage.d.ts +6 -0
  35. package/dist/cli/usage.d.ts.map +1 -0
  36. package/dist/cli/usage.js +126 -0
  37. package/dist/cli/usage.js.map +1 -0
  38. package/dist/fileset/check.d.ts +15 -0
  39. package/dist/fileset/check.d.ts.map +1 -0
  40. package/dist/fileset/check.js +68 -0
  41. package/dist/fileset/check.js.map +1 -0
  42. package/dist/fileset/constants.d.ts +13 -0
  43. package/dist/fileset/constants.d.ts.map +1 -0
  44. package/dist/fileset/constants.js +22 -0
  45. package/dist/fileset/constants.js.map +1 -0
  46. package/dist/fileset/diff.d.ts +16 -0
  47. package/dist/fileset/diff.d.ts.map +1 -0
  48. package/dist/fileset/diff.js +116 -0
  49. package/dist/fileset/diff.js.map +1 -0
  50. package/dist/fileset/execute.d.ts +29 -0
  51. package/dist/fileset/execute.d.ts.map +1 -0
  52. package/dist/fileset/execute.js +136 -0
  53. package/dist/fileset/execute.js.map +1 -0
  54. package/dist/fileset/gitignore.d.ts +16 -0
  55. package/dist/fileset/gitignore.d.ts.map +1 -0
  56. package/dist/fileset/gitignore.js +82 -0
  57. package/dist/fileset/gitignore.js.map +1 -0
  58. package/dist/fileset/index.d.ts +5 -0
  59. package/dist/fileset/index.d.ts.map +1 -0
  60. package/dist/fileset/index.js +21 -0
  61. package/dist/fileset/index.js.map +1 -0
  62. package/dist/fileset/list.d.ts +6 -0
  63. package/dist/fileset/list.d.ts.map +1 -0
  64. package/dist/fileset/list.js +11 -0
  65. package/dist/fileset/list.js.map +1 -0
  66. package/dist/fileset/markers.d.ts +22 -0
  67. package/dist/fileset/markers.d.ts.map +1 -0
  68. package/dist/fileset/markers.js +68 -0
  69. package/dist/fileset/markers.js.map +1 -0
  70. package/dist/fileset/package-files.d.ts +14 -0
  71. package/dist/fileset/package-files.d.ts.map +1 -0
  72. package/dist/fileset/package-files.js +81 -0
  73. package/dist/fileset/package-files.js.map +1 -0
  74. package/dist/fileset/purge.d.ts +12 -0
  75. package/dist/fileset/purge.d.ts.map +1 -0
  76. package/dist/fileset/purge.js +95 -0
  77. package/dist/fileset/purge.js.map +1 -0
  78. package/dist/fileset/test-utils.d.ts +12 -0
  79. package/dist/fileset/test-utils.d.ts.map +1 -0
  80. package/dist/fileset/test-utils.js +65 -0
  81. package/dist/fileset/test-utils.js.map +1 -0
  82. package/dist/index.d.ts +10 -8
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +11 -19
  85. package/dist/index.js.map +1 -1
  86. package/dist/main.js +9 -17
  87. package/dist/main.js.map +1 -1
  88. package/dist/npmdata-0.0.1.tgz +0 -0
  89. package/dist/package/action-check.d.ts +20 -0
  90. package/dist/package/action-check.d.ts.map +1 -0
  91. package/dist/package/action-check.js +61 -0
  92. package/dist/package/action-check.js.map +1 -0
  93. package/dist/package/action-extract.d.ts +21 -0
  94. package/dist/package/action-extract.d.ts.map +1 -0
  95. package/dist/package/action-extract.js +186 -0
  96. package/dist/package/action-extract.js.map +1 -0
  97. package/dist/package/action-init.d.ts +13 -0
  98. package/dist/package/action-init.d.ts.map +1 -0
  99. package/dist/package/action-init.js +77 -0
  100. package/dist/package/action-init.js.map +1 -0
  101. package/dist/package/action-list.d.ts +14 -0
  102. package/dist/package/action-list.d.ts.map +1 -0
  103. package/dist/package/action-list.js +46 -0
  104. package/dist/package/action-list.js.map +1 -0
  105. package/dist/package/action-purge.d.ts +21 -0
  106. package/dist/package/action-purge.d.ts.map +1 -0
  107. package/dist/package/action-purge.js +60 -0
  108. package/dist/package/action-purge.js.map +1 -0
  109. package/dist/package/config-merge.d.ts +18 -0
  110. package/dist/package/config-merge.d.ts.map +1 -0
  111. package/dist/package/config-merge.js +48 -0
  112. package/dist/package/config-merge.js.map +1 -0
  113. package/dist/package/config.d.ts +13 -0
  114. package/dist/package/config.d.ts.map +1 -0
  115. package/dist/package/config.js +29 -0
  116. package/dist/package/config.js.map +1 -0
  117. package/dist/package/content-replacements.d.ts +21 -0
  118. package/dist/package/content-replacements.d.ts.map +1 -0
  119. package/dist/package/content-replacements.js +96 -0
  120. package/dist/package/content-replacements.js.map +1 -0
  121. package/dist/package/index.d.ts +10 -0
  122. package/dist/package/index.d.ts.map +1 -0
  123. package/dist/package/index.js +16 -0
  124. package/dist/package/index.js.map +1 -0
  125. package/dist/package/symlinks.d.ts +17 -0
  126. package/dist/package/symlinks.d.ts.map +1 -0
  127. package/dist/package/symlinks.js +125 -0
  128. package/dist/package/symlinks.js.map +1 -0
  129. package/dist/types.d.ts +181 -277
  130. package/dist/types.d.ts.map +1 -1
  131. package/dist/types.js +0 -12
  132. package/dist/types.js.map +1 -1
  133. package/dist/utils.d.ts +25 -55
  134. package/dist/utils.d.ts.map +1 -1
  135. package/dist/utils.js +82 -181
  136. package/dist/utils.js.map +1 -1
  137. package/package.json +4 -2
  138. package/dist/cli.d.ts +0 -6
  139. package/dist/cli.d.ts.map +0 -1
  140. package/dist/cli.js +0 -570
  141. package/dist/cli.js.map +0 -1
  142. package/dist/consumer.d.ts +0 -74
  143. package/dist/consumer.d.ts.map +0 -1
  144. package/dist/consumer.js +0 -820
  145. package/dist/consumer.js.map +0 -1
  146. package/dist/publisher.d.ts +0 -38
  147. package/dist/publisher.d.ts.map +0 -1
  148. package/dist/publisher.js +0 -164
  149. package/dist/publisher.js.map +0 -1
  150. package/dist/runner.d.ts +0 -117
  151. package/dist/runner.d.ts.map +0 -1
  152. package/dist/runner.js +0 -812
  153. package/dist/runner.js.map +0 -1
package/README.md CHANGED
@@ -27,19 +27,19 @@ Create a dedicated npm package whose `package.json` declares an `npmdata` config
27
27
 
28
28
  ```json
29
29
  {
30
- "name": "my-org-data",
30
+ "name": "my-org-configs",
31
31
  "version": "1.0.0",
32
32
  "npmdata": {
33
33
  "sets": [
34
34
  {
35
35
  "package": "base-datasets@^3.0.0",
36
- "outputDir": "./data/base",
37
- "files": ["datasets/**"]
36
+ "selector": { "files": ["datasets/**"] },
37
+ "output": { "path": "./data/base" }
38
38
  },
39
39
  {
40
40
  "package": "org-configs@^1.2.0",
41
- "outputDir": "./configs",
42
- "contentRegexes": ["env: production"]
41
+ "selector": { "contentRegexes": ["env: production"] },
42
+ "output": { "path": "./configs" }
43
43
  }
44
44
  ]
45
45
  }
@@ -51,7 +51,7 @@ Run `pnpm dlx npmdata init` in that package and then `npm publish` to release it
51
51
  **Consumer** — just install and run:
52
52
 
53
53
  ```sh
54
- npx my-org-data extract --output ./local-data
54
+ npx my-org-configs extract --output ./local-data
55
55
  ```
56
56
 
57
57
  No knowledge of the upstream packages or transformation rules is required.
@@ -71,8 +71,8 @@ Add an `npmdata` configuration directly to a project's own `package.json` (or a
71
71
  "sets": [
72
72
  {
73
73
  "package": "base-datasets@^3.0.0",
74
- "outputDir": "./data",
75
- "files": ["datasets/**"]
74
+ "selector": { "files": ["datasets/**"] },
75
+ "output": { "path": "./data" }
76
76
  }
77
77
  ]
78
78
  }
@@ -86,8 +86,8 @@ Or write a standalone `.npmdatarc` (JSON object at the top level):
86
86
  "sets": [
87
87
  {
88
88
  "package": "base-datasets@^3.0.0",
89
- "outputDir": "./data",
90
- "files": ["datasets/**"]
89
+ "selector": { "files": ["datasets/**"] },
90
+ "output": { "path": "./data" }
91
91
  }
92
92
  ]
93
93
  }
@@ -96,6 +96,7 @@ Or write a standalone `.npmdatarc` (JSON object at the top level):
96
96
  Then run any command without `--packages`:
97
97
 
98
98
  ```sh
99
+ npx npmdata # same as 'npx npmdata extract'
99
100
  npx npmdata extract # reads config, extracts all entries
100
101
  npx npmdata check # checks all entries
101
102
  npx npmdata purge # purges all entries
@@ -111,7 +112,7 @@ Config is resolved using [cosmiconfig](https://github.com/cosmiconfig/cosmiconfi
111
112
  | `.npmdatarc.yaml` / `.npmdatarc.yml` | YAML object with `"sets"` array |
112
113
  | `npmdata.config.js` | CommonJS module exporting object with `sets` array |
113
114
 
114
- All runner flags (`--dry-run`, `--silent`, `--verbose`, `--no-gitignore`, `--unmanaged`, `--tags`, `--output`) work as usual.
115
+ All runner flags (`--dry-run`, `--silent`, `--verbose`, `--no-gitignore`, `--unmanaged`, `--presets`, `--output`) work as usual.
115
116
 
116
117
  **When to use:** When a consuming project wants to pin and automate a set of data extractions locally without publishing a separate data package. This is the lightest-weight approach — no extra package, no `init` step, just a config block and a single CLI call.
117
118
 
@@ -198,24 +199,24 @@ npx my-shared-assets extract --output ./data
198
199
  npx my-shared-assets check --output ./data
199
200
  ```
200
201
 
201
- When the data package defines multiple `npmdata` entries in its `package.json`, you can limit which entries are processed using the `--tags` option. Only entries whose `tags` list includes at least one of the requested tags will be extracted; entries with no tags are skipped when a tag filter is active.
202
+ When the data package defines multiple `npmdata` entries in its `package.json`, you can limit which entries are processed using the `--presets` option. Only entries whose `presets` list includes at least one of the requested presets will be extracted; entries with no presets are skipped when a preset filter is active.
202
203
 
203
204
  ```sh
204
205
  # run only entries tagged with "prod"
205
- npx my-shared-assets --tags prod
206
+ npx my-shared-assets --presets prod
206
207
 
207
208
  # run entries tagged with either "prod" or "staging"
208
- npx my-shared-assets --tags prod,staging
209
+ npx my-shared-assets --presets prod,staging
209
210
  ```
210
211
 
211
- To use tags, add a `tags` array to each `npmdata` entry in the data package's `package.json`:
212
+ To use presets, add a `presets` array to each `npmdata` entry in the data package's `package.json`:
212
213
 
213
214
  ```json
214
215
  {
215
216
  "npmdata": {
216
217
  "sets": [
217
- { "package": "my-shared-assets", "outputDir": "./data", "tags": ["prod"] },
218
- { "package": "my-dev-assets", "outputDir": "./dev-data", "tags": ["dev", "staging"] }
218
+ { "package": "my-shared-assets", "output": { "path": "./data" }, "presets": ["prod"] },
219
+ { "package": "my-dev-assets", "output": { "path": "./dev-data" }, "presets": ["dev", "staging"] }
219
220
  ]
220
221
  }
221
222
  }
@@ -229,8 +230,8 @@ When calling the bin script bundled in a data package, the following options are
229
230
 
230
231
  | Option | Description |
231
232
  |---|---|
232
- | `--output, -o <dir>` | Base directory for resolving all `outputDir` paths (default: cwd). |
233
- | `--tags <tag1,tag2>` | Limit to entries whose `tags` overlap with the given list (comma-separated). |
233
+ | `--output, -o <dir>` | Base directory for resolving all `output.path` values (default: cwd). |
234
+ | `--presets <preset1,preset2>` | Limit to entries whose `presets` overlap with the given list (comma-separated). |
234
235
  | `--no-gitignore` | Disable `.gitignore` management for every entry, overriding each entry's `gitignore` field. |
235
236
  | `--unmanaged` | Run every entry in unmanaged mode, overriding each entry's `unmanaged` field. Files are written without a `.npmdata` marker, without `.gitignore` updates, and without being made read-only. |
236
237
  | `--dry-run` | Simulate changes without writing or deleting any files. |
@@ -254,27 +255,27 @@ Each entry in the `npmdata.sets` array in `package.json` supports the following
254
255
  | Option | Type | Default | Description |
255
256
  |---|---|---|---|
256
257
  | `package` | `string` | required | Package spec to install and extract. Either a bare name (`my-pkg`) or with a semver constraint (`my-pkg@^1.2.3`). |
257
- | `outputDir` | `string` | required | Directory where files will be extracted, relative to where the consumer runs the command. |
258
- | `files` | `string[]` | all files | Glob patterns to filter which files are extracted (e.g. `["data/**", "*.json"]`). |
259
- | `contentRegexes` | `string[]` | none | Regex patterns (as strings) to filter files by content. Only files matching at least one pattern are extracted. |
260
- | `force` | `boolean` | `false` | Allow overwriting existing unmanaged files or files owned by a different package. |
261
- | `keepExisting` | `boolean` | `false` | Skip files that already exist but create them when absent. Cannot be combined with `force`. |
262
- | `gitignore` | `boolean` | `true` | Create/update a `.gitignore` file alongside each `.npmdata` marker file. Set to `false` to disable. |
263
- | `unmanaged` | `boolean` | `false` | Write files without a `.npmdata` marker, `.gitignore` update, or read-only flag. Existing files are skipped. |
264
- | `dryRun` | `boolean` | `false` | Simulate extraction without writing anything to disk. |
258
+ | `output.path` | `string` | required | Directory where files will be extracted, relative to where the consumer runs the command. |
259
+ | `selector.files` | `string[]` | all files | Glob patterns to filter which files are extracted (e.g. `["data/**", "*.json"]`). |
260
+ | `selector.contentRegexes` | `string[]` | none | Regex patterns (as strings) to filter files by content. Only files matching at least one pattern are extracted. |
261
+ | `output.force` | `boolean` | `false` | Allow overwriting existing unmanaged files or files owned by a different package. |
262
+ | `output.keepExisting` | `boolean` | `false` | Skip files that already exist but create them when absent. Cannot be combined with `force`. |
263
+ | `output.gitignore` | `boolean` | `true` | Create/update a `.gitignore` file alongside each `.npmdata` marker file. Set to `false` to disable. |
264
+ | `output.unmanaged` | `boolean` | `false` | Write files without a `.npmdata` marker, `.gitignore` update, or read-only flag. Existing files are skipped. |
265
+ | `output.dryRun` | `boolean` | `false` | Simulate extraction without writing anything to disk. |
265
266
  | `upgrade` | `boolean` | `false` | Force a fresh install of the package even when a satisfying version is already installed. |
266
267
  | `silent` | `boolean` | `false` | Suppress per-file output, printing only the final result line. |
267
- | `tags` | `string[]` | none | Tags used to group and selectively run entries with `--tags`. |
268
- | `symlinks` | `SymlinkConfig[]` | none | Post-extract symlink operations (see below). |
269
- | `contentReplacements` | `ContentReplacementConfig[]` | none | Post-extract content-replacement operations (see below). |
268
+ | `presets` | `string[]` | none | Presets used to group and selectively run entries with `--presets`. |
269
+ | `output.symlinks` | `SymlinkConfig[]` | none | Post-extract symlink operations (see below). |
270
+ | `output.contentReplacements` | `ContentReplacementConfig[]` | none | Post-extract content-replacement operations (see below). |
270
271
 
271
272
  #### SymlinkConfig
272
273
 
273
- After extraction, for each config the runner resolves all files/directories inside `outputDir` that match `source` and creates a corresponding symlink inside `target`. Stale symlinks pointing into `outputDir` but no longer matched are removed automatically.
274
+ After extraction, for each config the runner resolves all files/directories inside `output.path` that match `source` and creates a corresponding symlink inside `target`. Stale symlinks pointing into `output.path` but no longer matched are removed automatically.
274
275
 
275
276
  | Field | Type | Description |
276
277
  |---|---|---|
277
- | `source` | `string` | Glob pattern relative to `outputDir`. Every matching file or directory gets a symlink in `target`. Example: `"**\/skills\/**"` |
278
+ | `source` | `string` | Glob pattern relative to `output.path`. Every matching file or directory gets a symlink in `target`. Example: `"**\/skills\/**"` |
278
279
  | `target` | `string` | Directory where symlinks are created, relative to the project root. Example: `".github/skills"` |
279
280
 
280
281
  #### ContentReplacementConfig
@@ -294,17 +295,21 @@ Example with multiple options:
294
295
  "npmdata": [
295
296
  {
296
297
  "package": "my-shared-assets@^2.0.0",
297
- "outputDir": "./data",
298
- "files": ["docs/**", "configs/*.json"],
299
- "gitignore": true,
298
+ "selector": {
299
+ "files": ["docs/**", "configs/*.json"]
300
+ },
301
+ "output": {
302
+ "path": "./data",
303
+ "gitignore": true,
304
+ "symlinks": [
305
+ { "source": "**\/skills\/**", "target": ".github/skills" }
306
+ ],
307
+ "contentReplacements": [
308
+ { "files": "docs/**\/*.md", "match": "<!-- version: .* -->", "replace": "<!-- version: 2.0.0 -->" }
309
+ ]
310
+ },
300
311
  "upgrade": true,
301
- "tags": ["prod"],
302
- "symlinks": [
303
- { "source": "**\/skills\/**", "target": ".github/skills" }
304
- ],
305
- "contentReplacements": [
306
- { "files": "docs/**\/*.md", "match": "<!-- version: .* -->", "replace": "<!-- version: 2.0.0 -->" }
307
- ]
312
+ "presets": ["prod"]
308
313
  }
309
314
  ]
310
315
  }
@@ -0,0 +1,6 @@
1
+ import { NpmdataConfig } from '../../types';
2
+ /**
3
+ * `check` CLI action handler.
4
+ */
5
+ export declare function runCheck(config: NpmdataConfig | null, argv: string[], cwd: string): Promise<void>;
6
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/cli/actions/check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runCheck = runCheck;
4
+ const argv_1 = require("../argv");
5
+ const usage_1 = require("../usage");
6
+ const action_check_1 = require("../../package/action-check");
7
+ /**
8
+ * `check` CLI action handler.
9
+ */
10
+ async function runCheck(config, argv, cwd) {
11
+ if (argv.includes('--help')) {
12
+ (0, usage_1.printUsage)('check');
13
+ return;
14
+ }
15
+ let parsed;
16
+ try {
17
+ parsed = (0, argv_1.parseArgv)(argv);
18
+ }
19
+ catch (error) {
20
+ console.error(`Error: ${error.message}`);
21
+ process.exitCode = 1;
22
+ return;
23
+ }
24
+ if (!config || config.sets.length === 0) {
25
+ console.error('Error: No config found and no --packages specified.');
26
+ process.exitCode = 1;
27
+ return;
28
+ }
29
+ const overridden = (0, argv_1.applyArgvOverrides)(config.sets, parsed);
30
+ try {
31
+ const summary = await (0, action_check_1.actionCheck)({
32
+ entries: overridden,
33
+ config,
34
+ cwd,
35
+ verbose: parsed.verbose,
36
+ skipUnmanaged: parsed.unmanaged,
37
+ });
38
+ const hasDrift = summary.missing.length > 0 || summary.modified.length > 0 || summary.extra.length > 0;
39
+ if (hasDrift) {
40
+ for (const f of summary.missing)
41
+ console.log(`missing: ${f}`);
42
+ for (const f of summary.modified)
43
+ console.log(`modified: ${f}`);
44
+ for (const f of summary.extra)
45
+ console.log(`extra: ${f}`);
46
+ process.exitCode = 1;
47
+ }
48
+ else {
49
+ console.log('All managed files are in sync.');
50
+ }
51
+ }
52
+ catch (error) {
53
+ console.error(`Error: ${error.message}`);
54
+ process.exitCode = 1;
55
+ }
56
+ }
57
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/cli/actions/check.ts"],"names":[],"mappings":";;AASA,4BAmDC;AA1DD,kCAAwD;AACxD,oCAAsC;AACtC,6DAAyD;AAEzD;;GAEG;AACI,KAAK,UAAU,QAAQ,CAC5B,MAA4B,EAC5B,IAAc,EACd,GAAW;IAEX,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC;QACpB,OAAO;IACT,CAAC;IAED,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,C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CAAgC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { NpmdataConfig } from '../../types';
2
+ /**
3
+ * `extract` CLI action handler.
4
+ * Parses argv, merges with config, calls actionExtract, prints summary.
5
+ */
6
+ export declare function runExtract(config: NpmdataConfig | null, argv: string[], cwd: string): Promise<void>;
7
+ //# sourceMappingURL=extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../src/cli/actions/extract.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAM5C;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAuEf"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runExtract = runExtract;
4
+ /* eslint-disable no-console */
5
+ const node_child_process_1 = require("node:child_process");
6
+ const argv_1 = require("../argv");
7
+ const usage_1 = require("../usage");
8
+ const action_extract_1 = require("../../package/action-extract");
9
+ const utils_1 = require("../../utils");
10
+ /**
11
+ * `extract` CLI action handler.
12
+ * Parses argv, merges with config, calls actionExtract, prints summary.
13
+ */
14
+ async function runExtract(config, argv, cwd) {
15
+ if (argv.includes('--help')) {
16
+ (0, usage_1.printUsage)('extract');
17
+ return;
18
+ }
19
+ let parsed;
20
+ try {
21
+ parsed = (0, argv_1.parseArgv)(argv);
22
+ }
23
+ catch (error) {
24
+ console.error(`Error: ${error.message}`);
25
+ process.exitCode = 1;
26
+ return;
27
+ }
28
+ // Build entries: --packages overrides config sets
29
+ let entries = (0, argv_1.buildEntriesFromArgv)(parsed);
30
+ if (!entries) {
31
+ if (!config || config.sets.length === 0) {
32
+ console.error('Error: No packages specified. Use --packages or a config file with sets.');
33
+ process.exitCode = 1;
34
+ return;
35
+ }
36
+ // Config-sourced entries need CLI flag overrides applied
37
+ entries = (0, argv_1.applyArgvOverrides)(config.sets, parsed);
38
+ }
39
+ // Apply preset filter
40
+ const presets = parsed.presets ?? [];
41
+ const filtered = (0, utils_1.filterEntriesByPresets)(entries, presets);
42
+ if (filtered.length === 0) {
43
+ console.log('No entries matched the specified presets.');
44
+ return;
45
+ }
46
+ try {
47
+ const result = await (0, action_extract_1.actionExtract)({
48
+ entries: filtered,
49
+ config,
50
+ cwd,
51
+ verbose: parsed.verbose,
52
+ onProgress: (event) => {
53
+ if (filtered[0]?.silent)
54
+ return;
55
+ if (event.type === 'file-added')
56
+ console.log(` + ${event.file}`);
57
+ else if (event.type === 'file-modified')
58
+ console.log(` ~ ${event.file}`);
59
+ else if (event.type === 'file-deleted')
60
+ console.log(` - ${event.file}`);
61
+ },
62
+ });
63
+ // Run postExtractScript if configured and not dry-run
64
+ const isDryRun = filtered.some((e) => e.output.dryRun);
65
+ if (!isDryRun && config?.postExtractScript) {
66
+ const scriptCmd = `${config.postExtractScript} ${argv.join(' ')}`.trim();
67
+ try {
68
+ (0, node_child_process_1.execSync)(scriptCmd, { cwd, stdio: 'inherit', encoding: 'utf8' });
69
+ }
70
+ catch (error) {
71
+ const e = error;
72
+ process.exitCode = e.status ?? 1;
73
+ return;
74
+ }
75
+ }
76
+ console.log(`Extract complete: ${result.added} added, ${result.modified} modified, ` +
77
+ `${result.deleted} deleted, ${result.skipped} skipped.`);
78
+ }
79
+ catch (error) {
80
+ console.error(`Error: ${error.message}`);
81
+ process.exitCode = 1;
82
+ }
83
+ }
84
+ //# sourceMappingURL=extract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract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,KAAc,EAAE,CAAC;gBACxB,MAAM,CAAC,GAAG,KAA4B,CAAC;gBACvC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;gBACjC,OAAO;YACT,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,CACT,qBAAqB,MAAM,CAAC,KAAK,WAAW,MAAM,CAAC,QAAQ,aAAa;YACtE,GAAG,MAAM,CAAC,OAAO,aAAa,MAAM,CAAC,OAAO,WAAW,CAC1D,CAAC;IACJ,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { NpmdataConfig } from '../../types';
2
+ /**
3
+ * `init` CLI action handler.
4
+ */
5
+ export declare function runInit(config: NpmdataConfig | null, argv: string[], cwd: string): Promise<void>;
6
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/actions/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C;;GAEG;AACH,wBAAsB,OAAO,CAC3B,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAsBf"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runInit = runInit;
7
+ /* eslint-disable no-console */
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const argv_1 = require("../argv");
10
+ const usage_1 = require("../usage");
11
+ const action_init_1 = require("../../package/action-init");
12
+ /**
13
+ * `init` CLI action handler.
14
+ */
15
+ async function runInit(config, argv, cwd) {
16
+ if (argv.includes('--help')) {
17
+ (0, usage_1.printUsage)('init');
18
+ return;
19
+ }
20
+ const parsed = (0, argv_1.parseArgv)(argv);
21
+ const outputDir = parsed.output ? node_path_1.default.resolve(cwd, parsed.output) : cwd;
22
+ const { verbose, files, packages } = parsed;
23
+ const initConfig = {
24
+ files,
25
+ packages: packages?.map((p) => (p.version ? `${p.name}@${p.version}` : p.name)),
26
+ };
27
+ try {
28
+ await (0, action_init_1.actionInit)(outputDir, verbose, initConfig);
29
+ console.log('Init complete. Scaffolded package.json and bin/npmdata.js.');
30
+ }
31
+ catch (error) {
32
+ console.error(`Error: ${error.message}`);
33
+ process.exitCode = 1;
34
+ }
35
+ }
36
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/actions/init.ts"],"names":[],"mappings":";;;;;AAWA,0BA0BC;AArCD,+BAA+B;AAC/B,0DAA6B;AAG7B,kCAAoC;AACpC,oCAAsC;AACtC,2DAAuD;AAEvD;;GAEG;AACI,KAAK,UAAU,OAAO,CAC3B,MAA4B,EAC5B,IAAc,EACd,GAAW;IAEX,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,IAAA,kBAAU,EAAC,MAAM,CAAC,CAAC;QACnB,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACzE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE5C,MAAM,UAAU,GAAG;QACjB,KAAK;QACL,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KAChF,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,IAAA,wBAAU,EAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;IAC5E,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { NpmdataConfig } from '../../types';
2
+ /**
3
+ * `list` CLI action handler.
4
+ * Note: list always ignores --presets.
5
+ */
6
+ export declare function runList(config: NpmdataConfig | null, argv: string[], cwd: string): Promise<void>;
7
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/actions/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C;;;GAGG;AACH,wBAAsB,OAAO,CAC3B,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runList = runList;
4
+ const argv_1 = require("../argv");
5
+ const usage_1 = require("../usage");
6
+ const action_list_1 = require("../../package/action-list");
7
+ /**
8
+ * `list` CLI action handler.
9
+ * Note: list always ignores --presets.
10
+ */
11
+ async function runList(config, argv, cwd) {
12
+ if (argv.includes('--help')) {
13
+ (0, usage_1.printUsage)('list');
14
+ return;
15
+ }
16
+ const parsed = (0, argv_1.parseArgv)(argv);
17
+ const entries = config?.sets ?? [];
18
+ try {
19
+ const files = await (0, action_list_1.actionList)({
20
+ entries,
21
+ config,
22
+ cwd,
23
+ output: parsed.output,
24
+ verbose: parsed.verbose,
25
+ });
26
+ if (files.length === 0) {
27
+ if (parsed.verbose)
28
+ console.log('No managed files found.');
29
+ }
30
+ else {
31
+ for (const f of files) {
32
+ console.log(`${f.path} ${f.packageName}@${f.packageVersion}`);
33
+ }
34
+ }
35
+ // list always exits 0
36
+ }
37
+ catch (error) {
38
+ console.error(`Error: ${error.message}`);
39
+ process.exitCode = 1;
40
+ }
41
+ }
42
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/cli/actions/list.ts"],"names":[],"mappings":";;AAUA,0BAmCC;AA3CD,kCAAoC;AACpC,oCAAsC;AACtC,2DAAuD;AAEvD;;;GAGG;AACI,KAAK,UAAU,OAAO,CAC3B,MAA4B,EAC5B,IAAc,EACd,GAAW;IAEX,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,IAAA,kBAAU,EAAC,MAAM,CAAC,CAAC;QACnB,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC;IAE/B,MAAM,OAAO,GAAG,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;IAEnC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,IAAA,wBAAU,EAAC;YAC7B,OAAO;YACP,MAAM;YACN,GAAG;YACH,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC;QAEH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,IAAI,MAAM,CAAC,OAAO;gBAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACN,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QACD,sBAAsB;IACxB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { NpmdataConfig } from '../../types';
2
+ /**
3
+ * `purge` CLI action handler.
4
+ */
5
+ export declare function runPurge(config: NpmdataConfig | null, argv: string[], cwd: string): Promise<void>;
6
+ //# sourceMappingURL=purge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purge.d.ts","sourceRoot":"","sources":["../../../src/cli/actions/purge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAoCf"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runPurge = runPurge;
4
+ const argv_1 = require("../argv");
5
+ const usage_1 = require("../usage");
6
+ const action_purge_1 = require("../../package/action-purge");
7
+ /**
8
+ * `purge` CLI action handler.
9
+ */
10
+ async function runPurge(config, argv, cwd) {
11
+ if (argv.includes('--help')) {
12
+ (0, usage_1.printUsage)('purge');
13
+ return;
14
+ }
15
+ let parsed;
16
+ try {
17
+ parsed = (0, argv_1.parseArgv)(argv);
18
+ }
19
+ catch (error) {
20
+ console.error(`Error: ${error.message}`);
21
+ process.exitCode = 1;
22
+ return;
23
+ }
24
+ const entries = config?.sets ?? [];
25
+ try {
26
+ const summary = await (0, action_purge_1.actionPurge)({
27
+ entries,
28
+ config,
29
+ cwd,
30
+ presets: parsed.presets ?? [],
31
+ dryRun: parsed.dryRun,
32
+ verbose: parsed.verbose,
33
+ onProgress: (event) => {
34
+ if (parsed.silent)
35
+ return;
36
+ if (event.type === 'file-deleted')
37
+ console.log(` - ${event.file}`);
38
+ },
39
+ });
40
+ console.log(`Purge complete: ${summary.deleted} deleted.`);
41
+ }
42
+ catch (error) {
43
+ console.error(`Error: ${error.message}`);
44
+ process.exitCode = 1;
45
+ }
46
+ }
47
+ //# sourceMappingURL=purge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purge.js","sourceRoot":"","sources":["../../../src/cli/actions/purge.ts"],"names":[],"mappings":";;AASA,4BAwCC;AA/CD,kCAAoC;AACpC,oCAAsC;AACtC,6DAAyD;AAEzD;;GAEG;AACI,KAAK,UAAU,QAAQ,CAC5B,MAA4B,EAC5B,IAAc,EACd,GAAW;IAEX,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC;QACpB,OAAO;IACT,CAAC;IAED,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;IAEnC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAW,EAAC;YAChC,OAAO;YACP,MAAM;YACN,GAAG;YACH,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;YAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,CAAC,KAA0C,EAAE,EAAE;gBACzD,IAAI,MAAM,CAAC,MAAM;oBAAE,OAAO;gBAC1B,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;oBAAE,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YACtE,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,mBAAmB,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { PackageConfig, NpmdataExtractEntry } from '../types';
2
+ /**
3
+ * Parsed CLI flags for all commands.
4
+ */
5
+ export type ParsedArgv = {
6
+ packages?: PackageConfig[];
7
+ output?: string;
8
+ files?: string[];
9
+ contentRegexes?: string[];
10
+ presets?: string[];
11
+ force: boolean;
12
+ keepExisting: boolean;
13
+ noGitignore: boolean;
14
+ unmanaged: boolean;
15
+ dryRun: boolean;
16
+ upgrade: boolean;
17
+ silent: boolean;
18
+ verbose: boolean;
19
+ };
20
+ /**
21
+ * Parse all supported CLI flags from an argv array.
22
+ * Validates mutually exclusive combinations and throws on invalid input.
23
+ */
24
+ export declare function parseArgv(argv: string[]): ParsedArgv;
25
+ /**
26
+ * Build NpmdataExtractEntry objects from --packages + --output CLI flags.
27
+ * Returns null if --packages is not set.
28
+ */
29
+ export declare function buildEntriesFromArgv(parsed: ParsedArgv): NpmdataExtractEntry[] | null;
30
+ /**
31
+ * Apply CLI overrides from ParsedArgv to each NpmdataExtractEntry.
32
+ * CLI flags always take precedence over config file values.
33
+ */
34
+ export declare function applyArgvOverrides(entries: NpmdataExtractEntry[], parsed: ParsedArgv): NpmdataExtractEntry[];
35
+ //# sourceMappingURL=argv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"argv.d.ts","sourceRoot":"","sources":["../../src/cli/argv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAgC,MAAM,UAAU,CAAC;AAG5F;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAiDpD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,mBAAmB,EAAE,GAAG,IAAI,CA4BrF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,mBAAmB,EAAE,EAC9B,MAAM,EAAE,UAAU,GACjB,mBAAmB,EAAE,CA+BvB"}