@k8slens/package-build 3.2.0 → 3.3.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 +6214 -377
- package/dist/src/ascii-output-plugin.d.ts +8 -0
- package/dist/src/ascii-output-plugin.d.ts.map +1 -0
- package/dist/src/declared-imports-plugin.d.ts +27 -0
- package/dist/src/declared-imports-plugin.d.ts.map +1 -0
- package/dist/src/package-build.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -1
- package/src/__fixtures__/package-importing-a-package/index.js +2 -0
- package/src/ascii-output-plugin.test.ts +141 -0
- package/src/ascii-output-plugin.ts +342 -0
- package/src/declared-imports-plugin.test.ts +129 -0
- package/src/declared-imports-plugin.ts +137 -0
- package/src/package-build.ts +2 -93
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Plugin } from "esbuild";
|
|
2
|
+
/**
|
|
3
|
+
* Escapes what esbuild left outside ASCII in the bundle it wrote to `outfile`, and moves the columns
|
|
4
|
+
* of its source map to match. A string of the source of a script is one byte per character in V8
|
|
5
|
+
* only when every character of it is Latin-1: a single em dash in a comment makes it two.
|
|
6
|
+
*/
|
|
7
|
+
export declare const asciiOutputPlugin: () => Plugin;
|
|
8
|
+
//# sourceMappingURL=ascii-output-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ascii-output-plugin.d.ts","sourceRoot":"","sources":["../../src/ascii-output-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAqJtC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAO,MA6BnC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Plugin } from "esbuild";
|
|
2
|
+
export interface DeclaredImportsPluginParams {
|
|
3
|
+
readonly packageDirectory: string;
|
|
4
|
+
readonly packageJson: {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly dependencies?: Record<string, string>;
|
|
7
|
+
readonly peerDependencies?: Record<string, string>;
|
|
8
|
+
readonly devDependencies?: Record<string, string>;
|
|
9
|
+
readonly lens?: {
|
|
10
|
+
readonly inlinedDependencies?: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Keeps a package's dist to the package's own code: every bare import of the package's own
|
|
16
|
+
* sources must name a package declared in its dependencies or peerDependencies, and stays a
|
|
17
|
+
* `require()` of it. Esbuild would otherwise inline the imported package and everything it
|
|
18
|
+
* imports in turn, shipping a private copy of e.g. MobX or the DI container in the dist, with
|
|
19
|
+
* module state of its own. A package that inlines something on purpose names it in
|
|
20
|
+
* `lens.inlinedDependencies` (and declares it as a devDependency).
|
|
21
|
+
*
|
|
22
|
+
* A package of the Lens monorepo, which has a `lens` section in its package.json, fails to build
|
|
23
|
+
* on such an import. Any other package, such as an extension built with this tool, is warned
|
|
24
|
+
* instead, as its build inlined undeclared imports before and keeps doing so.
|
|
25
|
+
*/
|
|
26
|
+
export declare const declaredImportsPlugin: ({ packageDirectory, packageJson }: DeclaredImportsPluginParams) => Plugin;
|
|
27
|
+
//# sourceMappingURL=declared-imports-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declared-imports-plugin.d.ts","sourceRoot":"","sources":["../../src/declared-imports-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKtC,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE;QACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnD,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClD,QAAQ,CAAC,IAAI,CAAC,EAAE;YAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;SAAE,CAAC;KACtE,CAAC;CACH;AAsBD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,sCAAuC,2BAA2B,KAAG,MAwFtG,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":"AAiGA,eAAO,MAAM,YAAY,qBAkCxB,CAAC"}
|