diff --git a/.config/typedoc.json b/.config/typedoc.json new file mode 100644 index 0000000..43a29d3 --- /dev/null +++ b/.config/typedoc.json @@ -0,0 +1,14 @@ +{ + "$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", + "excludeInternal": true, + "disableSources": true +} 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..3c3dd5e 100644 --- a/biome.json +++ b/biome.json @@ -12,11 +12,11 @@ } }, "files": { - "ignore": ["worker-configuration.d.ts", "**/gen/**", "**/*.gen.*"] + "ignore": ["worker-configuration.d.ts", "**/gen/**", "**/*.gen.*", "**/docs/**"] }, "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..f91da8e --- /dev/null +++ b/docs/label/Class.BazelLikeSpec.md @@ -0,0 +1,123 @@ +[@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) + +*** + +### 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) + +*** + +### 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) + +*** + +### 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) diff --git a/docs/label/Class.CannotResolveFromSubPackages.md b/docs/label/Class.CannotResolveFromSubPackages.md new file mode 100644 index 0000000..094985d --- /dev/null +++ b/docs/label/Class.CannotResolveFromSubPackages.md @@ -0,0 +1,153 @@ +[@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` + +## Properties + +### cause? + +> `optional` **cause**: `unknown` + +#### Inherited from + +`Error.cause` + +*** + +### label + +> **label**: [`Label`](Interface.Label.md) + +*** + +### message + +> **message**: `string` + +#### Inherited from + +`Error.message` + +*** + +### name + +> **name**: `string` + +#### Inherited from + +`Error.name` + +*** + +### stack? + +> `optional` **stack**: `string` + +#### Inherited from + +`Error.stack` + +*** + +### 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` + +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +#### Inherited from + +`Error.stackTraceLimit` + +## 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` + +#### 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` diff --git a/docs/label/Class.InvalidLabel.md b/docs/label/Class.InvalidLabel.md new file mode 100644 index 0000000..abd0a87 --- /dev/null +++ b/docs/label/Class.InvalidLabel.md @@ -0,0 +1,155 @@ +[@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` + +## Properties + +### cause? + +> `optional` **cause**: `unknown` + +#### Inherited from + +`Error.cause` + +*** + +### label + +> `readonly` **label**: `string` + +*** + +### message + +> **message**: `string` + +#### Inherited from + +`Error.message` + +*** + +### name + +> **name**: `string` + +#### Inherited from + +`Error.name` + +*** + +### stack? + +> `optional` **stack**: `string` + +#### Inherited from + +`Error.stack` + +*** + +### 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` + +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +#### Inherited from + +`Error.stackTraceLimit` + +## 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` + +#### 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` diff --git a/docs/label/Class.NoMatchedPackages.md b/docs/label/Class.NoMatchedPackages.md new file mode 100644 index 0000000..e1539b3 --- /dev/null +++ b/docs/label/Class.NoMatchedPackages.md @@ -0,0 +1,153 @@ +[@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` + +## Properties + +### cause? + +> `optional` **cause**: `unknown` + +#### Inherited from + +`Error.cause` + +*** + +### label + +> **label**: [`Label`](Interface.Label.md) + +*** + +### message + +> **message**: `string` + +#### Inherited from + +`Error.message` + +*** + +### name + +> **name**: `string` + +#### Inherited from + +`Error.name` + +*** + +### stack? + +> `optional` **stack**: `string` + +#### Inherited from + +`Error.stack` + +*** + +### 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` + +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +#### Inherited from + +`Error.stackTraceLimit` + +## 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` + +#### 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` diff --git a/docs/label/Class.NoMatchedTarget.md b/docs/label/Class.NoMatchedTarget.md new file mode 100644 index 0000000..098c3b0 --- /dev/null +++ b/docs/label/Class.NoMatchedTarget.md @@ -0,0 +1,153 @@ +[@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` + +## Properties + +### cause? + +> `optional` **cause**: `unknown` + +#### Inherited from + +`Error.cause` + +*** + +### label + +> **label**: [`Label`](Interface.Label.md) + +*** + +### message + +> **message**: `string` + +#### Inherited from + +`Error.message` + +*** + +### name + +> **name**: `string` + +#### Inherited from + +`Error.name` + +*** + +### stack? + +> `optional` **stack**: `string` + +#### Inherited from + +`Error.stack` + +*** + +### 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` + +*** + +### stackTraceLimit + +> `static` **stackTraceLimit**: `number` + +#### Inherited from + +`Error.stackTraceLimit` + +## 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` + +#### 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` diff --git a/docs/label/Class.TargetQuery.md b/docs/label/Class.TargetQuery.md new file mode 100644 index 0000000..a444576 --- /dev/null +++ b/docs/label/Class.TargetQuery.md @@ -0,0 +1,76 @@ +[@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`\> + +## 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 diff --git a/docs/label/Function.build.md b/docs/label/Function.build.md new file mode 100644 index 0000000..eeb68a2 --- /dev/null +++ b/docs/label/Function.build.md @@ -0,0 +1,29 @@ +[@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 +``` diff --git a/docs/label/Function.normalizePackage.md b/docs/label/Function.normalizePackage.md new file mode 100644 index 0000000..f235b58 --- /dev/null +++ b/docs/label/Function.normalizePackage.md @@ -0,0 +1,17 @@ +[@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` diff --git a/docs/label/Function.parse.md b/docs/label/Function.parse.md new file mode 100644 index 0000000..6298a68 --- /dev/null +++ b/docs/label/Function.parse.md @@ -0,0 +1,23 @@ +[@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 diff --git a/docs/label/Function.resolve.md b/docs/label/Function.resolve.md new file mode 100644 index 0000000..1809882 --- /dev/null +++ b/docs/label/Function.resolve.md @@ -0,0 +1,41 @@ +[@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 diff --git a/docs/label/Function.validateAbsolute.md b/docs/label/Function.validateAbsolute.md new file mode 100644 index 0000000..13d6540 --- /dev/null +++ b/docs/label/Function.validateAbsolute.md @@ -0,0 +1,21 @@ +[@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 diff --git a/docs/label/Interface.AbsoluteLabel.md b/docs/label/Interface.AbsoluteLabel.md new file mode 100644 index 0000000..a019408 --- /dev/null +++ b/docs/label/Interface.AbsoluteLabel.md @@ -0,0 +1,90 @@ +[@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) + +*** + +### 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) + +*** + +### 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) + +*** + +### 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) diff --git a/docs/label/Interface.BazelFileTarget.md b/docs/label/Interface.BazelFileTarget.md new file mode 100644 index 0000000..4b42ae0 --- /dev/null +++ b/docs/label/Interface.BazelFileTarget.md @@ -0,0 +1,17 @@ +[@109cafe/label](index.md) / BazelFileTarget + +# Interface: BazelFileTarget + +File target type + +## Properties + +### file + +> **file**: `unknown` + +*** + +### type + +> **type**: `"file"` diff --git a/docs/label/Interface.BazelRuleTarget.md b/docs/label/Interface.BazelRuleTarget.md new file mode 100644 index 0000000..66861cc --- /dev/null +++ b/docs/label/Interface.BazelRuleTarget.md @@ -0,0 +1,17 @@ +[@109cafe/label](index.md) / BazelRuleTarget + +# Interface: BazelRuleTarget + +Rule target type + +## Properties + +### rule + +> **rule**: `unknown` + +*** + +### type + +> **type**: `"rule"` diff --git a/docs/label/Interface.ExactLabel.md b/docs/label/Interface.ExactLabel.md new file mode 100644 index 0000000..591fa10 --- /dev/null +++ b/docs/label/Interface.ExactLabel.md @@ -0,0 +1,90 @@ +[@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) + +*** + +### 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) + +*** + +### 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) + +*** + +### 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) diff --git a/docs/label/Interface.Label.md b/docs/label/Interface.Label.md new file mode 100644 index 0000000..548b393 --- /dev/null +++ b/docs/label/Interface.Label.md @@ -0,0 +1,73 @@ +[@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` +``` + +*** + +### 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/...` +``` + +*** + +### 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` +``` + +*** + +### 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 +``` diff --git a/docs/label/Interface.Spec.md b/docs/label/Interface.Spec.md new file mode 100644 index 0000000..4acd0ad --- /dev/null +++ b/docs/label/Interface.Spec.md @@ -0,0 +1,93 @@ +[@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 + +*** + +### 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 + +*** + +### 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` + +*** + +### 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 diff --git a/docs/label/Interface.TargetQueryConfig.md b/docs/label/Interface.TargetQueryConfig.md new file mode 100644 index 0000000..3201bbb --- /dev/null +++ b/docs/label/Interface.TargetQueryConfig.md @@ -0,0 +1,13 @@ +[@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. diff --git a/docs/label/TypeAlias.BazelTarget.md b/docs/label/TypeAlias.BazelTarget.md new file mode 100644 index 0000000..2a17752 --- /dev/null +++ b/docs/label/TypeAlias.BazelTarget.md @@ -0,0 +1,7 @@ +[@109cafe/label](index.md) / BazelTarget + +# Type Alias: BazelTarget + +> **BazelTarget**: [`BazelRuleTarget`](Interface.BazelRuleTarget.md) \| [`BazelFileTarget`](Interface.BazelFileTarget.md) + +Bazel target type diff --git a/docs/label/Variable.BazelWildcardTargets.md b/docs/label/Variable.BazelWildcardTargets.md new file mode 100644 index 0000000..70c36aa --- /dev/null +++ b/docs/label/Variable.BazelWildcardTargets.md @@ -0,0 +1,21 @@ +[@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 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..f69e72f 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; - constructor( - public readonly spec: Spec, - config: TargetQueryConfig = {} - ) { + + /** + * @internal + */ + readonly spec: Spec; + + /** + * The spec for querying targets + * @param spec - the spec of build system + * @param config - configuration for `TargetQuery` + */ + constructor(spec: Spec, config: TargetQueryConfig = {}) { + this.spec = spec; 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[] = [];