From 240ed8ad3c31d1324ef1525c71a6ca05bd171a51 Mon Sep 17 00:00:00 2001 From: xc2 Date: Tue, 12 Nov 2024 21:47:23 +0800 Subject: [PATCH 1/2] docs: initial --- .config/typedoc.json | 12 ++ .gitignore | 3 + README.md | 15 ++ biome.json | 2 +- docs/label/Class.BazelLikeSpec.md | 139 +++++++++++++ .../Class.CannotResolveFromSubPackages.md | 193 +++++++++++++++++ docs/label/Class.InvalidLabel.md | 195 ++++++++++++++++++ docs/label/Class.NoMatchedPackages.md | 193 +++++++++++++++++ docs/label/Class.NoMatchedTarget.md | 193 +++++++++++++++++ docs/label/Class.TargetQuery.md | 108 ++++++++++ docs/label/Function.build.md | 33 +++ docs/label/Function.normalizePackage.md | 21 ++ docs/label/Function.parse.md | 27 +++ docs/label/Function.resolve.md | 45 ++++ docs/label/Function.validateAbsolute.md | 25 +++ docs/label/Interface.AbsoluteLabel.md | 106 ++++++++++ docs/label/Interface.BazelFileTarget.md | 25 +++ docs/label/Interface.BazelRuleTarget.md | 25 +++ docs/label/Interface.ExactLabel.md | 106 ++++++++++ docs/label/Interface.Label.md | 89 ++++++++ docs/label/Interface.Spec.md | 109 ++++++++++ docs/label/Interface.TargetQueryConfig.md | 17 ++ docs/label/TypeAlias.BazelTarget.md | 11 + docs/label/Variable.BazelWildcardTargets.md | 25 +++ docs/label/index.md | 62 ++++++ label/BUILD.ts | 17 +- label/build-label.ts | 14 ++ label/exceptions.ts | 16 ++ label/exports.ts | 20 ++ label/label.ts | 46 +++++ label/parse.ts | 13 ++ label/query.ts | 68 ++++++ label/resolve.ts | 26 ++- label/specs/bazel-like.ts | 28 +++ package.json | 12 +- pnpm-lock.yaml | 15 ++ rslib.config.ts | 2 +- 37 files changed, 2045 insertions(+), 11 deletions(-) create mode 100644 .config/typedoc.json create mode 100644 docs/label/Class.BazelLikeSpec.md create mode 100644 docs/label/Class.CannotResolveFromSubPackages.md create mode 100644 docs/label/Class.InvalidLabel.md create mode 100644 docs/label/Class.NoMatchedPackages.md create mode 100644 docs/label/Class.NoMatchedTarget.md create mode 100644 docs/label/Class.TargetQuery.md create mode 100644 docs/label/Function.build.md create mode 100644 docs/label/Function.normalizePackage.md create mode 100644 docs/label/Function.parse.md create mode 100644 docs/label/Function.resolve.md create mode 100644 docs/label/Function.validateAbsolute.md create mode 100644 docs/label/Interface.AbsoluteLabel.md create mode 100644 docs/label/Interface.BazelFileTarget.md create mode 100644 docs/label/Interface.BazelRuleTarget.md create mode 100644 docs/label/Interface.ExactLabel.md create mode 100644 docs/label/Interface.Label.md create mode 100644 docs/label/Interface.Spec.md create mode 100644 docs/label/Interface.TargetQueryConfig.md create mode 100644 docs/label/TypeAlias.BazelTarget.md create mode 100644 docs/label/Variable.BazelWildcardTargets.md create mode 100644 docs/label/index.md diff --git a/.config/typedoc.json b/.config/typedoc.json new file mode 100644 index 0000000..174fb40 --- /dev/null +++ b/.config/typedoc.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "entryPoints": ["../label/exports.ts"], + "readme": "none", + "out": "../docs/label", + "plugin": ["typedoc-plugin-markdown"], + "hidePageHeader": true, + "flattenOutputFiles": true, + "indexFormat": "table", + "outputFileStrategy": "members", + "entryFileName": "index" +} diff --git a/.gitignore b/.gitignore index 8d4e81b..25f60bc 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ log/ **/*/typings/auto-generated modern.config.local.* + +tsdoc-metadata.json +temp/ \ No newline at end of file diff --git a/README.md b/README.md index 50ee2a8..16f80db 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ # @109cafe/label +A library for parsing, resolving, and querying Bazel-like labels. + +This package provides: + +- [TargetQuery](docs/label/Class.TargetQuery.md) for querying targets +- [BazelLikeSpec](docs/label/Class.BazelLikeSpec.md) for implementing your own Bazel-like label specification +- [parse](docs/label/Function.parse.md) for parsing labels +- [build](docs/label/Function.build.md) for building labels +- [resolve](docs/label/Function.resolve.md) for resolving labels + +This package is filesystem-agnostic so that you can use it in any JavaScript runtime. + +If you'd like to build a Bazel-like query in Node.js with `node:fs` and `glob`, please refer to the [@109cafe/dummy implementation](./dummy-spec/dummy-spec.ts). + +[API References](docs/label/index.md) \ No newline at end of file diff --git a/biome.json b/biome.json index 6e6357a..90f5f21 100644 --- a/biome.json +++ b/biome.json @@ -16,7 +16,7 @@ }, "overrides": [ { - "include": [".vscode/*.json", "**/tsconfig.json"], + "include": [".vscode/*.json", "**/tsconfig.json", "**/api-extractor.json"], "json": { "parser": { "allowComments": true, "allowTrailingCommas": true } } } ], diff --git a/docs/label/Class.BazelLikeSpec.md b/docs/label/Class.BazelLikeSpec.md new file mode 100644 index 0000000..34310a2 --- /dev/null +++ b/docs/label/Class.BazelLikeSpec.md @@ -0,0 +1,139 @@ +[@109cafe/label](index.md) / BazelLikeSpec + +# Class: `abstract` BazelLikeSpec\ + +An abstract spec for Bazel-like build systems + +## Type Parameters + +• **Target** *extends* [`BazelTarget`](TypeAlias.BazelTarget.md) + +## Implements + +- [`Spec`](Interface.Spec.md)\<`Target`\> + +## Constructors + +### new BazelLikeSpec() + +> **new BazelLikeSpec**\<`Target`\>(): [`BazelLikeSpec`](Class.BazelLikeSpec.md)\<`Target`\> + +#### Returns + +[`BazelLikeSpec`](Class.BazelLikeSpec.md)\<`Target`\> + +## Methods + +### extract() + +> **extract**(`targets`, `target`): `null` \| `string` \| `string`[] + +Extract targets from a package + +#### Parameters + +• **targets**: `Record`\<`string`, `Target`\> + +the map returned by `load` + +• **target**: `string` + +the target name in a label + +#### Returns + +`null` \| `string` \| `string`[] + +the matched target names or `null` if not found + +#### Implementation of + +[`Spec`](Interface.Spec.md).[`extract`](Interface.Spec.md#extract) + +#### Defined in + +[Developer/label/label/specs/bazel-like.ts:57](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L57) + +*** + +### load() + +> `abstract` **load**(`pkg`): `Promise`\<`Record`\<`string`, `Target`\>\> + +Load targets from a package + +#### Parameters + +• **pkg**: [`ExactLabel`](Interface.ExactLabel.md) + +the label that is returned by `lookup` + +#### Returns + +`Promise`\<`Record`\<`string`, `Target`\>\> + +a `` map for the package + +#### Implementation of + +[`Spec`](Interface.Spec.md).[`load`](Interface.Spec.md#load) + +#### Defined in + +[Developer/label/label/specs/bazel-like.ts:69](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L69) + +*** + +### lookup() + +> `abstract` **lookup**(`label`): `Promise`\<[`ExactLabel`](Interface.ExactLabel.md)[]\> + +Lookup packages by label. Typically, it should return a list label for the `BUILD` files of these packages. + +#### Parameters + +• **label**: [`Label`](Interface.Label.md) + +the label to lookup + +#### Returns + +`Promise`\<[`ExactLabel`](Interface.ExactLabel.md)[]\> + +a list of matched packages presented by `ExactLabel` + +#### Implementation of + +[`Spec`](Interface.Spec.md).[`lookup`](Interface.Spec.md#lookup) + +#### Defined in + +[Developer/label/label/specs/bazel-like.ts:68](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L68) + +*** + +### validate() + +> **validate**(`label`): `undefined` \| "\`...\` can only be used with wildcard targets" + +Validate a label + +#### Parameters + +• **label**: [`Label`](Interface.Label.md) + +the label to validate + +#### Returns + +`undefined` \| "\`...\` can only be used with wildcard targets" + +a string or an `Error` for invalid label, and falsy values for valid label + +#### Implementation of + +[`Spec`](Interface.Spec.md).[`validate`](Interface.Spec.md#validate) + +#### Defined in + +[Developer/label/label/specs/bazel-like.ts:48](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L48) diff --git a/docs/label/Class.CannotResolveFromSubPackages.md b/docs/label/Class.CannotResolveFromSubPackages.md new file mode 100644 index 0000000..3953fb4 --- /dev/null +++ b/docs/label/Class.CannotResolveFromSubPackages.md @@ -0,0 +1,193 @@ +[@109cafe/label](index.md) / CannotResolveFromSubPackages + +# Class: CannotResolveFromSubPackages + +Exception for resolving from sub-packages + +## Extends + +- `Error` + +## Constructors + +### new CannotResolveFromSubPackages() + +> **new CannotResolveFromSubPackages**(`label`): [`CannotResolveFromSubPackages`](Class.CannotResolveFromSubPackages.md) + +#### Parameters + +• **label**: [`Label`](Interface.Label.md) + +#### Returns + +[`CannotResolveFromSubPackages`](Class.CannotResolveFromSubPackages.md) + +#### Overrides + +`Error.constructor` + +#### Defined in + +[Developer/label/label/exceptions.ts:22](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L22) + +## Properties + +### cause? + +> `optional` **cause**: `unknown` + +#### Inherited from + +`Error.cause` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +*** + +### label + +> **label**: [`Label`](Interface.Label.md) + +#### Defined in + +[Developer/label/label/exceptions.ts:22](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L22) + +*** + +### message + +> **message**: `string` + +#### Inherited from + +`Error.message` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +*** + +### name + +> **name**: `string` + +#### Inherited from + +`Error.name` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +*** + +### stack? + +> `optional` **stack**: `string` + +#### Inherited from + +`Error.stack` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +*** + +### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +#### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +`Error.prepareStackTrace` + +#### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:143 + +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +#### Inherited from + +`Error.stackTraceLimit` + +#### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:145 + +## Methods + +### captureStackTrace() + +#### captureStackTrace(targetObject, constructorOpt) + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +##### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +##### Returns + +`void` + +##### Inherited from + +`Error.captureStackTrace` + +##### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:136 + +#### captureStackTrace(targetObject, constructorOpt) + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +##### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +##### Returns + +`void` + +##### Inherited from + +`Error.captureStackTrace` + +##### Defined in + +Developer/label/node\_modules/bun-types/globals.d.ts:1630 diff --git a/docs/label/Class.InvalidLabel.md b/docs/label/Class.InvalidLabel.md new file mode 100644 index 0000000..2347b34 --- /dev/null +++ b/docs/label/Class.InvalidLabel.md @@ -0,0 +1,195 @@ +[@109cafe/label](index.md) / InvalidLabel + +# Class: InvalidLabel + +Exception for invalid label + +## Extends + +- `Error` + +## Constructors + +### new InvalidLabel() + +> **new InvalidLabel**(`label`, `message`?): [`InvalidLabel`](Class.InvalidLabel.md) + +#### Parameters + +• **label**: `string` \| [`Label`](Interface.Label.md) + +• **message?**: `string` + +#### Returns + +[`InvalidLabel`](Class.InvalidLabel.md) + +#### Overrides + +`Error.constructor` + +#### Defined in + +[Developer/label/label/exceptions.ts:10](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L10) + +## Properties + +### cause? + +> `optional` **cause**: `unknown` + +#### Inherited from + +`Error.cause` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +*** + +### label + +> `readonly` **label**: `string` + +#### Defined in + +[Developer/label/label/exceptions.ts:9](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L9) + +*** + +### message + +> **message**: `string` + +#### Inherited from + +`Error.message` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +*** + +### name + +> **name**: `string` + +#### Inherited from + +`Error.name` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +*** + +### stack? + +> `optional` **stack**: `string` + +#### Inherited from + +`Error.stack` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +*** + +### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +#### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +`Error.prepareStackTrace` + +#### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:143 + +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +#### Inherited from + +`Error.stackTraceLimit` + +#### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:145 + +## Methods + +### captureStackTrace() + +#### captureStackTrace(targetObject, constructorOpt) + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +##### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +##### Returns + +`void` + +##### Inherited from + +`Error.captureStackTrace` + +##### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:136 + +#### captureStackTrace(targetObject, constructorOpt) + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +##### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +##### Returns + +`void` + +##### Inherited from + +`Error.captureStackTrace` + +##### Defined in + +Developer/label/node\_modules/bun-types/globals.d.ts:1630 diff --git a/docs/label/Class.NoMatchedPackages.md b/docs/label/Class.NoMatchedPackages.md new file mode 100644 index 0000000..d6fc425 --- /dev/null +++ b/docs/label/Class.NoMatchedPackages.md @@ -0,0 +1,193 @@ +[@109cafe/label](index.md) / NoMatchedPackages + +# Class: NoMatchedPackages + +Exception for no matched packages found + +## Extends + +- `Error` + +## Constructors + +### new NoMatchedPackages() + +> **new NoMatchedPackages**(`label`): [`NoMatchedPackages`](Class.NoMatchedPackages.md) + +#### Parameters + +• **label**: [`Label`](Interface.Label.md) + +#### Returns + +[`NoMatchedPackages`](Class.NoMatchedPackages.md) + +#### Overrides + +`Error.constructor` + +#### Defined in + +[Developer/label/label/exceptions.ts:32](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L32) + +## Properties + +### cause? + +> `optional` **cause**: `unknown` + +#### Inherited from + +`Error.cause` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +*** + +### label + +> **label**: [`Label`](Interface.Label.md) + +#### Defined in + +[Developer/label/label/exceptions.ts:32](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L32) + +*** + +### message + +> **message**: `string` + +#### Inherited from + +`Error.message` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +*** + +### name + +> **name**: `string` + +#### Inherited from + +`Error.name` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +*** + +### stack? + +> `optional` **stack**: `string` + +#### Inherited from + +`Error.stack` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +*** + +### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +#### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +`Error.prepareStackTrace` + +#### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:143 + +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +#### Inherited from + +`Error.stackTraceLimit` + +#### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:145 + +## Methods + +### captureStackTrace() + +#### captureStackTrace(targetObject, constructorOpt) + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +##### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +##### Returns + +`void` + +##### Inherited from + +`Error.captureStackTrace` + +##### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:136 + +#### captureStackTrace(targetObject, constructorOpt) + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +##### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +##### Returns + +`void` + +##### Inherited from + +`Error.captureStackTrace` + +##### Defined in + +Developer/label/node\_modules/bun-types/globals.d.ts:1630 diff --git a/docs/label/Class.NoMatchedTarget.md b/docs/label/Class.NoMatchedTarget.md new file mode 100644 index 0000000..1c0859e --- /dev/null +++ b/docs/label/Class.NoMatchedTarget.md @@ -0,0 +1,193 @@ +[@109cafe/label](index.md) / NoMatchedTarget + +# Class: NoMatchedTarget + +Exception for no matched target found + +## Extends + +- `Error` + +## Constructors + +### new NoMatchedTarget() + +> **new NoMatchedTarget**(`label`): [`NoMatchedTarget`](Class.NoMatchedTarget.md) + +#### Parameters + +• **label**: [`Label`](Interface.Label.md) + +#### Returns + +[`NoMatchedTarget`](Class.NoMatchedTarget.md) + +#### Overrides + +`Error.constructor` + +#### Defined in + +[Developer/label/label/exceptions.ts:42](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L42) + +## Properties + +### cause? + +> `optional` **cause**: `unknown` + +#### Inherited from + +`Error.cause` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 + +*** + +### label + +> **label**: [`Label`](Interface.Label.md) + +#### Defined in + +[Developer/label/label/exceptions.ts:42](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L42) + +*** + +### message + +> **message**: `string` + +#### Inherited from + +`Error.message` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +*** + +### name + +> **name**: `string` + +#### Inherited from + +`Error.name` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +*** + +### stack? + +> `optional` **stack**: `string` + +#### Inherited from + +`Error.stack` + +#### Defined in + +Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +*** + +### prepareStackTrace()? + +> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any` + +Optional override for formatting stack traces + +#### Parameters + +• **err**: `Error` + +• **stackTraces**: `CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +`Error.prepareStackTrace` + +#### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:143 + +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +#### Inherited from + +`Error.stackTraceLimit` + +#### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:145 + +## Methods + +### captureStackTrace() + +#### captureStackTrace(targetObject, constructorOpt) + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +##### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +##### Returns + +`void` + +##### Inherited from + +`Error.captureStackTrace` + +##### Defined in + +Developer/label/node\_modules/@types/node/globals.d.ts:136 + +#### captureStackTrace(targetObject, constructorOpt) + +> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` + +Create .stack property on a target object + +##### Parameters + +• **targetObject**: `object` + +• **constructorOpt?**: `Function` + +##### Returns + +`void` + +##### Inherited from + +`Error.captureStackTrace` + +##### Defined in + +Developer/label/node\_modules/bun-types/globals.d.ts:1630 diff --git a/docs/label/Class.TargetQuery.md b/docs/label/Class.TargetQuery.md new file mode 100644 index 0000000..f5aca32 --- /dev/null +++ b/docs/label/Class.TargetQuery.md @@ -0,0 +1,108 @@ +[@109cafe/label](index.md) / TargetQuery + +# Class: TargetQuery\ + +A query helper for targets + +## Example + +```ts +import { TargetQuery } from "@109cafe/label"; +import { DummySpec } from "@109cafe/dummy"; +const query = new TargetQuery(new DummySpec(__dirname, { ignore: ["e2e/**", "dist/**"] })); +const targets = await query.query(["//foo:all", "-//foo:bar"]); // query all targets in foo except bar +``` + +## Type Parameters + +• **Target** + +## Constructors + +### new TargetQuery() + +> **new TargetQuery**\<`Target`\>(`spec`, `config`): [`TargetQuery`](Class.TargetQuery.md)\<`Target`\> + +The spec for querying targets + +#### Parameters + +• **spec**: [`Spec`](Interface.Spec.md)\<`Target`\> + +the spec of build system + +• **config**: [`TargetQueryConfig`](Interface.TargetQueryConfig.md) = `{}` + +configuration for `TargetQuery` + +#### Returns + +[`TargetQuery`](Class.TargetQuery.md)\<`Target`\> + +#### Defined in + +[Developer/label/label/query.ts:72](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L72) + +## Properties + +### allowUnmatched + +> **allowUnmatched**: `boolean` + +**`Internal`** + +#### Defined in + +[Developer/label/label/query.ts:65](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L65) + +*** + +### spec + +> `readonly` **spec**: [`Spec`](Interface.Spec.md)\<`Target`\> + +**`Internal`** + +#### Defined in + +[Developer/label/label/query.ts:76](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L76) + +## Methods + +### query() + +> **query**(`_labels`, `_base`): `Promise`\<`Record`\<`string`, `Target`\>\> + +Query targets by labels + +#### Parameters + +• **\_labels**: `string`[] + +the labels to query, with `-` prefix for excluding labels + +• **\_base**: `string` = `"//"` + +the base label to resolve the labels, must be an absolute label + +#### Returns + +`Promise`\<`Record`\<`string`, `Target`\>\> + +a `` map of matched targets + +#### Throws + +[InvalidLabel](Class.InvalidLabel.md) if the label is invalid + +#### Throws + +[NoMatchedPackages](Class.NoMatchedPackages.md) if no matched packages are found + +#### Throws + +[NoMatchedTarget](Class.NoMatchedTarget.md) if no matched targets are found + +#### Defined in + +[Developer/label/label/query.ts:92](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L92) diff --git a/docs/label/Function.build.md b/docs/label/Function.build.md new file mode 100644 index 0000000..98ea2d2 --- /dev/null +++ b/docs/label/Function.build.md @@ -0,0 +1,33 @@ +[@109cafe/label](index.md) / build + +# Function: build() + +> **build**(`parsed`): `string` + +Build a label string from a parsed `Label` object + +## Parameters + +• **parsed**: [`Label`](Interface.Label.md) + +The parsed `Label` object + +## Returns + +`string` + +The label string + +## Example + +```ts +import { build } from "@109cafe/label"; +build({ package: "foo", target: "bar" }); // foo:bar +build({ package: "foo", includeSubPackages: true }); // foo/... +build({ scope: "", package: "foo" }); // //foo +build({ scope: "@npm", package: "foo" }); // @npm//foo +``` + +## Defined in + +[Developer/label/label/build-label.ts:17](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/build-label.ts#L17) diff --git a/docs/label/Function.normalizePackage.md b/docs/label/Function.normalizePackage.md new file mode 100644 index 0000000..d15bbe9 --- /dev/null +++ b/docs/label/Function.normalizePackage.md @@ -0,0 +1,21 @@ +[@109cafe/label](index.md) / normalizePackage + +# Function: normalizePackage() + +> **normalizePackage**(`path`): `string` + +remove the leading `./` in the package path for label specs + +## Parameters + +• **path**: `string` + +the package path + +## Returns + +`string` + +## Defined in + +[Developer/label/label/label.ts:62](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L62) diff --git a/docs/label/Function.parse.md b/docs/label/Function.parse.md new file mode 100644 index 0000000..21deff7 --- /dev/null +++ b/docs/label/Function.parse.md @@ -0,0 +1,27 @@ +[@109cafe/label](index.md) / parse + +# Function: parse() + +> **parse**(`label`): [`Label`](Interface.Label.md) + +Parse a label string into a `Label` object + +## Parameters + +• **label**: `string` \| [`Label`](Interface.Label.md) + +the label string to parse + +## Returns + +[`Label`](Interface.Label.md) + +The parsed `Label` object + +## Throws + +[InvalidLabel](Class.InvalidLabel.md) if the label is invalid + +## Defined in + +[Developer/label/label/parse.ts:24](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/parse.ts#L24) diff --git a/docs/label/Function.resolve.md b/docs/label/Function.resolve.md new file mode 100644 index 0000000..e5a5165 --- /dev/null +++ b/docs/label/Function.resolve.md @@ -0,0 +1,45 @@ +[@109cafe/label](index.md) / resolve + +# Function: resolve() + +> **resolve**\<`F`, `T`\>(`from`, `to`): `F` & `T` + +Resolve a label from another label + +## Type Parameters + +• **F** *extends* [`Label`](Interface.Label.md) + +• **T** *extends* `Partial`\<[`Label`](Interface.Label.md)\> + +## Parameters + +• **from**: `F` + +the label to resolve from + +• **to**: `T` + +the label to resolve to + +## Returns + +`F` & `T` + +## Example + +```ts +import { resolve } from "@109cafe/label"; +resolve({ package: "foo" }, { package: "bar" }); // { package: "foo/bar" } +resolve({ package: "foo" }, { scope: "", package: "bar" }); // { package: "//bar" } +resolve({ package: "foo" }, { package: "bar", target: "baz" }); // { package: "foo/bar", target: "baz" } +resolve({ package: "foo", target: "bar" }, { includeSubPackages: true }); // { package: "foo", includeSubPackages: true, target: "bar" } +``` + +## Throws + +[CannotResolveFromSubPackages](Class.CannotResolveFromSubPackages.md) if the `from` label includes subpackages + +## Defined in + +[Developer/label/label/resolve.ts:19](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/resolve.ts#L19) diff --git a/docs/label/Function.validateAbsolute.md b/docs/label/Function.validateAbsolute.md new file mode 100644 index 0000000..d6644a9 --- /dev/null +++ b/docs/label/Function.validateAbsolute.md @@ -0,0 +1,25 @@ +[@109cafe/label](index.md) / validateAbsolute + +# Function: validateAbsolute() + +> **validateAbsolute**(`label`): [`AbsoluteLabel`](Interface.AbsoluteLabel.md) + +Check if a label is with a scope + +## Parameters + +• **label**: `string` \| [`Label`](Interface.Label.md) + +the label to check + +## Returns + +[`AbsoluteLabel`](Interface.AbsoluteLabel.md) + +## Throws + +[InvalidLabel](Class.InvalidLabel.md) if the label is not an absolute label + +## Defined in + +[Developer/label/label/parse.ts:56](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/parse.ts#L56) diff --git a/docs/label/Interface.AbsoluteLabel.md b/docs/label/Interface.AbsoluteLabel.md new file mode 100644 index 0000000..95779fe --- /dev/null +++ b/docs/label/Interface.AbsoluteLabel.md @@ -0,0 +1,106 @@ +[@109cafe/label](index.md) / AbsoluteLabel + +# Interface: AbsoluteLabel + +An absolute label is a label that must includes a scope + +## Extends + +- [`Label`](Interface.Label.md) + +## Properties + +### includeSubPackages + +> **includeSubPackages**: `boolean` + +`includeSubPackages` is if the label includes sub-packages + +#### Example + +```ts +`true` in `//foo/...` +`false` in `//foo` +``` + +#### Inherited from + +[`Label`](Interface.Label.md).[`includeSubPackages`](Interface.Label.md#includesubpackages) + +#### Defined in + +[Developer/label/label/label.ts:29](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L29) + +*** + +### package + +> **package**: `string` + +The known part of package path of the package + +#### Example + +```ts +`foo` in `//foo` +`foo/bar` in `//foo/bar` +`foo` in `@npm//foo/...` +``` + +#### Inherited from + +[`Label`](Interface.Label.md).[`package`](Interface.Label.md#package) + +#### Defined in + +[Developer/label/label/label.ts:22](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L22) + +*** + +### scope + +> **scope**: `string` + +The scope of the package, typically following double slashes in label. +If the scope is `false`, it means the label is a relative label +If the scope is an empty string, it typically means main repository in most specs + +#### Example + +```ts +`@npm` in `@npm//foo` +empty string in `//foo` +`false` in `foo` +``` + +#### Overrides + +[`Label`](Interface.Label.md).[`scope`](Interface.Label.md#scope) + +#### Defined in + +[Developer/label/label/label.ts:45](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L45) + +*** + +### target + +> **target**: `string` + +The target of the package + +#### Example + +```ts +`bar` in `//foo:bar` +`wiz` in `//foo/bar/wiz` which includes an implicit target name +`all` in `//foo:all` which includes all targets in most specs +``` + +#### Inherited from + +[`Label`](Interface.Label.md).[`target`](Interface.Label.md#target) + +#### Defined in + +[Developer/label/label/label.ts:37](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L37) diff --git a/docs/label/Interface.BazelFileTarget.md b/docs/label/Interface.BazelFileTarget.md new file mode 100644 index 0000000..5b514bd --- /dev/null +++ b/docs/label/Interface.BazelFileTarget.md @@ -0,0 +1,25 @@ +[@109cafe/label](index.md) / BazelFileTarget + +# Interface: BazelFileTarget + +File target type + +## Properties + +### file + +> **file**: `unknown` + +#### Defined in + +[Developer/label/label/specs/bazel-like.ts:19](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L19) + +*** + +### type + +> **type**: `"file"` + +#### Defined in + +[Developer/label/label/specs/bazel-like.ts:18](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L18) diff --git a/docs/label/Interface.BazelRuleTarget.md b/docs/label/Interface.BazelRuleTarget.md new file mode 100644 index 0000000..ef563a2 --- /dev/null +++ b/docs/label/Interface.BazelRuleTarget.md @@ -0,0 +1,25 @@ +[@109cafe/label](index.md) / BazelRuleTarget + +# Interface: BazelRuleTarget + +Rule target type + +## Properties + +### rule + +> **rule**: `unknown` + +#### Defined in + +[Developer/label/label/specs/bazel-like.ts:10](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L10) + +*** + +### type + +> **type**: `"rule"` + +#### Defined in + +[Developer/label/label/specs/bazel-like.ts:9](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L9) diff --git a/docs/label/Interface.ExactLabel.md b/docs/label/Interface.ExactLabel.md new file mode 100644 index 0000000..8350ac1 --- /dev/null +++ b/docs/label/Interface.ExactLabel.md @@ -0,0 +1,106 @@ +[@109cafe/label](index.md) / ExactLabel + +# Interface: ExactLabel + +An exact label is a label that must includes a scope and cannot include sub-packages + +## Extends + +- [`Label`](Interface.Label.md) + +## Properties + +### includeSubPackages + +> **includeSubPackages**: `false` + +`includeSubPackages` is if the label includes sub-packages + +#### Example + +```ts +`true` in `//foo/...` +`false` in `//foo` +``` + +#### Overrides + +[`Label`](Interface.Label.md).[`includeSubPackages`](Interface.Label.md#includesubpackages) + +#### Defined in + +[Developer/label/label/label.ts:54](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L54) + +*** + +### package + +> **package**: `string` + +The known part of package path of the package + +#### Example + +```ts +`foo` in `//foo` +`foo/bar` in `//foo/bar` +`foo` in `@npm//foo/...` +``` + +#### Inherited from + +[`Label`](Interface.Label.md).[`package`](Interface.Label.md#package) + +#### Defined in + +[Developer/label/label/label.ts:22](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L22) + +*** + +### scope + +> **scope**: `string` + +The scope of the package, typically following double slashes in label. +If the scope is `false`, it means the label is a relative label +If the scope is an empty string, it typically means main repository in most specs + +#### Example + +```ts +`@npm` in `@npm//foo` +empty string in `//foo` +`false` in `foo` +``` + +#### Overrides + +[`Label`](Interface.Label.md).[`scope`](Interface.Label.md#scope) + +#### Defined in + +[Developer/label/label/label.ts:53](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L53) + +*** + +### target + +> **target**: `string` + +The target of the package + +#### Example + +```ts +`bar` in `//foo:bar` +`wiz` in `//foo/bar/wiz` which includes an implicit target name +`all` in `//foo:all` which includes all targets in most specs +``` + +#### Inherited from + +[`Label`](Interface.Label.md).[`target`](Interface.Label.md#target) + +#### Defined in + +[Developer/label/label/label.ts:37](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L37) diff --git a/docs/label/Interface.Label.md b/docs/label/Interface.Label.md new file mode 100644 index 0000000..e6b456f --- /dev/null +++ b/docs/label/Interface.Label.md @@ -0,0 +1,89 @@ +[@109cafe/label](index.md) / Label + +# Interface: Label + +## Extended by + +- [`AbsoluteLabel`](Interface.AbsoluteLabel.md) +- [`ExactLabel`](Interface.ExactLabel.md) + +## Properties + +### includeSubPackages + +> **includeSubPackages**: `boolean` + +`includeSubPackages` is if the label includes sub-packages + +#### Example + +```ts +`true` in `//foo/...` +`false` in `//foo` +``` + +#### Defined in + +[Developer/label/label/label.ts:29](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L29) + +*** + +### package + +> **package**: `string` + +The known part of package path of the package + +#### Example + +```ts +`foo` in `//foo` +`foo/bar` in `//foo/bar` +`foo` in `@npm//foo/...` +``` + +#### Defined in + +[Developer/label/label/label.ts:22](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L22) + +*** + +### scope + +> **scope**: `string` \| `false` + +The scope of the package, typically following double slashes in label. +If the scope is `false`, it means the label is a relative label +If the scope is an empty string, it typically means main repository in most specs + +#### Example + +```ts +`@npm` in `@npm//foo` +empty string in `//foo` +`false` in `foo` +``` + +#### Defined in + +[Developer/label/label/label.ts:14](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L14) + +*** + +### target + +> **target**: `string` + +The target of the package + +#### Example + +```ts +`bar` in `//foo:bar` +`wiz` in `//foo/bar/wiz` which includes an implicit target name +`all` in `//foo:all` which includes all targets in most specs +``` + +#### Defined in + +[Developer/label/label/label.ts:37](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L37) diff --git a/docs/label/Interface.Spec.md b/docs/label/Interface.Spec.md new file mode 100644 index 0000000..9901d0b --- /dev/null +++ b/docs/label/Interface.Spec.md @@ -0,0 +1,109 @@ +[@109cafe/label](index.md) / Spec + +# Interface: Spec\ + +A specification for querying targets. E.g., Bazel-like, Buck-like, Non-FS Spec etc. + +## Type Parameters + +• **Target** + +## Properties + +### extract() + +> **extract**: (`targets`, `target`) => `null` \| `string` \| `string`[] + +Extract targets from a package + +#### Parameters + +• **targets**: `Record`\<`string`, `Target`\> + +the map returned by `load` + +• **target**: `string` + +the target name in a label + +#### Returns + +`null` \| `string` \| `string`[] + +the matched target names or `null` if not found + +#### Defined in + +[Developer/label/label/query.ts:36](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L36) + +*** + +### load() + +> **load**: (`pkg`) => `Promise`\<`Record`\<`string`, `Target`\>\> + +Load targets from a package + +#### Parameters + +• **pkg**: [`ExactLabel`](Interface.ExactLabel.md) + +the label that is returned by `lookup` + +#### Returns + +`Promise`\<`Record`\<`string`, `Target`\>\> + +a `` map for the package + +#### Defined in + +[Developer/label/label/query.ts:29](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L29) + +*** + +### lookup() + +> **lookup**: (`label`) => [`ExactLabel`](Interface.ExactLabel.md)[] \| `Promise`\<[`ExactLabel`](Interface.ExactLabel.md)[]\> + +Lookup packages by label. Typically, it should return a list label for the `BUILD` files of these packages. + +#### Parameters + +• **label**: [`AbsoluteLabel`](Interface.AbsoluteLabel.md) + +the label to lookup + +#### Returns + +[`ExactLabel`](Interface.ExactLabel.md)[] \| `Promise`\<[`ExactLabel`](Interface.ExactLabel.md)[]\> + +a list of matched packages presented by `ExactLabel` + +#### Defined in + +[Developer/label/label/query.ts:23](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L23) + +*** + +### validate() + +> **validate**: (`label`) => `undefined` \| `null` \| `string` \| `void` \| `Error` + +Validate a label + +#### Parameters + +• **label**: [`AbsoluteLabel`](Interface.AbsoluteLabel.md) + +the label to validate + +#### Returns + +`undefined` \| `null` \| `string` \| `void` \| `Error` + +a string or an `Error` for invalid label, and falsy values for valid label + +#### Defined in + +[Developer/label/label/query.ts:17](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L17) diff --git a/docs/label/Interface.TargetQueryConfig.md b/docs/label/Interface.TargetQueryConfig.md new file mode 100644 index 0000000..593328b --- /dev/null +++ b/docs/label/Interface.TargetQueryConfig.md @@ -0,0 +1,17 @@ +[@109cafe/label](index.md) / TargetQueryConfig + +# Interface: TargetQueryConfig + +Configuration for querying targets + +## Properties + +### allowUnmatched? + +> `optional` **allowUnmatched**: `boolean` + +Allow unmatched labels. If `true`, the query will not throw an error when no matched packages or targets are found. + +#### Defined in + +[Developer/label/label/query.ts:47](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L47) diff --git a/docs/label/TypeAlias.BazelTarget.md b/docs/label/TypeAlias.BazelTarget.md new file mode 100644 index 0000000..1e86967 --- /dev/null +++ b/docs/label/TypeAlias.BazelTarget.md @@ -0,0 +1,11 @@ +[@109cafe/label](index.md) / BazelTarget + +# Type Alias: BazelTarget + +> **BazelTarget**: [`BazelRuleTarget`](Interface.BazelRuleTarget.md) \| [`BazelFileTarget`](Interface.BazelFileTarget.md) + +Bazel target type + +## Defined in + +[Developer/label/label/specs/bazel-like.ts:26](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L26) diff --git a/docs/label/Variable.BazelWildcardTargets.md b/docs/label/Variable.BazelWildcardTargets.md new file mode 100644 index 0000000..879d0bd --- /dev/null +++ b/docs/label/Variable.BazelWildcardTargets.md @@ -0,0 +1,25 @@ +[@109cafe/label](index.md) / BazelWildcardTargets + +# Variable: BazelWildcardTargets + +> `const` **BazelWildcardTargets**: `object` + +Bazel wildcard targets + +## Type declaration + +### AllRules + +> **AllRules**: `string`[] + +indicates all rule targets in the package + +### AllTargets + +> **AllTargets**: `string`[] + +indicates all rule targets and file targets in the package + +## Defined in + +[Developer/label/label/specs/bazel-like.ts:32](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L32) diff --git a/docs/label/index.md b/docs/label/index.md new file mode 100644 index 0000000..1799b38 --- /dev/null +++ b/docs/label/index.md @@ -0,0 +1,62 @@ +# @109cafe/label + +A library for parsing, resolving, and querying Bazel-like labels. + +## Remarks + +This package provides: + +- [TargetQuery](Class.TargetQuery.md) for querying targets +- [BazelLikeSpec](Class.BazelLikeSpec.md) for implementing your own Bazel-like label specification +- [parse](Function.parse.md) for parsing labels +- [build](Function.build.md) for building labels +- [resolve](Function.resolve.md) for resolving labels + +This package is filesystem-agnostic so that you can use it in any JavaScript runtime. + +If you'd like to build a Bazel-like query in Node.js with `node:fs` and `glob`, please refer to the [the @109cafe/dummy implementation](https://github.com/xc2/label/blob/main/dummy-spec/dummy-spec.ts). + +## Classes + +| Class | Description | +| ------ | ------ | +| [BazelLikeSpec](Class.BazelLikeSpec.md) | An abstract spec for Bazel-like build systems | +| [CannotResolveFromSubPackages](Class.CannotResolveFromSubPackages.md) | Exception for resolving from sub-packages | +| [InvalidLabel](Class.InvalidLabel.md) | Exception for invalid label | +| [NoMatchedPackages](Class.NoMatchedPackages.md) | Exception for no matched packages found | +| [NoMatchedTarget](Class.NoMatchedTarget.md) | Exception for no matched target found | +| [TargetQuery](Class.TargetQuery.md) | A query helper for targets | + +## Interfaces + +| Interface | Description | +| ------ | ------ | +| [AbsoluteLabel](Interface.AbsoluteLabel.md) | An absolute label is a label that must includes a scope | +| [BazelFileTarget](Interface.BazelFileTarget.md) | File target type | +| [BazelRuleTarget](Interface.BazelRuleTarget.md) | Rule target type | +| [ExactLabel](Interface.ExactLabel.md) | An exact label is a label that must includes a scope and cannot include sub-packages | +| [Label](Interface.Label.md) | - | +| [Spec](Interface.Spec.md) | A specification for querying targets. E.g., Bazel-like, Buck-like, Non-FS Spec etc. | +| [TargetQueryConfig](Interface.TargetQueryConfig.md) | Configuration for querying targets | + +## Type Aliases + +| Type alias | Description | +| ------ | ------ | +| [BazelTarget](TypeAlias.BazelTarget.md) | Bazel target type | + +## Variables + +| Variable | Description | +| ------ | ------ | +| [BazelWildcardTargets](Variable.BazelWildcardTargets.md) | Bazel wildcard targets | + +## Functions + +| Function | Description | +| ------ | ------ | +| [build](Function.build.md) | Build a label string from a parsed `Label` object | +| [normalizePackage](Function.normalizePackage.md) | remove the leading `./` in the package path for label specs | +| [parse](Function.parse.md) | Parse a label string into a `Label` object | +| [resolve](Function.resolve.md) | Resolve a label from another label | +| [validateAbsolute](Function.validateAbsolute.md) | Check if a label is with a scope | diff --git a/label/BUILD.ts b/label/BUILD.ts index fe43d81..6ef6c8c 100644 --- a/label/BUILD.ts +++ b/label/BUILD.ts @@ -10,7 +10,21 @@ export default ({ tools, pkg }: Context): Record => { main: [`${pkg}/**/*.ts`, "!**/*.spec.ts", "!**/*.test.ts", "!**/__*__", "!**/BUILD.ts"], }, }, - output: { distPath: { root: `./dist/${pkg}` } }, + output: { + distPath: { root: `./dist/${pkg}` }, + minify: { + jsOptions: { + minimizerOptions: { + compress: false, + mangle: false, + format: { + comments: "some", + beautify: true, + }, + }, + }, + }, + }, bundle: false, dts: false, } satisfies LibConfig); @@ -34,6 +48,7 @@ export default ({ tools, pkg }: Context): Record => { output: { distPath: { root: `./dist/${pkg}` }, copy: [{ from: `${pkg}/manifest.json`, to: "package.json" }, { from: `${pkg}/README.md` }], + minify: { js: false }, }, dts: { bundle: false }, }, diff --git a/label/build-label.ts b/label/build-label.ts index e23efba..a2dd196 100644 --- a/label/build-label.ts +++ b/label/build-label.ts @@ -1,5 +1,19 @@ import type { Label } from "./label"; +/** + * Build a label string from a parsed `Label` object + * @public + * @example + * ```ts + * import { build } from "@109cafe/label"; + * build({ package: "foo", target: "bar" }); // foo:bar + * build({ package: "foo", includeSubPackages: true }); // foo/... + * build({ scope: "", package: "foo" }); // //foo + * build({ scope: "@npm", package: "foo" }); // @npm//foo + * ``` + * @param parsed - The parsed `Label` object + * @returns The label string + */ export function build(parsed: Label): string { let label = ""; if (typeof parsed.scope === "string") { diff --git a/label/exceptions.ts b/label/exceptions.ts index 50ae64e..24c8672 100644 --- a/label/exceptions.ts +++ b/label/exceptions.ts @@ -1,6 +1,10 @@ import { build } from "./build-label"; import type { Label } from "./label"; +/** + * Exception for invalid label + * @public + */ export class InvalidLabel extends Error { readonly label: string; constructor(label: string | Label, message?: string) { @@ -10,18 +14,30 @@ export class InvalidLabel extends Error { } } +/** + * Exception for resolving from sub-packages + * @public + */ export class CannotResolveFromSubPackages extends Error { constructor(public label: Label) { super("Cannot resolve from a label that includes subpackages: " + build(label)); } } +/** + * Exception for no matched packages found + * @public + */ export class NoMatchedPackages extends Error { constructor(public label: Label) { super("Cannot find any matched packages: " + build(label)); } } +/** + * Exception for no matched target found + * @public + */ export class NoMatchedTarget extends Error { constructor(public label: Label) { super("Cannot find any matched target: " + build(label)); diff --git a/label/exports.ts b/label/exports.ts index f1728f1..0e6a5ef 100644 --- a/label/exports.ts +++ b/label/exports.ts @@ -1,3 +1,23 @@ +/** + * + * A library for parsing, resolving, and querying Bazel-like labels. + * + * @remarks + * This package provides: + * + * - {@link TargetQuery} for querying targets + * - {@link BazelLikeSpec} for implementing your own Bazel-like label specification + * - {@link parse} for parsing labels + * - {@link build} for building labels + * - {@link resolve} for resolving labels + * + * This package is filesystem-agnostic so that you can use it in any JavaScript runtime. + * + * If you'd like to build a Bazel-like query in Node.js with `node:fs` and `glob`, please refer to the {@link https://github.com/xc2/label/blob/main/dummy-spec/dummy-spec.ts | the @109cafe/dummy implementation}. + * + * @packageDocumentation + */ + export * from "./build-label"; export * from "./exceptions"; export * from "./label"; diff --git a/label/label.ts b/label/label.ts index d8a796b..c0e7e97 100644 --- a/label/label.ts +++ b/label/label.ts @@ -1,18 +1,64 @@ +/** + * @public + */ export interface Label { + /** + * The scope of the package, typically following double slashes in label. + * If the scope is `false`, it means the label is a relative label + * If the scope is an empty string, it typically means main repository in most specs + * @example + * `@npm` in `@npm//foo` + * empty string in `//foo` + * `false` in `foo` + */ scope: string | false; + /** + * The known part of package path of the package + * @example + * `foo` in `//foo` + * `foo/bar` in `//foo/bar` + * `foo` in `@npm//foo/...` + */ package: string; + /** + * `includeSubPackages` is if the label includes sub-packages + * @example + * `true` in `//foo/...` + * `false` in `//foo` + */ includeSubPackages: boolean; + /** + * The target of the package + * @example + * `bar` in `//foo:bar` + * `wiz` in `//foo/bar/wiz` which includes an implicit target name + * `all` in `//foo:all` which includes all targets in most specs + */ target: string; } + +/** + * An absolute label is a label that must includes a scope + * @public + */ export interface AbsoluteLabel extends Label { scope: string; } +/** + * An exact label is a label that must includes a scope and cannot include sub-packages + * @public + */ export interface ExactLabel extends Label { scope: string; includeSubPackages: false; } +/** + * remove the leading `./` in the package path for label specs + * @param path - the package path + * @public + */ export function normalizePackage(path: string) { if (path === ".") return ""; if (path.startsWith("./")) return path.slice(2); diff --git a/label/parse.ts b/label/parse.ts index 8de914c..c33c750 100644 --- a/label/parse.ts +++ b/label/parse.ts @@ -14,6 +14,13 @@ function determineTarget(target: string, packageLastPart: string): string { } } +/** + * Parse a label string into a `Label` object + * @public + * @param label - the label string to parse + * @throws {@link InvalidLabel} if the label is invalid + * @returns The parsed `Label` object + */ export function parse(label: string | Label): Label { if (typeof label !== "string") { return label; @@ -40,6 +47,12 @@ export function parse(label: string | Label): Label { } as Label; } +/** + * Check if a label is with a scope + * @param label - the label to check + * @throws {@link InvalidLabel} if the label is not an absolute label + * @public + */ export function validateAbsolute(label: string | Label): AbsoluteLabel { const l = parse(label); if (l.scope !== false) { diff --git a/label/query.ts b/label/query.ts index f25fc94..4d172e7 100644 --- a/label/query.ts +++ b/label/query.ts @@ -4,23 +4,91 @@ import type { AbsoluteLabel, ExactLabel } from "./label"; import { parse, validateAbsolute } from "./parse"; import { resolve } from "./resolve"; +/** + * A specification for querying targets. E.g., Bazel-like, Buck-like, Non-FS Spec etc. + * @public + */ export interface Spec { + /** + * Validate a label + * @param label - the label to validate + * @returns a string or an `Error` for invalid label, and falsy values for valid label + */ validate: (label: AbsoluteLabel) => string | Error | void | undefined | null; + /** + * Lookup packages by label. Typically, it should return a list label for the `BUILD` files of these packages. + * @param label - the label to lookup + * @returns a list of matched packages presented by `ExactLabel` + */ lookup: (label: AbsoluteLabel) => ExactLabel[] | Promise; + /** + * Load targets from a package + * @param pkg - the label that is returned by `lookup` + * @returns a `` map for the package + */ load: (pkg: ExactLabel) => Promise>; + /** + * Extract targets from a package + * @param targets - the map returned by `load` + * @param target - the target name in a label + * @returns the matched target names or `null` if not found + */ extract: (targets: Record, target: string) => string | string[] | null; } + +/** + * Configuration for querying targets + * @public + */ export interface TargetQueryConfig { + /** + * Allow unmatched labels. If `true`, the query will not throw an error when no matched packages or targets are found. + */ allowUnmatched?: boolean; } + +/** + * A query helper for targets + * @public + * @example + * ```ts + * import { TargetQuery } from "@109cafe/label"; + * import { DummySpec } from "@109cafe/dummy"; + * const query = new TargetQuery(new DummySpec(__dirname, { ignore: ["e2e/**", "dist/**"] })); + * const targets = await query.query(["//foo:all", "-//foo:bar"]); // query all targets in foo except bar + * ``` + */ export class TargetQuery { + /** + * @internal + */ allowUnmatched: boolean; + + /** + * The spec for querying targets + * @param spec - the spec of build system + * @param config - configuration for `TargetQuery` + */ constructor( + /** + * @internal + */ public readonly spec: Spec, config: TargetQueryConfig = {} ) { this.allowUnmatched = config.allowUnmatched || false; } + + /** + * Query targets by labels + * @param _labels - the labels to query, with `-` prefix for excluding labels + * @param _base - the base label to resolve the labels, must be an absolute label + * @throws {@link InvalidLabel} if the label is invalid + * @throws {@link NoMatchedPackages} if no matched packages are found + * @throws {@link NoMatchedTarget} if no matched targets are found + * @returns a `` map of matched targets + * @public + */ async query(_labels: string[], _base = "//"): Promise> { const base = validateAbsolute(_base); const filters = _labels.map((v) => { diff --git a/label/resolve.ts b/label/resolve.ts index 6d1ba8c..2f67a8d 100644 --- a/label/resolve.ts +++ b/label/resolve.ts @@ -1,14 +1,34 @@ import { CannotResolveFromSubPackages } from "./exceptions"; import { type Label, normalizePackage } from "./label"; +/** + * Resolve a label from another label + * @example + * ```ts + * import { resolve } from "@109cafe/label"; + * resolve({ package: "foo" }, { package: "bar" }); // { package: "foo/bar" } + * resolve({ package: "foo" }, { scope: "", package: "bar" }); // { package: "//bar" } + * resolve({ package: "foo" }, { package: "bar", target: "baz" }); // { package: "foo/bar", target: "baz" } + * resolve({ package: "foo", target: "bar" }, { includeSubPackages: true }); // { package: "foo", includeSubPackages: true, target: "bar" } + * ``` + * @public + * @param from - the label to resolve from + * @param to - the label to resolve to + * @throws {@link CannotResolveFromSubPackages} if the `from` label includes subpackages + */ export function resolve>(from: F, to: T): F & T { if (from.includeSubPackages) { throw new CannotResolveFromSubPackages(from); } + const scope = typeof to.scope === "string" ? to.scope : from.scope; + const includeSubPackages = to.includeSubPackages ?? from.includeSubPackages; return { - scope: typeof to.scope === "string" ? to.scope : from.scope, - package: [from.package, to.package ?? ""].map(normalizePackage).filter(Boolean).join("/"), - includeSubPackages: to.includeSubPackages ?? from.includeSubPackages, + scope, + package: [typeof to.scope === "string" ? "" : from.package, to.package ?? ""] + .map(normalizePackage) + .filter(Boolean) + .join("/"), + includeSubPackages, target: to.target ?? from.target, } satisfies Label as any; } diff --git a/label/specs/bazel-like.ts b/label/specs/bazel-like.ts index aef348e..7c7a659 100644 --- a/label/specs/bazel-like.ts +++ b/label/specs/bazel-like.ts @@ -1,21 +1,49 @@ import type { ExactLabel, Label } from "../label"; import type { Spec } from "../query"; +/** + * Rule target type + * @public + */ export interface BazelRuleTarget { type: "rule"; rule: unknown; } + +/** + * File target type + * @public + */ export interface BazelFileTarget { type: "file"; file: unknown; } + +/** + * Bazel target type + * @public + */ export type BazelTarget = BazelRuleTarget | BazelFileTarget; +/** + * Bazel wildcard targets + * @public + */ export const BazelWildcardTargets = { + /** + * indicates all rule targets and file targets in the package + */ AllTargets: ["all-targets", "*"], + /** + * indicates all rule targets in the package + */ AllRules: ["all"], }; +/** + * An abstract spec for Bazel-like build systems + * @public + */ export abstract class BazelLikeSpec implements Spec { validate(label: Label) { if ( diff --git a/package.json b/package.json index c485e42..e791558 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { - "name": "why-name-is-required-by-api-extractor", + "name": "@109cafe/label", "type": "module", "scripts": { "build": "rslib build", "build:watch": "rslib build -w", "build:self": "rslib build -c rslib-self.config.ts && rslib build -c .rslib.config.js", - "pack:label": "pnpm build:self -- //label:all && npm pack ./dist/label --pack-destination ./dist/label", - "pack:dummy": "pnpm build:self -- //dummy-spec:all && npm pack ./dist/dummy-spec --pack-destination ./dist/dummy-spec", + "pack:label": "pnpm build -- //label:all && npm pack ./dist/label --pack-destination ./dist/label", + "pack:dummy": "pnpm build -- //dummy-spec:all && npm pack ./dist/dummy-spec --pack-destination ./dist/dummy-spec", "prepare": "pnpm --package husky@9.1.1 dlx husky", - "test": "pnpm --package bun@1.1.34 dlx bun test" + "test": "pnpm --package bun@1.1.34 dlx bun test --coverage", + "docs": "pnpm --package typedoc-plugin-markdown@4.2.10 --package typedoc dlx typedoc" }, "devDependencies": { "@biomejs/biome": "^1.9.4", @@ -17,7 +18,8 @@ "@types/lodash-es": "^4.17.12", "glob": "^11.0.0", "lodash-es": "^4.17.21", - "typescript": "^5.6.3" + "typescript": "^5.6.3", + "@109cafe/dummy": "^0.1.1" }, "nano-staged": { "*.{js,ts,cts,mts}": "biome check --write --diagnostic-level=error --no-errors-on-unmatched" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 23c2a56..5532ba7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,6 +16,9 @@ importers: .: devDependencies: + '@109cafe/dummy': + specifier: ^0.1.1 + version: 0.1.1 '@biomejs/biome': specifier: ^1.9.4 version: 1.9.4 @@ -40,6 +43,12 @@ importers: packages: + '@109cafe/dummy@0.1.1': + resolution: {integrity: sha512-Y+480VhP43mLQWEE6ftzkK+ILrwkn/uFGjp3M3wcb5+Hyh90HepPZI+xHoZtT3baEiTn9rFZ0Gc8FjdOl9tJFQ==} + + '@109cafe/label@0.1.0': + resolution: {integrity: sha512-jiLDMDgIt+zgJ1ZN/rImBh19aOuFwK/F95h7WBFlbGK9v2k1NHAM06EVtGRKGvW8JfBC8Jeb9x38IqGPP5s9qA==} + '@biomejs/biome@1.9.4': resolution: {integrity: sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==} engines: {node: '>=14.21.3'} @@ -581,6 +590,12 @@ packages: snapshots: + '@109cafe/dummy@0.1.1': + dependencies: + '@109cafe/label': 0.1.0 + + '@109cafe/label@0.1.0': {} + '@biomejs/biome@1.9.4': optionalDependencies: '@biomejs/cli-darwin-arm64': 1.9.4 diff --git a/rslib.config.ts b/rslib.config.ts index ad813be..51883f1 100644 --- a/rslib.config.ts +++ b/rslib.config.ts @@ -1,4 +1,4 @@ -import { DummyQuery } from "@109cafe/dummy-spec"; +import { DummyQuery } from "@109cafe/dummy"; import { type LibConfig, defineConfig } from "@rslib/core"; const tripleSlashIndex = process.argv.indexOf("--"); let labels: string[] = []; From 9b02eb72e0dce023c5978def7d095b973d68520e Mon Sep 17 00:00:00 2001 From: xc2 Date: Tue, 12 Nov 2024 23:04:27 +0800 Subject: [PATCH 2/2] a --- .config/typedoc.json | 4 +- biome.json | 2 +- docs/label/Class.BazelLikeSpec.md | 16 -------- .../Class.CannotResolveFromSubPackages.md | 40 ------------------- docs/label/Class.InvalidLabel.md | 40 ------------------- docs/label/Class.NoMatchedPackages.md | 40 ------------------- docs/label/Class.NoMatchedTarget.md | 40 ------------------- docs/label/Class.TargetQuery.md | 32 --------------- docs/label/Function.build.md | 4 -- docs/label/Function.normalizePackage.md | 4 -- docs/label/Function.parse.md | 4 -- docs/label/Function.resolve.md | 4 -- docs/label/Function.validateAbsolute.md | 4 -- docs/label/Interface.AbsoluteLabel.md | 16 -------- docs/label/Interface.BazelFileTarget.md | 8 ---- docs/label/Interface.BazelRuleTarget.md | 8 ---- docs/label/Interface.ExactLabel.md | 16 -------- docs/label/Interface.Label.md | 16 -------- docs/label/Interface.Spec.md | 16 -------- docs/label/Interface.TargetQueryConfig.md | 4 -- docs/label/TypeAlias.BazelTarget.md | 4 -- docs/label/Variable.BazelWildcardTargets.md | 4 -- label/query.ts | 14 +++---- 23 files changed, 11 insertions(+), 329 deletions(-) diff --git a/.config/typedoc.json b/.config/typedoc.json index 174fb40..43a29d3 100644 --- a/.config/typedoc.json +++ b/.config/typedoc.json @@ -8,5 +8,7 @@ "flattenOutputFiles": true, "indexFormat": "table", "outputFileStrategy": "members", - "entryFileName": "index" + "entryFileName": "index", + "excludeInternal": true, + "disableSources": true } diff --git a/biome.json b/biome.json index 90f5f21..3c3dd5e 100644 --- a/biome.json +++ b/biome.json @@ -12,7 +12,7 @@ } }, "files": { - "ignore": ["worker-configuration.d.ts", "**/gen/**", "**/*.gen.*"] + "ignore": ["worker-configuration.d.ts", "**/gen/**", "**/*.gen.*", "**/docs/**"] }, "overrides": [ { diff --git a/docs/label/Class.BazelLikeSpec.md b/docs/label/Class.BazelLikeSpec.md index 34310a2..f91da8e 100644 --- a/docs/label/Class.BazelLikeSpec.md +++ b/docs/label/Class.BazelLikeSpec.md @@ -50,10 +50,6 @@ the matched target names or `null` if not found [`Spec`](Interface.Spec.md).[`extract`](Interface.Spec.md#extract) -#### Defined in - -[Developer/label/label/specs/bazel-like.ts:57](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L57) - *** ### load() @@ -78,10 +74,6 @@ a `` map for the package [`Spec`](Interface.Spec.md).[`load`](Interface.Spec.md#load) -#### Defined in - -[Developer/label/label/specs/bazel-like.ts:69](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L69) - *** ### lookup() @@ -106,10 +98,6 @@ a list of matched packages presented by `ExactLabel` [`Spec`](Interface.Spec.md).[`lookup`](Interface.Spec.md#lookup) -#### Defined in - -[Developer/label/label/specs/bazel-like.ts:68](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L68) - *** ### validate() @@ -133,7 +121,3 @@ a string or an `Error` for invalid label, and falsy values for valid label #### Implementation of [`Spec`](Interface.Spec.md).[`validate`](Interface.Spec.md#validate) - -#### Defined in - -[Developer/label/label/specs/bazel-like.ts:48](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L48) diff --git a/docs/label/Class.CannotResolveFromSubPackages.md b/docs/label/Class.CannotResolveFromSubPackages.md index 3953fb4..094985d 100644 --- a/docs/label/Class.CannotResolveFromSubPackages.md +++ b/docs/label/Class.CannotResolveFromSubPackages.md @@ -26,10 +26,6 @@ Exception for resolving from sub-packages `Error.constructor` -#### Defined in - -[Developer/label/label/exceptions.ts:22](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L22) - ## Properties ### cause? @@ -40,20 +36,12 @@ Exception for resolving from sub-packages `Error.cause` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 - *** ### label > **label**: [`Label`](Interface.Label.md) -#### Defined in - -[Developer/label/label/exceptions.ts:22](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L22) - *** ### message @@ -64,10 +52,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.message` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1077 - *** ### name @@ -78,10 +62,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.name` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1076 - *** ### stack? @@ -92,10 +72,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.stack` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1078 - *** ### prepareStackTrace()? @@ -122,10 +98,6 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces `Error.prepareStackTrace` -#### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:143 - *** ### stackTraceLimit @@ -136,10 +108,6 @@ Developer/label/node\_modules/@types/node/globals.d.ts:143 `Error.stackTraceLimit` -#### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:145 - ## Methods ### captureStackTrace() @@ -164,10 +132,6 @@ Create .stack property on a target object `Error.captureStackTrace` -##### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:136 - #### captureStackTrace(targetObject, constructorOpt) > `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` @@ -187,7 +151,3 @@ Create .stack property on a target object ##### Inherited from `Error.captureStackTrace` - -##### Defined in - -Developer/label/node\_modules/bun-types/globals.d.ts:1630 diff --git a/docs/label/Class.InvalidLabel.md b/docs/label/Class.InvalidLabel.md index 2347b34..abd0a87 100644 --- a/docs/label/Class.InvalidLabel.md +++ b/docs/label/Class.InvalidLabel.md @@ -28,10 +28,6 @@ Exception for invalid label `Error.constructor` -#### Defined in - -[Developer/label/label/exceptions.ts:10](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L10) - ## Properties ### cause? @@ -42,20 +38,12 @@ Exception for invalid label `Error.cause` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 - *** ### label > `readonly` **label**: `string` -#### Defined in - -[Developer/label/label/exceptions.ts:9](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L9) - *** ### message @@ -66,10 +54,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.message` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1077 - *** ### name @@ -80,10 +64,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.name` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1076 - *** ### stack? @@ -94,10 +74,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.stack` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1078 - *** ### prepareStackTrace()? @@ -124,10 +100,6 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces `Error.prepareStackTrace` -#### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:143 - *** ### stackTraceLimit @@ -138,10 +110,6 @@ Developer/label/node\_modules/@types/node/globals.d.ts:143 `Error.stackTraceLimit` -#### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:145 - ## Methods ### captureStackTrace() @@ -166,10 +134,6 @@ Create .stack property on a target object `Error.captureStackTrace` -##### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:136 - #### captureStackTrace(targetObject, constructorOpt) > `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` @@ -189,7 +153,3 @@ Create .stack property on a target object ##### Inherited from `Error.captureStackTrace` - -##### Defined in - -Developer/label/node\_modules/bun-types/globals.d.ts:1630 diff --git a/docs/label/Class.NoMatchedPackages.md b/docs/label/Class.NoMatchedPackages.md index d6fc425..e1539b3 100644 --- a/docs/label/Class.NoMatchedPackages.md +++ b/docs/label/Class.NoMatchedPackages.md @@ -26,10 +26,6 @@ Exception for no matched packages found `Error.constructor` -#### Defined in - -[Developer/label/label/exceptions.ts:32](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L32) - ## Properties ### cause? @@ -40,20 +36,12 @@ Exception for no matched packages found `Error.cause` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 - *** ### label > **label**: [`Label`](Interface.Label.md) -#### Defined in - -[Developer/label/label/exceptions.ts:32](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L32) - *** ### message @@ -64,10 +52,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.message` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1077 - *** ### name @@ -78,10 +62,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.name` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1076 - *** ### stack? @@ -92,10 +72,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.stack` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1078 - *** ### prepareStackTrace()? @@ -122,10 +98,6 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces `Error.prepareStackTrace` -#### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:143 - *** ### stackTraceLimit @@ -136,10 +108,6 @@ Developer/label/node\_modules/@types/node/globals.d.ts:143 `Error.stackTraceLimit` -#### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:145 - ## Methods ### captureStackTrace() @@ -164,10 +132,6 @@ Create .stack property on a target object `Error.captureStackTrace` -##### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:136 - #### captureStackTrace(targetObject, constructorOpt) > `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` @@ -187,7 +151,3 @@ Create .stack property on a target object ##### Inherited from `Error.captureStackTrace` - -##### Defined in - -Developer/label/node\_modules/bun-types/globals.d.ts:1630 diff --git a/docs/label/Class.NoMatchedTarget.md b/docs/label/Class.NoMatchedTarget.md index 1c0859e..098c3b0 100644 --- a/docs/label/Class.NoMatchedTarget.md +++ b/docs/label/Class.NoMatchedTarget.md @@ -26,10 +26,6 @@ Exception for no matched target found `Error.constructor` -#### Defined in - -[Developer/label/label/exceptions.ts:42](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L42) - ## Properties ### cause? @@ -40,20 +36,12 @@ Exception for no matched target found `Error.cause` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 - *** ### label > **label**: [`Label`](Interface.Label.md) -#### Defined in - -[Developer/label/label/exceptions.ts:42](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/exceptions.ts#L42) - *** ### message @@ -64,10 +52,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.message` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1077 - *** ### name @@ -78,10 +62,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.name` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1076 - *** ### stack? @@ -92,10 +72,6 @@ Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules `Error.stack` -#### Defined in - -Library/Caches/pnpm/dlx/7g5m6eybglw7svgzmfaeyzxw3i/19320ca5c83-a67/node\_modules/typescript/lib/lib.es5.d.ts:1078 - *** ### prepareStackTrace()? @@ -122,10 +98,6 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces `Error.prepareStackTrace` -#### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:143 - *** ### stackTraceLimit @@ -136,10 +108,6 @@ Developer/label/node\_modules/@types/node/globals.d.ts:143 `Error.stackTraceLimit` -#### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:145 - ## Methods ### captureStackTrace() @@ -164,10 +132,6 @@ Create .stack property on a target object `Error.captureStackTrace` -##### Defined in - -Developer/label/node\_modules/@types/node/globals.d.ts:136 - #### captureStackTrace(targetObject, constructorOpt) > `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void` @@ -187,7 +151,3 @@ Create .stack property on a target object ##### Inherited from `Error.captureStackTrace` - -##### Defined in - -Developer/label/node\_modules/bun-types/globals.d.ts:1630 diff --git a/docs/label/Class.TargetQuery.md b/docs/label/Class.TargetQuery.md index f5aca32..a444576 100644 --- a/docs/label/Class.TargetQuery.md +++ b/docs/label/Class.TargetQuery.md @@ -39,34 +39,6 @@ configuration for `TargetQuery` [`TargetQuery`](Class.TargetQuery.md)\<`Target`\> -#### Defined in - -[Developer/label/label/query.ts:72](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L72) - -## Properties - -### allowUnmatched - -> **allowUnmatched**: `boolean` - -**`Internal`** - -#### Defined in - -[Developer/label/label/query.ts:65](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L65) - -*** - -### spec - -> `readonly` **spec**: [`Spec`](Interface.Spec.md)\<`Target`\> - -**`Internal`** - -#### Defined in - -[Developer/label/label/query.ts:76](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L76) - ## Methods ### query() @@ -102,7 +74,3 @@ a `` map of matched targets #### Throws [NoMatchedTarget](Class.NoMatchedTarget.md) if no matched targets are found - -#### Defined in - -[Developer/label/label/query.ts:92](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L92) diff --git a/docs/label/Function.build.md b/docs/label/Function.build.md index 98ea2d2..eeb68a2 100644 --- a/docs/label/Function.build.md +++ b/docs/label/Function.build.md @@ -27,7 +27,3 @@ build({ package: "foo", includeSubPackages: true }); // foo/... build({ scope: "", package: "foo" }); // //foo build({ scope: "@npm", package: "foo" }); // @npm//foo ``` - -## Defined in - -[Developer/label/label/build-label.ts:17](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/build-label.ts#L17) diff --git a/docs/label/Function.normalizePackage.md b/docs/label/Function.normalizePackage.md index d15bbe9..f235b58 100644 --- a/docs/label/Function.normalizePackage.md +++ b/docs/label/Function.normalizePackage.md @@ -15,7 +15,3 @@ the package path ## Returns `string` - -## Defined in - -[Developer/label/label/label.ts:62](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L62) diff --git a/docs/label/Function.parse.md b/docs/label/Function.parse.md index 21deff7..6298a68 100644 --- a/docs/label/Function.parse.md +++ b/docs/label/Function.parse.md @@ -21,7 +21,3 @@ The parsed `Label` object ## Throws [InvalidLabel](Class.InvalidLabel.md) if the label is invalid - -## Defined in - -[Developer/label/label/parse.ts:24](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/parse.ts#L24) diff --git a/docs/label/Function.resolve.md b/docs/label/Function.resolve.md index e5a5165..1809882 100644 --- a/docs/label/Function.resolve.md +++ b/docs/label/Function.resolve.md @@ -39,7 +39,3 @@ resolve({ package: "foo", target: "bar" }, { includeSubPackages: true }); // { p ## Throws [CannotResolveFromSubPackages](Class.CannotResolveFromSubPackages.md) if the `from` label includes subpackages - -## Defined in - -[Developer/label/label/resolve.ts:19](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/resolve.ts#L19) diff --git a/docs/label/Function.validateAbsolute.md b/docs/label/Function.validateAbsolute.md index d6644a9..13d6540 100644 --- a/docs/label/Function.validateAbsolute.md +++ b/docs/label/Function.validateAbsolute.md @@ -19,7 +19,3 @@ the label to check ## Throws [InvalidLabel](Class.InvalidLabel.md) if the label is not an absolute label - -## Defined in - -[Developer/label/label/parse.ts:56](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/parse.ts#L56) diff --git a/docs/label/Interface.AbsoluteLabel.md b/docs/label/Interface.AbsoluteLabel.md index 95779fe..a019408 100644 --- a/docs/label/Interface.AbsoluteLabel.md +++ b/docs/label/Interface.AbsoluteLabel.md @@ -27,10 +27,6 @@ An absolute label is a label that must includes a scope [`Label`](Interface.Label.md).[`includeSubPackages`](Interface.Label.md#includesubpackages) -#### Defined in - -[Developer/label/label/label.ts:29](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L29) - *** ### package @@ -51,10 +47,6 @@ The known part of package path of the package [`Label`](Interface.Label.md).[`package`](Interface.Label.md#package) -#### Defined in - -[Developer/label/label/label.ts:22](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L22) - *** ### scope @@ -77,10 +69,6 @@ empty string in `//foo` [`Label`](Interface.Label.md).[`scope`](Interface.Label.md#scope) -#### Defined in - -[Developer/label/label/label.ts:45](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L45) - *** ### target @@ -100,7 +88,3 @@ The target of the package #### Inherited from [`Label`](Interface.Label.md).[`target`](Interface.Label.md#target) - -#### Defined in - -[Developer/label/label/label.ts:37](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L37) diff --git a/docs/label/Interface.BazelFileTarget.md b/docs/label/Interface.BazelFileTarget.md index 5b514bd..4b42ae0 100644 --- a/docs/label/Interface.BazelFileTarget.md +++ b/docs/label/Interface.BazelFileTarget.md @@ -10,16 +10,8 @@ File target type > **file**: `unknown` -#### Defined in - -[Developer/label/label/specs/bazel-like.ts:19](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L19) - *** ### type > **type**: `"file"` - -#### Defined in - -[Developer/label/label/specs/bazel-like.ts:18](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L18) diff --git a/docs/label/Interface.BazelRuleTarget.md b/docs/label/Interface.BazelRuleTarget.md index ef563a2..66861cc 100644 --- a/docs/label/Interface.BazelRuleTarget.md +++ b/docs/label/Interface.BazelRuleTarget.md @@ -10,16 +10,8 @@ Rule target type > **rule**: `unknown` -#### Defined in - -[Developer/label/label/specs/bazel-like.ts:10](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L10) - *** ### type > **type**: `"rule"` - -#### Defined in - -[Developer/label/label/specs/bazel-like.ts:9](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L9) diff --git a/docs/label/Interface.ExactLabel.md b/docs/label/Interface.ExactLabel.md index 8350ac1..591fa10 100644 --- a/docs/label/Interface.ExactLabel.md +++ b/docs/label/Interface.ExactLabel.md @@ -27,10 +27,6 @@ An exact label is a label that must includes a scope and cannot include sub-pack [`Label`](Interface.Label.md).[`includeSubPackages`](Interface.Label.md#includesubpackages) -#### Defined in - -[Developer/label/label/label.ts:54](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L54) - *** ### package @@ -51,10 +47,6 @@ The known part of package path of the package [`Label`](Interface.Label.md).[`package`](Interface.Label.md#package) -#### Defined in - -[Developer/label/label/label.ts:22](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L22) - *** ### scope @@ -77,10 +69,6 @@ empty string in `//foo` [`Label`](Interface.Label.md).[`scope`](Interface.Label.md#scope) -#### Defined in - -[Developer/label/label/label.ts:53](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L53) - *** ### target @@ -100,7 +88,3 @@ The target of the package #### Inherited from [`Label`](Interface.Label.md).[`target`](Interface.Label.md#target) - -#### Defined in - -[Developer/label/label/label.ts:37](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L37) diff --git a/docs/label/Interface.Label.md b/docs/label/Interface.Label.md index e6b456f..548b393 100644 --- a/docs/label/Interface.Label.md +++ b/docs/label/Interface.Label.md @@ -22,10 +22,6 @@ `false` in `//foo` ``` -#### Defined in - -[Developer/label/label/label.ts:29](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L29) - *** ### package @@ -42,10 +38,6 @@ The known part of package path of the package `foo` in `@npm//foo/...` ``` -#### Defined in - -[Developer/label/label/label.ts:22](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L22) - *** ### scope @@ -64,10 +56,6 @@ empty string in `//foo` `false` in `foo` ``` -#### Defined in - -[Developer/label/label/label.ts:14](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L14) - *** ### target @@ -83,7 +71,3 @@ The target of the package `wiz` in `//foo/bar/wiz` which includes an implicit target name `all` in `//foo:all` which includes all targets in most specs ``` - -#### Defined in - -[Developer/label/label/label.ts:37](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/label.ts#L37) diff --git a/docs/label/Interface.Spec.md b/docs/label/Interface.Spec.md index 9901d0b..4acd0ad 100644 --- a/docs/label/Interface.Spec.md +++ b/docs/label/Interface.Spec.md @@ -32,10 +32,6 @@ the target name in a label the matched target names or `null` if not found -#### Defined in - -[Developer/label/label/query.ts:36](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L36) - *** ### load() @@ -56,10 +52,6 @@ the label that is returned by `lookup` a `` map for the package -#### Defined in - -[Developer/label/label/query.ts:29](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L29) - *** ### lookup() @@ -80,10 +72,6 @@ the label to lookup a list of matched packages presented by `ExactLabel` -#### Defined in - -[Developer/label/label/query.ts:23](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L23) - *** ### validate() @@ -103,7 +91,3 @@ the label to validate `undefined` \| `null` \| `string` \| `void` \| `Error` a string or an `Error` for invalid label, and falsy values for valid label - -#### Defined in - -[Developer/label/label/query.ts:17](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L17) diff --git a/docs/label/Interface.TargetQueryConfig.md b/docs/label/Interface.TargetQueryConfig.md index 593328b..3201bbb 100644 --- a/docs/label/Interface.TargetQueryConfig.md +++ b/docs/label/Interface.TargetQueryConfig.md @@ -11,7 +11,3 @@ Configuration for querying targets > `optional` **allowUnmatched**: `boolean` Allow unmatched labels. If `true`, the query will not throw an error when no matched packages or targets are found. - -#### Defined in - -[Developer/label/label/query.ts:47](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/query.ts#L47) diff --git a/docs/label/TypeAlias.BazelTarget.md b/docs/label/TypeAlias.BazelTarget.md index 1e86967..2a17752 100644 --- a/docs/label/TypeAlias.BazelTarget.md +++ b/docs/label/TypeAlias.BazelTarget.md @@ -5,7 +5,3 @@ > **BazelTarget**: [`BazelRuleTarget`](Interface.BazelRuleTarget.md) \| [`BazelFileTarget`](Interface.BazelFileTarget.md) Bazel target type - -## Defined in - -[Developer/label/label/specs/bazel-like.ts:26](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L26) diff --git a/docs/label/Variable.BazelWildcardTargets.md b/docs/label/Variable.BazelWildcardTargets.md index 879d0bd..70c36aa 100644 --- a/docs/label/Variable.BazelWildcardTargets.md +++ b/docs/label/Variable.BazelWildcardTargets.md @@ -19,7 +19,3 @@ indicates all rule targets in the package > **AllTargets**: `string`[] indicates all rule targets and file targets in the package - -## Defined in - -[Developer/label/label/specs/bazel-like.ts:32](https://github.com/xc2/label/blob/c12a0050bfe7ea4c2cc1dec2e68df3b1f8e58bda/label/specs/bazel-like.ts#L32) diff --git a/label/query.ts b/label/query.ts index 4d172e7..f69e72f 100644 --- a/label/query.ts +++ b/label/query.ts @@ -64,18 +64,18 @@ export class TargetQuery { */ allowUnmatched: boolean; + /** + * @internal + */ + readonly spec: Spec; + /** * The spec for querying targets * @param spec - the spec of build system * @param config - configuration for `TargetQuery` */ - constructor( - /** - * @internal - */ - public readonly spec: Spec, - config: TargetQueryConfig = {} - ) { + constructor(spec: Spec, config: TargetQueryConfig = {}) { + this.spec = spec; this.allowUnmatched = config.allowUnmatched || false; }