@k8slens/package-build 2.2.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/extension-dependencies-check +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +581 -319
- package/dist/src/extension-dependencies-check.d.ts +21 -0
- package/dist/src/extension-dependencies-check.d.ts.map +1 -0
- package/dist/src/package-build.d.ts.map +1 -1
- package/dist/src/stylesheet-plugin.d.ts +33 -0
- package/dist/src/stylesheet-plugin.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -6
- package/src/__fixtures__/package-with-undeclared-dependency/index.js +1 -0
- package/src/__fixtures__/package-with-undeclared-dependency/manifest.json +6 -0
- package/src/__fixtures__/package-without-dependency/index.js +1 -0
- package/src/__fixtures__/package-without-dependency/manifest.json +3 -0
- package/src/__fixtures__/package-without-dependency/some.scss +3 -0
- package/src/__fixtures__/styled-package/_partial.scss +1 -0
- package/src/__fixtures__/styled-package/empty.scss +1 -0
- package/src/__fixtures__/styled-package/fonts/some-font.ttf +1 -0
- package/src/__fixtures__/styled-package/fonts.scss +8 -0
- package/src/__fixtures__/styled-package/global.scss +3 -0
- package/src/__fixtures__/styled-package/importer.scss +5 -0
- package/src/__fixtures__/styled-package/index.js +10 -0
- package/src/__fixtures__/styled-package/manifest.json +7 -0
- package/src/__fixtures__/styled-package/plain.css +3 -0
- package/src/__fixtures__/styled-package/plain.module.css +3 -0
- package/src/__fixtures__/styled-package/some.module.scss +7 -0
- package/src/__fixtures__/styled-package/tilde.scss +7 -0
- package/src/extension-dependencies-check.test.ts +259 -0
- package/src/extension-dependencies-check.ts +158 -0
- package/src/package-build.ts +7 -15
- package/src/stylesheet-plugin.test.ts +161 -0
- package/src/stylesheet-plugin.ts +272 -0
- package/src/glob-import-plugin.js +0 -46
- package/src/package-build.js +0 -193
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Overrides where the check reads the versions Lens serves, e.g. to check against another Lens than the one on this machine. */
|
|
2
|
+
export declare const extensionDependencyVersionsFileEnvironmentVariable = "LENS_EXTENSION_DEPENDENCY_VERSIONS_FILE";
|
|
3
|
+
export interface CheckExtensionDependenciesParams {
|
|
4
|
+
readonly packageJsonPath: string;
|
|
5
|
+
readonly versionsFilePath: string;
|
|
6
|
+
readonly fix: boolean;
|
|
7
|
+
readonly log: (line: string) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Checks the ranges an extension's package.json declares for the packages Lens serves to
|
|
11
|
+
* extensions against the versions the Lens on this machine serves, with the rule Lens applies
|
|
12
|
+
* before loading the extension. A range Lens would refuse in `dependencies` or `peerDependencies`
|
|
13
|
+
* fails the check; one in `devDependencies` only warns, as Lens never reads those. With `fix`,
|
|
14
|
+
* rewrites every such range, in all three, to the caret range of the version Lens serves.
|
|
15
|
+
*
|
|
16
|
+
* @returns the exit code: 0 when Lens would load the extension, or when there is nothing to check against.
|
|
17
|
+
*/
|
|
18
|
+
export declare const checkExtensionDependencies: ({ packageJsonPath, versionsFilePath, fix, log, }: CheckExtensionDependenciesParams) => number;
|
|
19
|
+
/** The `lens-extension-dependencies-check [--fix]` command, run in the extension's directory. */
|
|
20
|
+
export declare const extensionDependenciesCheck: () => number;
|
|
21
|
+
//# sourceMappingURL=extension-dependencies-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-dependencies-check.d.ts","sourceRoot":"","sources":["../../src/extension-dependencies-check.ts"],"names":[],"mappings":"AAKA,iIAAiI;AACjI,eAAO,MAAM,kDAAkD,4CAA4C,CAAC;AAoB5G,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAyCD;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,qDAKpC,gCAAgC,KAAG,MA8DrC,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,0BAA0B,QAAO,MAM1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-build.d.ts","sourceRoot":"","sources":["../../src/package-build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-build.d.ts","sourceRoot":"","sources":["../../src/package-build.ts"],"names":[],"mappings":"AA4LA,eAAO,MAAM,YAAY,qBAkCxB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Plugin } from "esbuild";
|
|
2
|
+
export declare const stylesheetContractsPackageName = "@k8slens/stylesheet-contracts";
|
|
3
|
+
export interface StylesheetPluginParams {
|
|
4
|
+
/** The name of the package being built; the first half of every stylesheet id. */
|
|
5
|
+
readonly packageName: string;
|
|
6
|
+
/** The directory of the package being built; stylesheet ids are relative to it. */
|
|
7
|
+
readonly packageDirectory: string;
|
|
8
|
+
/** The `dependencies` of the package being built, by name. */
|
|
9
|
+
readonly declaredDependencies: ReadonlySet<string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Compiles every stylesheet the package imports into a module that declares
|
|
13
|
+
* it as a stylesheet injectable of the package's Feature:
|
|
14
|
+
*
|
|
15
|
+
* import { asStylesheet } from "@k8slens/stylesheet-contracts";
|
|
16
|
+
* export const stylesheet = asStylesheet({ id: "<package>/<file>", css: "…" });
|
|
17
|
+
* export default { local: "scoped" }; // css modules only
|
|
18
|
+
*
|
|
19
|
+
* The Feature picks the `stylesheet` export up through its stylesheet glob,
|
|
20
|
+
* and the renderer application applies it while the Feature is registered.
|
|
21
|
+
* A css module keeps its scoped class names as the default export, and its
|
|
22
|
+
* `@apply` rules go through tailwind as before. Nothing is written beside the
|
|
23
|
+
* bundle any more: the css travels inside it.
|
|
24
|
+
*
|
|
25
|
+
* A stylesheet of a dependency, imported by a bare specifier from the
|
|
26
|
+
* package's own sources (`import "xterm/css/xterm.css"`), is compiled the same
|
|
27
|
+
* way and identified by that specifier. Nothing registers it by itself, since
|
|
28
|
+
* it is not under the Feature's stylesheet glob: the package re-exports its
|
|
29
|
+
* `stylesheet` from an `*.injectable.ts` file, and the Feature registers it
|
|
30
|
+
* like any injectable.
|
|
31
|
+
*/
|
|
32
|
+
export declare const stylesheetPlugin: ({ packageName, packageDirectory, declaredDependencies, }: StylesheetPluginParams) => Plugin;
|
|
33
|
+
//# sourceMappingURL=stylesheet-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylesheet-plugin.d.ts","sourceRoot":"","sources":["../../src/stylesheet-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAStC,eAAO,MAAM,8BAA8B,kCAAkC,CAAC;AAO9E,MAAM,WAAW,sBAAsB;IACrC,kFAAkF;IAClF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mFAAmF;IACnF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,8DAA8D;IAC9D,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACpD;AAQD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB,6DAI1B,sBAAsB,KAAG,MA4G1B,CAAC"}
|