@codeworksh/cli 0.0.1-dev.20260923102823 → 0.0.1-dev.20260925125202

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 (75) hide show
  1. package/{add-D1yPPRz2.mjs → add-CIQSfxan.mjs} +5 -5
  2. package/{add-D1yPPRz2.mjs.map → add-CIQSfxan.mjs.map} +1 -1
  3. package/{catalog-BtH_l7f2.mjs → catalog-C5fDCgtx.mjs} +3 -3
  4. package/{catalog-BtH_l7f2.mjs.map → catalog-C5fDCgtx.mjs.map} +1 -1
  5. package/{check-B7Uh_G-l.mjs → check-B7bP5lRI.mjs} +15 -9
  6. package/check-B7bP5lRI.mjs.map +1 -0
  7. package/entries-CSY5N6jH.mjs +89 -0
  8. package/entries-CSY5N6jH.mjs.map +1 -0
  9. package/{error-DG5INUkQ.mjs → error-D0C5K2Av.mjs} +126 -71
  10. package/error-D0C5K2Av.mjs.map +1 -0
  11. package/{harness-LSywfXzo.mjs → harness-DXAwGk0B.mjs} +2 -2
  12. package/{harness-LSywfXzo.mjs.map → harness-DXAwGk0B.mjs.map} +1 -1
  13. package/index.mjs +18 -18
  14. package/{install-zXEeTQ8w.mjs → install-B02SIXwF.mjs} +4 -4
  15. package/{install-zXEeTQ8w.mjs.map → install-B02SIXwF.mjs.map} +1 -1
  16. package/{link-DquUj9D6.mjs → link-CA9XdPwj.mjs} +3 -3
  17. package/{link-DquUj9D6.mjs.map → link-CA9XdPwj.mjs.map} +1 -1
  18. package/{list-eorMHI-g.mjs → list-Bbo4XnG_.mjs} +4 -4
  19. package/{list-eorMHI-g.mjs.map → list-Bbo4XnG_.mjs.map} +1 -1
  20. package/{list-C1ZWDpwI.mjs → list-Ce1Ry4JN.mjs} +4 -4
  21. package/{list-C1ZWDpwI.mjs.map → list-Ce1Ry4JN.mjs.map} +1 -1
  22. package/{login-DEjauWkd.mjs → login-CagARGqW.mjs} +4 -4
  23. package/{login-DEjauWkd.mjs.map → login-CagARGqW.mjs.map} +1 -1
  24. package/{logout-BUY-ESj_.mjs → logout-CYYtjZL3.mjs} +4 -4
  25. package/{logout-BUY-ESj_.mjs.map → logout-CYYtjZL3.mjs.map} +1 -1
  26. package/package.json +4 -4
  27. package/{providers-wTGawU9e.mjs → providers-CoYj1SYv.mjs} +4 -4
  28. package/{providers-wTGawU9e.mjs.map → providers-CoYj1SYv.mjs.map} +1 -1
  29. package/{refresh-C7e_qZit.mjs → refresh-8_nfeYNZ.mjs} +4 -4
  30. package/{refresh-C7e_qZit.mjs.map → refresh-8_nfeYNZ.mjs.map} +1 -1
  31. package/{refresh-B2jxJmk1.mjs → refresh-D2a1ikea.mjs} +4 -4
  32. package/{refresh-B2jxJmk1.mjs.map → refresh-D2a1ikea.mjs.map} +1 -1
  33. package/{reload-B5LO2rk9.mjs → reload-C5ysPM58.mjs} +3 -3
  34. package/{reload-B5LO2rk9.mjs.map → reload-C5ysPM58.mjs.map} +1 -1
  35. package/{remove-CTVgJKXM.mjs → remove-BkbspSED.mjs} +4 -4
  36. package/{remove-CTVgJKXM.mjs.map → remove-BkbspSED.mjs.map} +1 -1
  37. package/{run-CORFA6op.mjs → run-CnxjZIGy.mjs} +4 -4
  38. package/{run-CORFA6op.mjs.map → run-CnxjZIGy.mjs.map} +1 -1
  39. package/{runtime-Bp4kILYn.mjs → runtime-B3dlWGfs.mjs} +25 -12
  40. package/runtime-B3dlWGfs.mjs.map +1 -0
  41. package/{serve-DzaOcgKC.mjs → serve-DaD7Eijz.mjs} +4 -4
  42. package/{serve-DzaOcgKC.mjs.map → serve-DaD7Eijz.mjs.map} +1 -1
  43. package/{settings-tMD7Y0ev.mjs → settings-BZXmb54m.mjs} +23 -18
  44. package/settings-BZXmb54m.mjs.map +1 -0
  45. package/{shared-D8hbPMPF.mjs → shared-BaTfajJ2.mjs} +3 -3
  46. package/{shared-D8hbPMPF.mjs.map → shared-BaTfajJ2.mjs.map} +1 -1
  47. package/{status-CrAKnTHQ.mjs → status-qJImmv6V.mjs} +4 -4
  48. package/{status-CrAKnTHQ.mjs.map → status-qJImmv6V.mjs.map} +1 -1
  49. package/{update-DK7kAVc3.mjs → update-CxcNv_t0.mjs} +15 -9
  50. package/update-CxcNv_t0.mjs.map +1 -0
  51. package/check-B7Uh_G-l.mjs.map +0 -1
  52. package/commonjs-bcl-ngMU.mjs +0 -160
  53. package/commonjs-bcl-ngMU.mjs.map +0 -1
  54. package/definitions-XbglYT7Q.mjs +0 -3348
  55. package/definitions-XbglYT7Q.mjs.map +0 -1
  56. package/entries-B4tUkrxs.mjs +0 -48
  57. package/entries-B4tUkrxs.mjs.map +0 -1
  58. package/error-DG5INUkQ.mjs.map +0 -1
  59. package/lib-BCUUrctP.mjs +0 -846
  60. package/lib-BCUUrctP.mjs.map +0 -1
  61. package/lib-CNtGmPS7.mjs +0 -16078
  62. package/lib-CNtGmPS7.mjs.map +0 -1
  63. package/lib-CZnS894S.mjs +0 -10868
  64. package/lib-CZnS894S.mjs.map +0 -1
  65. package/lib-DHoZNIet.mjs +0 -37659
  66. package/lib-DHoZNIet.mjs.map +0 -1
  67. package/p-map-CMI1i54p.mjs +0 -116
  68. package/p-map-CMI1i54p.mjs.map +0 -1
  69. package/runtime-Bp4kILYn.mjs.map +0 -1
  70. package/settings-tMD7Y0ev.mjs.map +0 -1
  71. package/type-defs-JBxRyl-4.mjs +0 -538
  72. package/type-defs-JBxRyl-4.mjs.map +0 -1
  73. package/update-DK7kAVc3.mjs.map +0 -1
  74. package/valid-Bc7tec52.mjs +0 -354
  75. package/valid-Bc7tec52.mjs.map +0 -1
@@ -1,7 +1,7 @@
1
- import { R as definition, U as update, d as writeOut, i as reportFailure } from "./error-DG5INUkQ.mjs";
2
- import { i as Cmd, t as handler } from "./runtime-Bp4kILYn.mjs";
3
- import { n as probe, r as read, t as fetchable } from "./entries-B4tUkrxs.mjs";
4
- import { Effect } from "effect";
1
+ import { B as definition, d as writeOut, i as reportFailure, q as update } from "./error-D0C5K2Av.mjs";
2
+ import { i as Cmd, t as handler } from "./runtime-B3dlWGfs.mjs";
3
+ import { a as targeted, i as read, n as local, r as probe, t as fetchable } from "./entries-CSY5N6jH.mjs";
4
+ import { Effect, Option } from "effect";
5
5
  //#region src/cli/cmd/handlers/plugin/update.ts
6
6
  /**
7
7
  * Take whatever `check` found.
@@ -10,15 +10,20 @@ import { Effect } from "effect";
10
10
  * `plugin install` is the verb for that. Each refresh publishes a new generation, which a running
11
11
  * session picks up at its next exchange -- so this command never has to reach into a server.
12
12
  */
13
- var update_default = handler(Cmd.commands.plugin.commands.update, Effect.fn("CLI.plugin.update")(function* () {
13
+ var update_default = handler(Cmd.commands.plugin.commands.update, Effect.fn("CLI.plugin.update")(function* ({ spec }) {
14
14
  return yield* Effect.gen(function* () {
15
15
  const shared = yield* Cmd.spec;
16
- const { entries, cache } = yield* read(shared);
16
+ const { entries, cache, hostDir } = yield* read(shared);
17
+ const selected = yield* targeted(entries, spec, hostDir);
18
+ if (selected.length === 0 && Option.isSome(spec)) return;
17
19
  let updated = 0;
18
20
  let failed = 0;
19
- for (const entry of entries) {
21
+ for (const entry of selected) {
20
22
  const target = fetchable(entry.target);
21
- if (target === void 0) continue;
23
+ if (target === void 0) {
24
+ yield* local(entry, spec);
25
+ continue;
26
+ }
22
27
  const result = yield* update(target, cache, {
23
28
  probe: probe(cache, entry.from),
24
29
  from: entry.from,
@@ -34,6 +39,7 @@ var update_default = handler(Cmd.commands.plugin.commands.update, Effect.fn("CLI
34
39
  yield* writeOut(`Updated ${entry.reference} to ${result.success.entry.revision ?? "a new revision"}\n`);
35
40
  }
36
41
  }
42
+ if (Option.isSome(spec) && selected.every((entry) => fetchable(entry.target) === void 0)) return;
37
43
  yield* writeOut(updated === 0 ? "Nothing to update.\n" : `${updated} updated.\n`);
38
44
  if (failed > 0) process.exitCode = 1;
39
45
  }).pipe(Effect.catch(reportFailure));
@@ -41,4 +47,4 @@ var update_default = handler(Cmd.commands.plugin.commands.update, Effect.fn("CLI
41
47
  //#endregion
42
48
  export { update_default as default };
43
49
 
44
- //# sourceMappingURL=update-DK7kAVc3.mjs.map
50
+ //# sourceMappingURL=update-CxcNv_t0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-CxcNv_t0.mjs","names":["Runtime.handler","Plugin.update","Plugin.definition"],"sources":["../../src/cli/cmd/handlers/plugin/update.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { fetchable, local, probe, read, targeted } from \"./entries.ts\";\n\n/**\n * Take whatever `check` found.\n *\n * Only a plugin that is **already installed** is refreshed: \"not installed\" is not \"outdated\", and\n * `plugin install` is the verb for that. Each refresh publishes a new generation, which a running\n * session picks up at its next exchange -- so this command never has to reach into a server.\n */\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.update,\n\tEffect.fn(\"CLI.plugin.update\")(function* ({ spec }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache, hostDir } = yield* read(shared);\n\t\t\tconst selected = yield* targeted(entries, spec, hostDir);\n\t\t\tif (selected.length === 0 && Option.isSome(spec)) return;\n\n\t\t\tlet updated = 0;\n\t\t\tlet failed = 0;\n\t\t\tfor (const entry of selected) {\n\t\t\t\tconst target = fetchable(entry.target);\n\t\t\t\t// A local plugin has no revision to compare and is never copied into the store.\n\t\t\t\tif (target === undefined) {\n\t\t\t\t\tyield* local(entry, spec);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst result = yield* Plugin.update(target, cache, {\n\t\t\t\t\tprobe: probe(cache, entry.from),\n\t\t\t\t\tfrom: entry.from,\n\t\t\t\t\t// Validated while staged, so a refresh that fetches something broken leaves\n\t\t\t\t\t// the generation already in use as the answer. Preserve the loader's reason:\n\t\t\t\t\t// an import failure or invalid definition is not a missing entrypoint.\n\t\t\t\t\tvalidate: (fetched) => Plugin.definition(fetched.entrypoint, entry.reference).pipe(Effect.asVoid),\n\t\t\t\t}).pipe(Effect.result);\n\n\t\t\t\tif (result._tag === \"Failure\") {\n\t\t\t\t\tfailed += 1;\n\t\t\t\t\tyield* writeOut(`${entry.reference} error[${result.failure.reason}]: ${result.failure.message}\\n`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (result.success._tag === \"updated\") {\n\t\t\t\t\tupdated += 1;\n\t\t\t\t\tyield* writeOut(`Updated ${entry.reference} to ${result.success.entry.revision ?? \"a new revision\"}\\n`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// A spec that named only local plugins compared nothing, so there is nothing to sum up.\n\t\t\tif (Option.isSome(spec) && selected.every((entry) => fetchable(entry.target) === undefined)) return;\n\t\t\tyield* writeOut(updated === 0 ? \"Nothing to update.\\n\" : `${updated} updated.\\n`);\n\t\t\tif (failed > 0) process.exitCode = 1;\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;AAeA,IAAA,iBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,QAC7B,OAAO,GAAG,mBAAmB,CAAC,CAAC,WAAW,EAAE,QAAQ;CA2CnD,OAAO,OA1CS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,IAAI;EAC1B,MAAM,EAAE,SAAS,OAAO,YAAY,OAAO,KAAK,MAAM;EACtD,MAAM,WAAW,OAAO,SAAS,SAAS,MAAM,OAAO;EACvD,IAAI,SAAS,WAAW,KAAK,OAAO,OAAO,IAAI,GAAG;EAElD,IAAI,UAAU;EACd,IAAI,SAAS;EACb,KAAK,MAAM,SAAS,UAAU;GAC7B,MAAM,SAAS,UAAU,MAAM,MAAM;GAErC,IAAI,WAAW,KAAA,GAAW;IACzB,OAAO,MAAM,OAAO,IAAI;IACxB;GACD;GAEA,MAAM,SAAS,OAAOC,OAAc,QAAQ,OAAO;IAClD,OAAO,MAAM,OAAO,MAAM,IAAI;IAC9B,MAAM,MAAM;IAIZ,WAAW,YAAYC,WAAkB,QAAQ,YAAY,MAAM,SAAS,CAAC,CAAC,KAAK,OAAO,MAAM;GACjG,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM;GAErB,IAAI,OAAO,SAAS,WAAW;IAC9B,UAAU;IACV,OAAO,SAAS,GAAG,MAAM,UAAU,UAAU,OAAO,QAAQ,OAAO,KAAK,OAAO,QAAQ,QAAQ,GAAG;IAClG;GACD;GACA,IAAI,OAAO,QAAQ,SAAS,WAAW;IACtC,WAAW;IACX,OAAO,SAAS,WAAW,MAAM,UAAU,MAAM,OAAO,QAAQ,MAAM,YAAY,iBAAiB,GAAG;GACvG;EACD;EAGA,IAAI,OAAO,OAAO,IAAI,KAAK,SAAS,OAAO,UAAU,UAAU,MAAM,MAAM,MAAM,KAAA,CAAS,GAAG;EAC7F,OAAO,SAAS,YAAY,IAAI,yBAAyB,GAAG,QAAQ,YAAY;EAChF,IAAI,SAAS,GAAG,QAAQ,WAAW;CACpC,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-B7Uh_G-l.mjs","names":["Runtime.handler","Plugin.check"],"sources":["../../src/cli/cmd/handlers/plugin/check.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { fetchable, probe, read } from \"./entries.ts\";\n\n/**\n * Which configured plugins have a newer revision available.\n *\n * A probe failure -- offline, registry down, a remote that refuses -- is **not** an update. It is\n * reported per target and the command exits non-zero, rather than being swallowed into \"you are up\n * to date\": an outage that reads as currency is the one answer this command must never give.\n */\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.check,\n\tEffect.fn(\"CLI.plugin.check\")(function* ({ refresh }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache } = yield* read(shared);\n\n\t\t\tlet outdated = 0;\n\t\t\tlet failed = 0;\n\t\t\tfor (const entry of entries) {\n\t\t\t\tconst target = fetchable(entry.target);\n\t\t\t\t// Nothing to compare: a local path has no revision, and `check` skips it rather\n\t\t\t\t// than reporting it as current.\n\t\t\t\tif (target === undefined) continue;\n\n\t\t\t\tconst state = yield* Plugin.check(target, cache, {\n\t\t\t\t\trefresh,\n\t\t\t\t\tprobe: probe(cache, entry.from),\n\t\t\t\t\tfrom: entry.from,\n\t\t\t\t}).pipe(Effect.result);\n\t\t\t\tif (state._tag === \"Failure\") {\n\t\t\t\t\tfailed += 1;\n\t\t\t\t\tyield* writeOut(`${entry.reference} error[${state.failure.reason}]: ${state.failure.message}\\n`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tswitch (state.success._tag) {\n\t\t\t\t\tcase \"outdated\":\n\t\t\t\t\t\toutdated += 1;\n\t\t\t\t\t\tyield* writeOut(`${entry.reference} ${state.success.filed ?? \"?\"} -> ${state.success.available}\\n`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"not-installed\":\n\t\t\t\t\t\tyield* writeOut(`${entry.reference} plugin-not-installed\\n`);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t// An exact version and a commit SHA cannot move, so neither is worth a line.\n\t\t\t\t\tcase \"immutable\":\n\t\t\t\t\tcase \"current\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tyield* writeOut(\n\t\t\t\toutdated === 0 && failed === 0\n\t\t\t\t\t? \"Everything is up to date.\\n\"\n\t\t\t\t\t: `${outdated} update${outdated === 1 ? \"\" : \"s\"} available.\\n`,\n\t\t\t);\n\t\t\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t as __commonJSMin } from "./error-DG5INUkQ.mjs";
2
- import { h as require_commonjs$1, t as require_lib$2, u as require_index_min } from "./lib-CZnS894S.mjs";
3
- //#region ../../node_modules/.pnpm/@npmcli+name-from-folder@5.0.0/node_modules/@npmcli/name-from-folder/lib/index.js
4
- var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- const { basename, dirname } = __require("path");
6
- const getName = (parent, base) => parent.charAt(0) === "@" ? `${parent}/${base}` : base;
7
- module.exports = (dir) => dir ? getName(basename(dirname(dir)), basename(dir)) : false;
8
- }));
9
- //#endregion
10
- //#region ../../node_modules/.pnpm/@npmcli+map-workspaces@6.0.0/node_modules/@npmcli/map-workspaces/lib/index.js
11
- var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12
- const path = __require("path");
13
- const getName = require_lib$1();
14
- const { minimatch } = require_commonjs$1();
15
- const pkgJson = require_lib$2();
16
- const { glob } = require_index_min();
17
- function appendNegatedPatterns(allPatterns) {
18
- const patterns = [];
19
- const negatedPatterns = [];
20
- for (let pattern of allPatterns) {
21
- const excl = pattern.match(/^!+/);
22
- if (excl) pattern = pattern.slice(excl[0].length);
23
- pattern = pattern.replace(/^\.?\/+/, "");
24
- if (excl && excl[0].length % 2 === 1) negatedPatterns.push(pattern);
25
- else {
26
- for (let i = 0; i < negatedPatterns.length; ++i) {
27
- const negatedPattern = negatedPatterns[i];
28
- if (minimatch(pattern, negatedPattern)) negatedPatterns.splice(i, 1);
29
- }
30
- patterns.push(pattern);
31
- }
32
- }
33
- for (const negated of negatedPatterns) for (const pattern of minimatch.match(patterns, negated)) patterns.splice(patterns.indexOf(pattern), 1);
34
- return {
35
- patterns,
36
- negatedPatterns
37
- };
38
- }
39
- function getPatterns(workspaces) {
40
- const workspacesDeclaration = Array.isArray(workspaces.packages) ? workspaces.packages : workspaces;
41
- if (!Array.isArray(workspacesDeclaration)) throw getError({
42
- message: "workspaces config expects an Array",
43
- code: "EWORKSPACESCONFIG"
44
- });
45
- return appendNegatedPatterns(workspacesDeclaration);
46
- }
47
- function getPackageName(pkg, pathname) {
48
- return pkg.name || getName(pathname);
49
- }
50
- function getGlobPattern(pattern) {
51
- pattern = pattern.replace(/\\/g, "/");
52
- return pattern.endsWith("/") ? pattern : `${pattern}/`;
53
- }
54
- function getError({ Type = TypeError, message, code }) {
55
- return Object.assign(new Type(message), { code });
56
- }
57
- function reverseResultMap(map) {
58
- return new Map(Array.from(map, (item) => item.reverse()));
59
- }
60
- async function mapWorkspaces(opts = {}) {
61
- if (!opts || !opts.pkg) throw getError({
62
- message: "mapWorkspaces missing pkg info",
63
- code: "EMAPWORKSPACESPKG"
64
- });
65
- if (!opts.cwd) opts.cwd = process.cwd();
66
- const { workspaces = [] } = opts.pkg;
67
- const { patterns, negatedPatterns } = getPatterns(workspaces);
68
- const results = /* @__PURE__ */ new Map();
69
- if (!patterns.length && !negatedPatterns.length) return results;
70
- const seen = /* @__PURE__ */ new Map();
71
- const getGlobOpts = () => ({
72
- ...opts,
73
- ignore: [
74
- ...opts.ignore || [],
75
- "**/node_modules/**",
76
- ...negatedPatterns
77
- ]
78
- });
79
- let matches = await glob(patterns.map((p) => getGlobPattern(p)), getGlobOpts());
80
- matches = matches.sort((a, b) => a.localeCompare(b, "en"));
81
- const orderedMatches = [];
82
- for (const pattern of patterns) orderedMatches.push(...matches.filter((m) => {
83
- return minimatch(m, pattern, {
84
- partial: true,
85
- windowsPathsNoEscape: true
86
- });
87
- }));
88
- for (const match of orderedMatches) {
89
- let pkg;
90
- try {
91
- pkg = await pkgJson.normalize(path.join(opts.cwd, match));
92
- } catch (err) {
93
- if (err.code === "ENOENT" || err.code === "ENOTDIR") continue;
94
- else throw err;
95
- }
96
- const name = getPackageName(pkg.content, pkg.path);
97
- let seenPackagePathnames = seen.get(name);
98
- if (!seenPackagePathnames) {
99
- seenPackagePathnames = /* @__PURE__ */ new Set();
100
- seen.set(name, seenPackagePathnames);
101
- }
102
- seenPackagePathnames.add(pkg.path);
103
- }
104
- const errorMessageArray = ["must not have multiple workspaces with the same name"];
105
- for (const [packageName, seenPackagePathnames] of seen) if (seenPackagePathnames.size > 1) addDuplicateErrorMessages(errorMessageArray, packageName, seenPackagePathnames);
106
- else results.set(packageName, seenPackagePathnames.values().next().value);
107
- if (errorMessageArray.length > 1) throw getError({
108
- Type: Error,
109
- message: errorMessageArray.join("\n"),
110
- code: "EDUPLICATEWORKSPACE"
111
- });
112
- return results;
113
- }
114
- function addDuplicateErrorMessages(messageArray, packageName, packagePathnames) {
115
- messageArray.push(`package '${packageName}' has conflicts in the following paths:`);
116
- for (const packagePathname of packagePathnames) messageArray.push(" " + packagePathname);
117
- }
118
- mapWorkspaces.virtual = function(opts = {}) {
119
- if (!opts || !opts.lockfile) throw getError({
120
- message: "mapWorkspaces.virtual missing lockfile info",
121
- code: "EMAPWORKSPACESLOCKFILE"
122
- });
123
- if (!opts.cwd) opts.cwd = process.cwd();
124
- const { packages = {} } = opts.lockfile;
125
- const { workspaces = [] } = packages[""] || {};
126
- const results = /* @__PURE__ */ new Map();
127
- const { patterns, negatedPatterns } = getPatterns(workspaces);
128
- if (!patterns.length && !negatedPatterns.length) return results;
129
- negatedPatterns.push("**/node_modules/**");
130
- const packageKeys = Object.keys(packages);
131
- for (const pattern of negatedPatterns) for (const packageKey of minimatch.match(packageKeys, pattern)) packageKeys.splice(packageKeys.indexOf(packageKey), 1);
132
- for (const pattern of patterns) for (const packageKey of minimatch.match(packageKeys, pattern)) {
133
- const packagePathname = path.join(opts.cwd, packageKey);
134
- const name = getPackageName(packages[packageKey], packagePathname);
135
- results.set(packagePathname, name);
136
- }
137
- return reverseResultMap(results);
138
- };
139
- module.exports = mapWorkspaces;
140
- }));
141
- //#endregion
142
- //#region ../../node_modules/.pnpm/walk-up-path@4.0.0/node_modules/walk-up-path/dist/commonjs/index.js
143
- var require_commonjs = /* @__PURE__ */ __commonJSMin(((exports) => {
144
- Object.defineProperty(exports, "__esModule", { value: true });
145
- exports.walkUp = void 0;
146
- const path_1 = __require("path");
147
- const walkUp = function* (path) {
148
- for (path = (0, path_1.resolve)(path); path;) {
149
- yield path;
150
- const pp = (0, path_1.dirname)(path);
151
- if (pp === path) break;
152
- else path = pp;
153
- }
154
- };
155
- exports.walkUp = walkUp;
156
- }));
157
- //#endregion
158
- export { require_lib as n, require_lib$1 as r, require_commonjs as t };
159
-
160
- //# sourceMappingURL=commonjs-bcl-ngMU.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commonjs-bcl-ngMU.mjs","names":[],"sources":["../../../../node_modules/.pnpm/@npmcli+name-from-folder@5.0.0/node_modules/@npmcli/name-from-folder/lib/index.js","../../../../node_modules/.pnpm/@npmcli+map-workspaces@6.0.0/node_modules/@npmcli/map-workspaces/lib/index.js","../../../../node_modules/.pnpm/walk-up-path@4.0.0/node_modules/walk-up-path/dist/commonjs/index.js"],"sourcesContent":["const { basename, dirname } = require('path')\n\nconst getName = (parent, base) =>\n parent.charAt(0) === '@' ? `${parent}/${base}` : base\n\nmodule.exports = dir => dir ? getName(basename(dirname(dir)), basename(dir))\n : false\n","const path = require('path')\n\nconst getName = require('@npmcli/name-from-folder')\nconst { minimatch } = require('minimatch')\nconst pkgJson = require('@npmcli/package-json')\nconst { glob } = require('glob')\n\nfunction appendNegatedPatterns (allPatterns) {\n const patterns = []\n const negatedPatterns = []\n for (let pattern of allPatterns) {\n const excl = pattern.match(/^!+/)\n if (excl) {\n pattern = pattern.slice(excl[0].length)\n }\n\n // strip off any / or ./ from the start of the pattern. /foo => foo\n pattern = pattern.replace(/^\\.?\\/+/, '')\n\n // an odd number of ! means a negated pattern. !!foo ==> foo\n const negate = excl && excl[0].length % 2 === 1\n if (negate) {\n negatedPatterns.push(pattern)\n } else {\n // remove negated patterns that appeared before this pattern to avoid\n // ignoring paths that were matched afterwards\n // e.g: ['packages/**', '!packages/b/**', 'packages/b/a']\n // in the above list, the last pattern overrides the negated pattern\n // right before it. In effect, the above list would become:\n // ['packages/**', 'packages/b/a']\n // The order matters here which is why we must do it inside the loop\n // as opposed to doing it all together at the end.\n for (let i = 0; i < negatedPatterns.length; ++i) {\n const negatedPattern = negatedPatterns[i]\n if (minimatch(pattern, negatedPattern)) {\n negatedPatterns.splice(i, 1)\n }\n }\n patterns.push(pattern)\n }\n }\n\n // use the negated patterns to eagerly remove all the patterns that\n // can be removed to avoid unnecessary crawling\n for (const negated of negatedPatterns) {\n for (const pattern of minimatch.match(patterns, negated)) {\n patterns.splice(patterns.indexOf(pattern), 1)\n }\n }\n return { patterns, negatedPatterns }\n}\n\nfunction getPatterns (workspaces) {\n const workspacesDeclaration =\n Array.isArray(workspaces.packages)\n ? workspaces.packages\n : workspaces\n\n if (!Array.isArray(workspacesDeclaration)) {\n throw getError({\n message: 'workspaces config expects an Array',\n code: 'EWORKSPACESCONFIG',\n })\n }\n\n return appendNegatedPatterns(workspacesDeclaration)\n}\n\nfunction getPackageName (pkg, pathname) {\n return pkg.name || getName(pathname)\n}\n\n// make sure glob pattern only matches folders\nfunction getGlobPattern (pattern) {\n pattern = pattern.replace(/\\\\/g, '/')\n return pattern.endsWith('/')\n ? pattern\n : `${pattern}/`\n}\n\nfunction getError ({ Type = TypeError, message, code }) {\n return Object.assign(new Type(message), { code })\n}\n\nfunction reverseResultMap (map) {\n return new Map(Array.from(map, item => item.reverse()))\n}\n\nasync function mapWorkspaces (opts = {}) {\n if (!opts || !opts.pkg) {\n throw getError({\n message: 'mapWorkspaces missing pkg info',\n code: 'EMAPWORKSPACESPKG',\n })\n }\n if (!opts.cwd) {\n opts.cwd = process.cwd()\n }\n\n const { workspaces = [] } = opts.pkg\n const { patterns, negatedPatterns } = getPatterns(workspaces)\n const results = new Map()\n\n if (!patterns.length && !negatedPatterns.length) {\n return results\n }\n\n const seen = new Map()\n const getGlobOpts = () => ({\n ...opts,\n ignore: [\n ...opts.ignore || [],\n '**/node_modules/**',\n // just ignore the negated patterns to avoid unnecessary crawling\n ...negatedPatterns,\n ],\n })\n\n let matches = await glob(patterns.map((p) => getGlobPattern(p)), getGlobOpts())\n // preserves glob@8 behavior\n matches = matches.sort((a, b) => a.localeCompare(b, 'en'))\n\n // we must preserve the order of results according to the given list of\n // workspace patterns\n const orderedMatches = []\n for (const pattern of patterns) {\n orderedMatches.push(...matches.filter((m) => {\n return minimatch(m, pattern, { partial: true, windowsPathsNoEscape: true })\n }))\n }\n\n for (const match of orderedMatches) {\n let pkg\n try {\n pkg = await pkgJson.normalize(path.join(opts.cwd, match))\n } catch (err) {\n if (err.code === 'ENOENT' || err.code === 'ENOTDIR') {\n continue\n } else {\n throw err\n }\n }\n\n const name = getPackageName(pkg.content, pkg.path)\n\n let seenPackagePathnames = seen.get(name)\n if (!seenPackagePathnames) {\n seenPackagePathnames = new Set()\n seen.set(name, seenPackagePathnames)\n }\n seenPackagePathnames.add(pkg.path)\n }\n\n const errorMessageArray = ['must not have multiple workspaces with the same name']\n for (const [packageName, seenPackagePathnames] of seen) {\n if (seenPackagePathnames.size > 1) {\n addDuplicateErrorMessages(errorMessageArray, packageName, seenPackagePathnames)\n } else {\n results.set(packageName, seenPackagePathnames.values().next().value)\n }\n }\n\n if (errorMessageArray.length > 1) {\n throw getError({\n Type: Error,\n message: errorMessageArray.join('\\n'),\n code: 'EDUPLICATEWORKSPACE',\n })\n }\n\n return results\n}\n\nfunction addDuplicateErrorMessages (messageArray, packageName, packagePathnames) {\n messageArray.push(\n `package '${packageName}' has conflicts in the following paths:`\n )\n\n for (const packagePathname of packagePathnames) {\n messageArray.push(\n ' ' + packagePathname\n )\n }\n}\n\nmapWorkspaces.virtual = function (opts = {}) {\n if (!opts || !opts.lockfile) {\n throw getError({\n message: 'mapWorkspaces.virtual missing lockfile info',\n code: 'EMAPWORKSPACESLOCKFILE',\n })\n }\n if (!opts.cwd) {\n opts.cwd = process.cwd()\n }\n\n const { packages = {} } = opts.lockfile\n const { workspaces = [] } = packages[''] || {}\n // uses a pathname-keyed map in order to negate the exact items\n const results = new Map()\n const { patterns, negatedPatterns } = getPatterns(workspaces)\n if (!patterns.length && !negatedPatterns.length) {\n return results\n }\n negatedPatterns.push('**/node_modules/**')\n\n const packageKeys = Object.keys(packages)\n for (const pattern of negatedPatterns) {\n for (const packageKey of minimatch.match(packageKeys, pattern)) {\n packageKeys.splice(packageKeys.indexOf(packageKey), 1)\n }\n }\n\n for (const pattern of patterns) {\n for (const packageKey of minimatch.match(packageKeys, pattern)) {\n const packagePathname = path.join(opts.cwd, packageKey)\n const name = getPackageName(packages[packageKey], packagePathname)\n results.set(packagePathname, name)\n }\n }\n\n // Invert pathname-keyed to a proper name-to-pathnames Map\n return reverseResultMap(results)\n}\n\nmodule.exports = mapWorkspaces\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.walkUp = void 0;\nconst path_1 = require(\"path\");\nconst walkUp = function* (path) {\n for (path = (0, path_1.resolve)(path); path;) {\n yield path;\n const pp = (0, path_1.dirname)(path);\n if (pp === path) {\n break;\n }\n else {\n path = pp;\n }\n }\n};\nexports.walkUp = walkUp;\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0,1,2],"mappings":";;;;CAAA,MAAM,EAAE,UAAU,YAAA,UAAoB,MAAM;CAE5C,MAAM,WAAW,QAAQ,SACvB,OAAO,OAAO,CAAC,MAAM,MAAM,GAAG,OAAO,GAAG,SAAS;CAEnD,OAAO,WAAU,QAAO,MAAM,QAAQ,SAAS,QAAQ,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC,IACvE;;;;;CCNJ,MAAM,OAAA,UAAe,MAAM;CAE3B,MAAM,UAAA,cAAA;CACN,MAAM,EAAE,cAAA,mBAAA;CACR,MAAM,UAAA,cAAA;CACN,MAAM,EAAE,SAAA,kBAAA;CAER,SAAS,sBAAuB,aAAa;EAC3C,MAAM,WAAW,CAAC;EAClB,MAAM,kBAAkB,CAAC;EACzB,KAAK,IAAI,WAAW,aAAa;GAC/B,MAAM,OAAO,QAAQ,MAAM,KAAK;GAChC,IAAI,MACF,UAAU,QAAQ,MAA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