@k8slens/package-build 3.2.0 → 3.4.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.
@@ -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,10 +1,13 @@
1
1
  /** Overrides where the check reads the versions Lens serves, e.g. to check against another Lens than the one on this machine. */
2
2
  export declare const extensionDependencyVersionsFileEnvironmentVariable = "LENS_EXTENSION_DEPENDENCY_VERSIONS_FILE";
3
+ export declare const defaultVersionsFilePath: () => string;
3
4
  export interface CheckExtensionDependenciesParams {
4
5
  readonly packageJsonPath: string;
5
6
  readonly versionsFilePath: string;
6
7
  readonly fix: boolean;
7
8
  readonly log: (line: string) => void;
9
+ /** Fails, instead of passing, when Lens has written no versions to check against: what publishing needs. */
10
+ readonly requireVersions?: boolean;
8
11
  }
9
12
  /**
10
13
  * Checks the ranges an extension's package.json declares for the packages Lens serves to
@@ -13,9 +16,9 @@ export interface CheckExtensionDependenciesParams {
13
16
  * fails the check; one in `devDependencies` only warns, as Lens never reads those. With `fix`,
14
17
  * rewrites every such range, in all three, to the caret range of the version Lens serves.
15
18
  *
16
- * @returns the exit code: 0 when Lens would load the extension, or when there is nothing to check against.
19
+ * @returns the exit code: 0 when Lens would load the extension, or when there is nothing to check against and `requireVersions` is not set.
17
20
  */
18
- export declare const checkExtensionDependencies: ({ packageJsonPath, versionsFilePath, fix, log, }: CheckExtensionDependenciesParams) => number;
21
+ export declare const checkExtensionDependencies: ({ packageJsonPath, versionsFilePath, fix, log, requireVersions, }: CheckExtensionDependenciesParams) => number;
19
22
  /** The `lens-extension-dependencies-check [--fix]` command, run in the extension's directory. */
20
23
  export declare const extensionDependenciesCheck: () => number;
21
24
  //# sourceMappingURL=extension-dependencies-check.d.ts.map
@@ -1 +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
+ {"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;AAK5G,eAAO,MAAM,uBAAuB,cAOjC,CAAC;AAQJ,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;IACrC,4GAA4G;IAC5G,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AAyCD;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,sEAMpC,gCAAgC,KAAG,MAsErC,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,0BAA0B,QAAO,MAM1C,CAAC"}
@@ -0,0 +1,42 @@
1
+ /** The dist-tag a prerelease is published under, so it never becomes the version users install by default. */
2
+ export declare const prereleaseDistTag = "next";
3
+ export interface CheckExtensionPublishingParams {
4
+ readonly packageJsonPath: string;
5
+ readonly versionsFilePath: string;
6
+ /** The paths npm would pack, relative to the extension's directory, as `npm pack --dry-run` lists them. */
7
+ readonly packedFiles: () => readonly string[];
8
+ /** The dist-tag npm is publishing under, when one was given. */
9
+ readonly distTag: string | undefined;
10
+ readonly log: (line: string) => void;
11
+ }
12
+ /**
13
+ * Checks an extension is fit to publish, before npm publishes it: that what npm packs has the
14
+ * entrypoint Lens loads, that Lens would accept every range the extension declares for a package
15
+ * Lens serves, and that a prerelease is not published as the latest version. Fails when Lens has
16
+ * written no versions to check the ranges against, as publishing unchecked is how an extension
17
+ * reaches users that no Lens loads.
18
+ *
19
+ * @returns the exit code: 0 when the extension is fit to publish.
20
+ */
21
+ export declare const checkExtensionPublishing: ({ packageJsonPath, versionsFilePath, packedFiles, distTag, log, }: CheckExtensionPublishingParams) => number;
22
+ /**
23
+ * The paths `npm pack --dry-run --json` says it would pack, from what it printed: one entry per
24
+ * package packed, listing its files, after whatever lines npm writes before it. None when npm
25
+ * printed no listing.
26
+ */
27
+ export declare const packedFilesOf: (output: string) => string[];
28
+ export interface ExtensionPublishCheckParams {
29
+ /** The extension's directory, where npm runs its scripts. */
30
+ readonly directory: string;
31
+ /** The environment npm runs the script in. */
32
+ readonly environment: Readonly<Record<string, string | undefined>>;
33
+ /** Runs a command in a directory, giving back what it printed. */
34
+ readonly runCommand: (command: string, directory: string) => string;
35
+ readonly log: (line: string) => void;
36
+ }
37
+ /**
38
+ * The `lens-extension-publish-check` command, run in the extension's directory, as its
39
+ * `prepublishOnly` script: npm runs it before every publish, and gives up publishing when it fails.
40
+ */
41
+ export declare const extensionPublishCheck: ({ directory, environment, runCommand, log }?: ExtensionPublishCheckParams) => number;
42
+ //# sourceMappingURL=extension-publish-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-publish-check.d.ts","sourceRoot":"","sources":["../../src/extension-publish-check.ts"],"names":[],"mappings":"AAUA,8GAA8G;AAC9G,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAExC,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,2GAA2G;IAC3G,QAAQ,CAAC,WAAW,EAAE,MAAM,SAAS,MAAM,EAAE,CAAC;IAC9C,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAiED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,sEAMlC,8BAA8B,KAAG,MA2BnC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,KAAG,MAAM,EAUpD,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACnE,kEAAkE;IAClE,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACpE,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,iDACa,2BAA2B,KAMvE,MAQC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"package-build.d.ts","sourceRoot":"","sources":["../../src/package-build.ts"],"names":[],"mappings":"AA4LA,eAAO,MAAM,YAAY,qBAkCxB,CAAC"}
1
+ {"version":3,"file":"package-build.d.ts","sourceRoot":"","sources":["../../src/package-build.ts"],"names":[],"mappings":"AAiGA,eAAO,MAAM,YAAY,qBAkCxB,CAAC"}