@k8slens/package-build 2.2.3 → 3.0.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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +488 -319
- 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 +7 -5
- 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/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
|
@@ -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"}
|