@webpieces/rules-config 0.4.731 → 0.4.732

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/rules-config",
3
- "version": "0.4.731",
3
+ "version": "0.4.732",
4
4
  "description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPathExcluded = isPathExcluded;
4
4
  exports.matchesAnyGlob = matchesAnyGlob;
5
- const minimatch_1 = require("minimatch");
5
+ // Interop-resolved (issue #747) — NEVER `import { minimatch } from 'minimatch'` here; that named
6
+ // export does not exist on minimatch v3, which is what a hoisted-linker consumer can resolve to.
7
+ const minimatch_interop_1 = require("./minimatch-interop");
6
8
  /**
7
9
  * Holistic exclusion check shared by validate-ts-in-src (Layer 1 + Layer 2)
8
10
  * and the file-location AI-hook rule, so the two implementations can never
@@ -27,9 +29,9 @@ function isPathExcluded(relPath, excludePaths) {
27
29
  for (const pattern of excludePaths) {
28
30
  if (segments.includes(pattern))
29
31
  return true;
30
- if ((0, minimatch_1.minimatch)(norm, pattern))
32
+ if ((0, minimatch_interop_1.minimatch)(norm, pattern))
31
33
  return true;
32
- if ((0, minimatch_1.minimatch)(norm, `${pattern}/**`))
34
+ if ((0, minimatch_interop_1.minimatch)(norm, `${pattern}/**`))
33
35
  return true;
34
36
  }
35
37
  return false;
@@ -64,9 +66,9 @@ function isPathExcluded(relPath, excludePaths) {
64
66
  function matchesAnyGlob(relPath, patterns) {
65
67
  const norm = relPath.replace(/\\/g, '/');
66
68
  for (const pattern of patterns) {
67
- if ((0, minimatch_1.minimatch)(norm, pattern, { dot: true }))
69
+ if ((0, minimatch_interop_1.minimatch)(norm, pattern, { dot: true }))
68
70
  return true;
69
- if ((0, minimatch_1.minimatch)(norm, `${pattern}/**`, { dot: true }))
71
+ if ((0, minimatch_interop_1.minimatch)(norm, `${pattern}/**`, { dot: true }))
70
72
  return true;
71
73
  }
72
74
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"exclude-paths.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/exclude-paths.ts"],"names":[],"mappings":";;AAoBA,wCASC;AA6BD,wCAOC;AAjED,yCAAsC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,cAAc,CAAC,OAAe,EAAE,YAA+B;IAC3E,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAC5C,IAAI,IAAA,qBAAS,EAAC,IAAI,EAAE,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,IAAA,qBAAS,EAAC,IAAI,EAAE,GAAG,OAAO,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;IACtD,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,sGAAsG;AACtG,SAAgB,cAAc,CAAC,OAAe,EAAE,QAA2B;IACvE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,IAAA,qBAAS,EAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QACzD,IAAI,IAAA,qBAAS,EAAC,IAAI,EAAE,GAAG,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { minimatch } from 'minimatch';\n\n/**\n * Holistic exclusion check shared by validate-ts-in-src (Layer 1 + Layer 2)\n * and the file-location AI-hook rule, so the two implementations can never\n * drift apart again.\n *\n * `relPath` is a workspace-relative path (e.g.\n * \"libraries/foo/codegen.ts\"). An entry in `excludePaths` matches when ANY\n * of the following hold:\n *\n * 1. Bare directory/segment name appearing anywhere in the path. This is\n * the historical behavior and keeps entries like \"node_modules\",\n * \"dist\", \"scripts\", \"architecture\" working at any depth.\n * 2. A glob matched against the full relative path, e.g. \"**\\/*.d.ts\" or\n * \"**\\/codegen.ts\".\n * 3. A directory-prefix glob, e.g. \"libraries/apis\" -> \"libraries/apis/**\".\n *\n * Paths are normalized to forward slashes so Windows backslashes match too.\n */\nexport function isPathExcluded(relPath: string, excludePaths: readonly string[]): boolean {\n const norm = relPath.replace(/\\\\/g, '/');\n const segments = norm.split('/');\n for (const pattern of excludePaths) {\n if (segments.includes(pattern)) return true;\n if (minimatch(norm, pattern)) return true;\n if (minimatch(norm, `${pattern}/**`)) return true;\n }\n return false;\n}\n\n/**\n * Does `relPath` match any of `patterns`, as a glob or as a directory prefix?\n *\n * The strict sibling of {@link isPathExcluded}: it drops rule 1 (bare segment name matching anywhere\n * in the path), which is right for an opt-out exclusion list but wrong for anything that CLASSIFIES\n * a path — a pattern like \"external\" would otherwise claim every path containing that segment at any\n * depth. Used for config lists that positively identify a set of projects (e.g.\n * `runtime-architecture.externalApiPaths`).\n *\n * Paths are normalized to forward slashes so Windows backslashes match too. Empty `patterns` matches\n * nothing, so an unconfigured list is inert rather than universal.\n *\n * DOTFILE PATHS COUNT (`{ dot: true }`). minimatch's default hides any path segment starting with `.`\n * from a wildcard, so `**` does not match `.github/workflows/deploy.yml` and `.claude/**` does not match\n * `.claude/agents/x.md`. For a repo-path classifier that default is simply wrong: `.github/`, `.claude/`\n * and `.webpieces/` are ordinary, frequently-changed directories here, and a pattern author writing\n * `**` means all of it. Shell-style dot-hiding protects against globbing up `.` and `..`, which is not a\n * hazard any caller here has.\n *\n * The three consumers are named here on purpose, because the widening is silent for them:\n * `build-artifact-gate` (stale generated artifacts), `api-scanner.externalApiPaths` (project\n * classification) and `no-custom-css-scope.allowGlobs` (an EXEMPTION list, so wider = more exempt).\n * None configures a dot-path today, and for all three \"the pattern author meant the whole subtree\" is\n * the reading they already assume — but a future dot-path entry now matches where it silently did not,\n * and that is a deliberate decision recorded here rather than an accident.\n */\n// webpieces-disable no-function-outside-class -- pure path predicate, sibling of isPathExcluded above\nexport function matchesAnyGlob(relPath: string, patterns: readonly string[]): boolean {\n const norm = relPath.replace(/\\\\/g, '/');\n for (const pattern of patterns) {\n if (minimatch(norm, pattern, { dot: true })) return true;\n if (minimatch(norm, `${pattern}/**`, { dot: true })) return true;\n }\n return false;\n}\n"]}
1
+ {"version":3,"file":"exclude-paths.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/exclude-paths.ts"],"names":[],"mappings":";;AAsBA,wCASC;AA6BD,wCAOC;AAnED,iGAAiG;AACjG,iGAAiG;AACjG,2DAAgD;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,cAAc,CAAC,OAAe,EAAE,YAA+B;IAC3E,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAC5C,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,GAAG,OAAO,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;IACtD,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,sGAAsG;AACtG,SAAgB,cAAc,CAAC,OAAe,EAAE,QAA2B;IACvE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QACzD,IAAI,IAAA,6BAAS,EAAC,IAAI,EAAE,GAAG,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["// Interop-resolved (issue #747) — NEVER `import { minimatch } from 'minimatch'` here; that named\n// export does not exist on minimatch v3, which is what a hoisted-linker consumer can resolve to.\nimport { minimatch } from './minimatch-interop';\n\n/**\n * Holistic exclusion check shared by validate-ts-in-src (Layer 1 + Layer 2)\n * and the file-location AI-hook rule, so the two implementations can never\n * drift apart again.\n *\n * `relPath` is a workspace-relative path (e.g.\n * \"libraries/foo/codegen.ts\"). An entry in `excludePaths` matches when ANY\n * of the following hold:\n *\n * 1. Bare directory/segment name appearing anywhere in the path. This is\n * the historical behavior and keeps entries like \"node_modules\",\n * \"dist\", \"scripts\", \"architecture\" working at any depth.\n * 2. A glob matched against the full relative path, e.g. \"**\\/*.d.ts\" or\n * \"**\\/codegen.ts\".\n * 3. A directory-prefix glob, e.g. \"libraries/apis\" -> \"libraries/apis/**\".\n *\n * Paths are normalized to forward slashes so Windows backslashes match too.\n */\nexport function isPathExcluded(relPath: string, excludePaths: readonly string[]): boolean {\n const norm = relPath.replace(/\\\\/g, '/');\n const segments = norm.split('/');\n for (const pattern of excludePaths) {\n if (segments.includes(pattern)) return true;\n if (minimatch(norm, pattern)) return true;\n if (minimatch(norm, `${pattern}/**`)) return true;\n }\n return false;\n}\n\n/**\n * Does `relPath` match any of `patterns`, as a glob or as a directory prefix?\n *\n * The strict sibling of {@link isPathExcluded}: it drops rule 1 (bare segment name matching anywhere\n * in the path), which is right for an opt-out exclusion list but wrong for anything that CLASSIFIES\n * a path — a pattern like \"external\" would otherwise claim every path containing that segment at any\n * depth. Used for config lists that positively identify a set of projects (e.g.\n * `runtime-architecture.externalApiPaths`).\n *\n * Paths are normalized to forward slashes so Windows backslashes match too. Empty `patterns` matches\n * nothing, so an unconfigured list is inert rather than universal.\n *\n * DOTFILE PATHS COUNT (`{ dot: true }`). minimatch's default hides any path segment starting with `.`\n * from a wildcard, so `**` does not match `.github/workflows/deploy.yml` and `.claude/**` does not match\n * `.claude/agents/x.md`. For a repo-path classifier that default is simply wrong: `.github/`, `.claude/`\n * and `.webpieces/` are ordinary, frequently-changed directories here, and a pattern author writing\n * `**` means all of it. Shell-style dot-hiding protects against globbing up `.` and `..`, which is not a\n * hazard any caller here has.\n *\n * The three consumers are named here on purpose, because the widening is silent for them:\n * `build-artifact-gate` (stale generated artifacts), `api-scanner.externalApiPaths` (project\n * classification) and `no-custom-css-scope.allowGlobs` (an EXEMPTION list, so wider = more exempt).\n * None configures a dot-path today, and for all three \"the pattern author meant the whole subtree\" is\n * the reading they already assume — but a future dot-path entry now matches where it silently did not,\n * and that is a deliberate decision recorded here rather than an accident.\n */\n// webpieces-disable no-function-outside-class -- pure path predicate, sibling of isPathExcluded above\nexport function matchesAnyGlob(relPath: string, patterns: readonly string[]): boolean {\n const norm = relPath.replace(/\\\\/g, '/');\n for (const pattern of patterns) {\n if (minimatch(norm, pattern, { dot: true })) return true;\n if (minimatch(norm, `${pattern}/**`, { dot: true })) return true;\n }\n return false;\n}\n"]}
@@ -0,0 +1,40 @@
1
+ import type { minimatch as MinimatchNamed } from 'minimatch';
2
+ /**
3
+ * The `(path, pattern, options?) => boolean` callable that EVERY minimatch major has exposed —
4
+ * only the wrapper around it changed between versions.
5
+ */
6
+ export type MinimatchFn = typeof MinimatchNamed;
7
+ /**
8
+ * The two export shapes minimatch has shipped:
9
+ * - v5+ : `exports.minimatch = minimatch` — a MODULE carrying a named `minimatch` export.
10
+ * - v3/v4: `module.exports = minimatch` — the module IS the function, with NO named export.
11
+ */
12
+ type MinimatchExport = MinimatchFn & {
13
+ minimatch?: MinimatchFn;
14
+ };
15
+ /**
16
+ * Resolves whichever minimatch actually got linked into the callable both shapes provide.
17
+ *
18
+ * WHY THIS EXISTS (issue #747). `import { minimatch } from 'minimatch'` compiles to
19
+ * `minimatch_1.minimatch`, which is `undefined` against minimatch v3 — and v3 is what a consumer
20
+ * gets whenever pnpm's `node-linker=hoisted` puts an older minimatch at the root and this package
21
+ * receives no nested copy. `arch:generate` died with
22
+ * `(0 , minimatch_1.minimatch) is not a function` for exactly that reason. Declaring
23
+ * `minimatch: 10.0.1` (which this package does) does NOT prevent it: under a hoisted linker the
24
+ * declaration is not what resolution follows.
25
+ *
26
+ * THIS IS NOT A WEBPIECES COMPATIBILITY SHIM. It keeps no old spelling of any webpieces surface
27
+ * alive — there is exactly one exported `minimatch` binding here, and no caller can choose a
28
+ * second one. It reconciles an EXTERNAL library's two export shapes, which webpieces neither owns
29
+ * nor can delete, at the one boundary where that library enters this package.
30
+ */
31
+ export declare class MinimatchInterop {
32
+ /**
33
+ * @param loaded whatever `require('minimatch')` produced in the consumer's tree
34
+ * @returns the matcher function, from the named export when present, else the module itself
35
+ */
36
+ resolve(loaded: MinimatchExport): MinimatchFn;
37
+ }
38
+ /** The interop-resolved matcher. Import THIS, never `{ minimatch } from 'minimatch'`. */
39
+ export declare const minimatch: MinimatchFn;
40
+ export {};
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.minimatch = exports.MinimatchInterop = void 0;
4
+ /**
5
+ * Resolves whichever minimatch actually got linked into the callable both shapes provide.
6
+ *
7
+ * WHY THIS EXISTS (issue #747). `import { minimatch } from 'minimatch'` compiles to
8
+ * `minimatch_1.minimatch`, which is `undefined` against minimatch v3 — and v3 is what a consumer
9
+ * gets whenever pnpm's `node-linker=hoisted` puts an older minimatch at the root and this package
10
+ * receives no nested copy. `arch:generate` died with
11
+ * `(0 , minimatch_1.minimatch) is not a function` for exactly that reason. Declaring
12
+ * `minimatch: 10.0.1` (which this package does) does NOT prevent it: under a hoisted linker the
13
+ * declaration is not what resolution follows.
14
+ *
15
+ * THIS IS NOT A WEBPIECES COMPATIBILITY SHIM. It keeps no old spelling of any webpieces surface
16
+ * alive — there is exactly one exported `minimatch` binding here, and no caller can choose a
17
+ * second one. It reconciles an EXTERNAL library's two export shapes, which webpieces neither owns
18
+ * nor can delete, at the one boundary where that library enters this package.
19
+ */
20
+ class MinimatchInterop {
21
+ /**
22
+ * @param loaded whatever `require('minimatch')` produced in the consumer's tree
23
+ * @returns the matcher function, from the named export when present, else the module itself
24
+ */
25
+ resolve(loaded) {
26
+ return loaded.minimatch ?? loaded;
27
+ }
28
+ }
29
+ exports.MinimatchInterop = MinimatchInterop;
30
+ /** The interop-resolved matcher. Import THIS, never `{ minimatch } from 'minimatch'`. */
31
+ exports.minimatch = new MinimatchInterop().resolve(require('minimatch'));
32
+ //# sourceMappingURL=minimatch-interop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minimatch-interop.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/minimatch-interop.ts"],"names":[],"mappings":";;;AAeA;;;;;;;;;;;;;;;GAeG;AACH,MAAa,gBAAgB;IACzB;;;OAGG;IACH,OAAO,CAAC,MAAuB;QAC3B,OAAO,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC;IACtC,CAAC;CACJ;AARD,4CAQC;AAED,yFAAyF;AAC5E,QAAA,SAAS,GAAgB,IAAI,gBAAgB,EAAE,CAAC,OAAO,CAChE,OAAO,CAAC,WAAW,CAAoB,CAC1C,CAAC","sourcesContent":["import type { minimatch as MinimatchNamed } from 'minimatch';\n\n/**\n * The `(path, pattern, options?) => boolean` callable that EVERY minimatch major has exposed —\n * only the wrapper around it changed between versions.\n */\nexport type MinimatchFn = typeof MinimatchNamed;\n\n/**\n * The two export shapes minimatch has shipped:\n * - v5+ : `exports.minimatch = minimatch` — a MODULE carrying a named `minimatch` export.\n * - v3/v4: `module.exports = minimatch` — the module IS the function, with NO named export.\n */\ntype MinimatchExport = MinimatchFn & { minimatch?: MinimatchFn };\n\n/**\n * Resolves whichever minimatch actually got linked into the callable both shapes provide.\n *\n * WHY THIS EXISTS (issue #747). `import { minimatch } from 'minimatch'` compiles to\n * `minimatch_1.minimatch`, which is `undefined` against minimatch v3 — and v3 is what a consumer\n * gets whenever pnpm's `node-linker=hoisted` puts an older minimatch at the root and this package\n * receives no nested copy. `arch:generate` died with\n * `(0 , minimatch_1.minimatch) is not a function` for exactly that reason. Declaring\n * `minimatch: 10.0.1` (which this package does) does NOT prevent it: under a hoisted linker the\n * declaration is not what resolution follows.\n *\n * THIS IS NOT A WEBPIECES COMPATIBILITY SHIM. It keeps no old spelling of any webpieces surface\n * alive — there is exactly one exported `minimatch` binding here, and no caller can choose a\n * second one. It reconciles an EXTERNAL library's two export shapes, which webpieces neither owns\n * nor can delete, at the one boundary where that library enters this package.\n */\nexport class MinimatchInterop {\n /**\n * @param loaded whatever `require('minimatch')` produced in the consumer's tree\n * @returns the matcher function, from the named export when present, else the module itself\n */\n resolve(loaded: MinimatchExport): MinimatchFn {\n return loaded.minimatch ?? loaded;\n }\n}\n\n/** The interop-resolved matcher. Import THIS, never `{ minimatch } from 'minimatch'`. */\nexport const minimatch: MinimatchFn = new MinimatchInterop().resolve(\n require('minimatch') as MinimatchExport,\n);\n"]}