@knapsack/package-bundler 4.101.0--canary.8110.15bba7c.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/.lintstagedrc.mjs +11 -0
- package/INSTRUCTIONS-FOR-CUSTOMERS.md +130 -0
- package/dist/bundle.d.ts +41 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +348 -0
- package/dist/bundle.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +165 -0
- package/dist/cli.js.map +1 -0
- package/dist/errors.d.ts +63 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +155 -0
- package/dist/errors.js.map +1 -0
- package/dist/help-text.d.ts +16 -0
- package/dist/help-text.d.ts.map +1 -0
- package/dist/help-text.js +180 -0
- package/dist/help-text.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/log.d.ts +42 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +114 -0
- package/dist/log.js.map +1 -0
- package/dist/metadata.d.ts +112 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +204 -0
- package/dist/metadata.js.map +1 -0
- package/dist/prompts.d.ts +54 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +125 -0
- package/dist/prompts.js.map +1 -0
- package/dist/resolve-entries.d.ts +56 -0
- package/dist/resolve-entries.d.ts.map +1 -0
- package/dist/resolve-entries.js +333 -0
- package/dist/resolve-entries.js.map +1 -0
- package/dist/resolve-source.d.ts +53 -0
- package/dist/resolve-source.d.ts.map +1 -0
- package/dist/resolve-source.js +174 -0
- package/dist/resolve-source.js.map +1 -0
- package/dist/run.d.ts +52 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +276 -0
- package/dist/run.js.map +1 -0
- package/dist/types.d.ts +67 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +62 -0
- package/dist/types.js.map +1 -0
- package/dist/vendor.d.ts +59 -0
- package/dist/vendor.d.ts.map +1 -0
- package/dist/vendor.js +134 -0
- package/dist/vendor.js.map +1 -0
- package/dist/verify-bundle.d.ts +59 -0
- package/dist/verify-bundle.d.ts.map +1 -0
- package/dist/verify-bundle.js +238 -0
- package/dist/verify-bundle.js.map +1 -0
- package/dist/write-output.d.ts +82 -0
- package/dist/write-output.d.ts.map +1 -0
- package/dist/write-output.js +214 -0
- package/dist/write-output.js.map +1 -0
- package/package.json +53 -0
- package/readme.md +127 -0
- package/tsconfig.json +9 -0
- package/tsconfig.test.json +13 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn whatever the user gave us into a directory containing a built package with its
|
|
3
|
+
* dependencies installed.
|
|
4
|
+
*
|
|
5
|
+
* Two shapes of input:
|
|
6
|
+
* - a directory (or nothing at all, meaning the current directory)
|
|
7
|
+
* - an npm spec, which we install into a temp directory
|
|
8
|
+
*/
|
|
9
|
+
import { execFileSync } from 'node:child_process';
|
|
10
|
+
import { existsSync, mkdtempSync, readFileSync, statSync } from 'node:fs';
|
|
11
|
+
import { homedir, tmpdir } from 'node:os';
|
|
12
|
+
import { isAbsolute, join, resolve } from 'node:path';
|
|
13
|
+
import { BundlerError, ERROR_CODES } from './errors.js';
|
|
14
|
+
function readPackageJson(pkgDir) {
|
|
15
|
+
const file = join(pkgDir, 'package.json');
|
|
16
|
+
if (!existsSync(file)) {
|
|
17
|
+
throw new BundlerError({
|
|
18
|
+
code: ERROR_CODES.ERR_NO_PACKAGE,
|
|
19
|
+
message: `No package.json found in ${pkgDir}.`,
|
|
20
|
+
details: [`Looked for ${file}`],
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(readFileSync(file, 'utf8'));
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new BundlerError({
|
|
28
|
+
code: ERROR_CODES.ERR_BAD_PACKAGE_JSON,
|
|
29
|
+
message: `Could not parse ${file}.`,
|
|
30
|
+
details: [error instanceof Error ? error.message : String(error)],
|
|
31
|
+
cause: error,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Expand a leading `~` to the user's home directory.
|
|
37
|
+
*
|
|
38
|
+
* `path.resolve` does not do this — the shell normally would, but the value can also
|
|
39
|
+
* arrive from a prompt or a config file where no shell has touched it. Without this a
|
|
40
|
+
* `~/...` path passes validation and then resolves to `<cwd>/~/...`, failing with a
|
|
41
|
+
* confusing "path does not exist".
|
|
42
|
+
*/
|
|
43
|
+
export function expandTilde(input) {
|
|
44
|
+
if (input !== '~' && !input.startsWith('~/'))
|
|
45
|
+
return input;
|
|
46
|
+
const home = homedir();
|
|
47
|
+
return input === '~' ? home : join(home, input.slice(2));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Does this look like a filesystem path rather than a package name?
|
|
51
|
+
*
|
|
52
|
+
* Explicit path syntax always wins. Otherwise a bare word is treated as a package name
|
|
53
|
+
* only when there's no directory by that name — so `package-bundler my-lib` picks up a
|
|
54
|
+
* local `./my-lib` if one exists, which is what someone in a monorepo expects.
|
|
55
|
+
*/
|
|
56
|
+
export function looksLikePath(input) {
|
|
57
|
+
if (input.startsWith('.') || input.startsWith('/') || input.startsWith('~'))
|
|
58
|
+
return true;
|
|
59
|
+
if (isAbsolute(input))
|
|
60
|
+
return true;
|
|
61
|
+
return existsSync(resolve(process.cwd(), input));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Recover the installed package's name from its spec. Handles `name`, `name@version`,
|
|
65
|
+
* `@scope/name` and `@scope/name@version`.
|
|
66
|
+
*/
|
|
67
|
+
export function packageNameFromSpec(spec) {
|
|
68
|
+
if (spec.startsWith('@')) {
|
|
69
|
+
const secondAt = spec.indexOf('@', 1);
|
|
70
|
+
return secondAt === -1 ? spec : spec.slice(0, secondAt);
|
|
71
|
+
}
|
|
72
|
+
const at = spec.indexOf('@');
|
|
73
|
+
return at === -1 ? spec : spec.slice(0, at);
|
|
74
|
+
}
|
|
75
|
+
function findInstalledPackageName({ nodeModules, spec, }) {
|
|
76
|
+
const fromSpec = packageNameFromSpec(spec);
|
|
77
|
+
if (existsSync(join(nodeModules, fromSpec)))
|
|
78
|
+
return fromSpec;
|
|
79
|
+
return fromSpec;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Install an npm spec into a throwaway directory.
|
|
83
|
+
*
|
|
84
|
+
* `npm install --prefix` does the whole job in one call: it fetches the package *and*
|
|
85
|
+
* resolves its production dependency tree into a `node_modules` the bundler can then
|
|
86
|
+
* read normally. Doing it with `npm pack` instead would mean unpacking a tarball and
|
|
87
|
+
* running a second install, for no benefit.
|
|
88
|
+
*
|
|
89
|
+
* Install scripts are skipped. We only read built JavaScript, and a `postinstall` from
|
|
90
|
+
* an arbitrary package should not run on a customer's machine because they asked us to
|
|
91
|
+
* bundle something.
|
|
92
|
+
*/
|
|
93
|
+
function installFromNpm({ spec, verbose, }) {
|
|
94
|
+
const installDir = mkdtempSync(join(tmpdir(), 'ks-package-bundler-npm-'));
|
|
95
|
+
try {
|
|
96
|
+
execFileSync('npm', [
|
|
97
|
+
'install',
|
|
98
|
+
spec,
|
|
99
|
+
'--prefix',
|
|
100
|
+
installDir,
|
|
101
|
+
'--omit=dev',
|
|
102
|
+
'--ignore-scripts',
|
|
103
|
+
'--no-audit',
|
|
104
|
+
'--no-fund',
|
|
105
|
+
'--loglevel',
|
|
106
|
+
verbose ? 'info' : 'error',
|
|
107
|
+
], { stdio: verbose ? 'inherit' : 'pipe', encoding: 'utf8' });
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
const stderr = error && typeof error === 'object' && 'stderr' in error
|
|
111
|
+
? String(error.stderr ?? '')
|
|
112
|
+
: '';
|
|
113
|
+
throw new BundlerError({
|
|
114
|
+
code: ERROR_CODES.ERR_NPM_RESOLVE,
|
|
115
|
+
message: `Could not install "${spec}" from npm.`,
|
|
116
|
+
details: stderr.trim() ? stderr.trim().split('\n').slice(-5) : [],
|
|
117
|
+
cause: error,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// `npm install` writes the package under node_modules/<name>, and the spec may carry
|
|
121
|
+
// a version or tag, so recover the name from the lockfile-independent listing rather
|
|
122
|
+
// than parsing the spec ourselves.
|
|
123
|
+
const nodeModules = join(installDir, 'node_modules');
|
|
124
|
+
const name = findInstalledPackageName({ nodeModules, spec });
|
|
125
|
+
const pkgDir = join(nodeModules, name);
|
|
126
|
+
if (!existsSync(pkgDir)) {
|
|
127
|
+
throw new BundlerError({
|
|
128
|
+
code: ERROR_CODES.ERR_NPM_RESOLVE,
|
|
129
|
+
message: `Installed "${spec}" but could not find it at ${pkgDir}.`,
|
|
130
|
+
details: [
|
|
131
|
+
'This usually means the spec resolved to a different package name.',
|
|
132
|
+
],
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return { pkgDir, installedTo: installDir, name };
|
|
136
|
+
}
|
|
137
|
+
export function resolveSource({ input, verbose, }) {
|
|
138
|
+
if (!input || looksLikePath(input)) {
|
|
139
|
+
const pkgDir = resolve(process.cwd(), expandTilde(input ?? '.'));
|
|
140
|
+
if (!existsSync(pkgDir)) {
|
|
141
|
+
throw new BundlerError({
|
|
142
|
+
code: ERROR_CODES.ERR_NO_PACKAGE,
|
|
143
|
+
message: `That path does not exist: ${pkgDir}`,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (!statSync(pkgDir).isDirectory()) {
|
|
147
|
+
throw new BundlerError({
|
|
148
|
+
code: ERROR_CODES.ERR_NO_PACKAGE,
|
|
149
|
+
message: `That path is a file, not a directory: ${pkgDir}`,
|
|
150
|
+
details: [
|
|
151
|
+
'Point at the package folder — the one containing package.json.',
|
|
152
|
+
],
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
pkgDir,
|
|
157
|
+
pkgJson: readPackageJson(pkgDir),
|
|
158
|
+
origin: { kind: 'directory', path: pkgDir },
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const { pkgDir, installedTo } = installFromNpm({ spec: input, verbose });
|
|
162
|
+
const pkgJson = readPackageJson(pkgDir);
|
|
163
|
+
return {
|
|
164
|
+
pkgDir,
|
|
165
|
+
pkgJson,
|
|
166
|
+
origin: {
|
|
167
|
+
kind: 'npm',
|
|
168
|
+
spec: input,
|
|
169
|
+
resolvedVersion: pkgJson.version ?? 'unknown',
|
|
170
|
+
installedTo,
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=resolve-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-source.js","sourceRoot":"","sources":["../src/resolve-source.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAoBxD,SAAS,eAAe,CAAC,MAAc;IACrC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC1C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,YAAY,CAAC;YACrB,IAAI,EAAE,WAAW,CAAC,cAAc;YAChC,OAAO,EAAE,4BAA4B,MAAM,GAAG;YAC9C,OAAO,EAAE,C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eline, from "here is a package" to "here is a folder you can send".
|
|
3
|
+
*
|
|
4
|
+
* Deliberately a plain function rather than a class or a task runner: each step feeds
|
|
5
|
+
* the next, there is no branching worth abstracting, and keeping it linear means the
|
|
6
|
+
* order of operations is readable top to bottom.
|
|
7
|
+
*/
|
|
8
|
+
import type { BundlerLogger } from './log.js';
|
|
9
|
+
import { type BundleMetadata } from './metadata.js';
|
|
10
|
+
import type { BundleOptions } from './prompts.js';
|
|
11
|
+
import { type ResolvedSource } from './resolve-source.js';
|
|
12
|
+
import { type BundleWarning, type ExternalPackage } from './types.js';
|
|
13
|
+
/** Where a bundle lands when the user does not choose. */
|
|
14
|
+
export declare function defaultOutputDirFor(pkgJson: {
|
|
15
|
+
readonly name?: string;
|
|
16
|
+
readonly version?: string;
|
|
17
|
+
}): string;
|
|
18
|
+
export interface RunResult {
|
|
19
|
+
readonly ok: true;
|
|
20
|
+
readonly outputDir: string;
|
|
21
|
+
readonly bundleDir: string;
|
|
22
|
+
readonly metadata: BundleMetadata;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Split the dependency list into "inline this" and "leave it out", with a reason for
|
|
26
|
+
* every exclusion so the metadata and README can explain themselves.
|
|
27
|
+
*/
|
|
28
|
+
export declare function decideExternals({ pkgJson, options, warnings, }: {
|
|
29
|
+
pkgJson: {
|
|
30
|
+
readonly dependencies?: Record<string, string>;
|
|
31
|
+
readonly peerDependencies?: Record<string, string>;
|
|
32
|
+
};
|
|
33
|
+
options: Pick<BundleOptions, 'external' | 'inline' | 'includePeerDeps' | 'strategy'>;
|
|
34
|
+
warnings: BundleWarning[];
|
|
35
|
+
}): {
|
|
36
|
+
readonly externals: readonly ExternalPackage[];
|
|
37
|
+
readonly inlined: readonly string[];
|
|
38
|
+
};
|
|
39
|
+
export declare function run({ options, logger, bundlerVersion, outputDirOverride, resolvedSource, }: {
|
|
40
|
+
options: BundleOptions;
|
|
41
|
+
logger: BundlerLogger;
|
|
42
|
+
bundlerVersion: string;
|
|
43
|
+
/** Already-resolved output directory, when the caller picked one. */
|
|
44
|
+
outputDirOverride?: string;
|
|
45
|
+
/**
|
|
46
|
+
* A source the caller already resolved. The CLI resolves up front so it can prompt
|
|
47
|
+
* using the real package name and default output folder; passing the result back in
|
|
48
|
+
* avoids installing an npm spec a second time.
|
|
49
|
+
*/
|
|
50
|
+
resolvedSource?: ResolvedSource;
|
|
51
|
+
}): Promise<RunResult>;
|
|
52
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AAapB,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,MAAM,CAQT;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE;QACP,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;KACpD,CAAC;IACF,OAAO,EAAE,IAAI,CACX,aAAa,EACb,UAAU,GAAG,QAAQ,GAAG,iBAAiB,GAAG,UAAU,CACvD,CAAC;IACF,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B,GAAG;IACF,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,CAgEA;AAED,wBAAsB,GAAG,CAAC,EACxB,OAAO,EACP,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,cAAc,GACf,EAAE;IACD,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,GAAG,OAAO,CAAC,SAAS,CAAC,CAgOrB"}
|
package/dist/run.js
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pipeline, from "here is a package" to "here is a folder you can send".
|
|
3
|
+
*
|
|
4
|
+
* Deliberately a plain function rather than a class or a task runner: each step feeds
|
|
5
|
+
* the next, there is no branching worth abstracting, and keeping it linear means the
|
|
6
|
+
* order of operations is readable top to bottom.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import { join, resolve } from 'node:path';
|
|
10
|
+
import { ensureDirSync } from '@knapsack/file-utils';
|
|
11
|
+
import { bundlePackage } from './bundle.js';
|
|
12
|
+
import { BundlerError, ERROR_CODES } from './errors.js';
|
|
13
|
+
import { buildMetadata, buildOutputDirName, defaultOutputParent, writeBundleReadme, writeMetadata, } from './metadata.js';
|
|
14
|
+
import { resolveEntries } from './resolve-entries.js';
|
|
15
|
+
import { resolveSource } from './resolve-source.js';
|
|
16
|
+
import { BUILD_TIME_CSS_PACKAGES, EXTERNAL_REASONS, NEVER_INLINE_BY_DEFAULT, } from './types.js';
|
|
17
|
+
import { vendorPackages } from './vendor.js';
|
|
18
|
+
import { verifyBundle } from './verify-bundle.js';
|
|
19
|
+
import { buildBundlePackageJson, copyNonJsAssets, copyRootFiles, findBuildRoots, fixBinShebang, hoistUseClient, writeBundlePackageJson, } from './write-output.js';
|
|
20
|
+
/** Where a bundle lands when the user does not choose. */
|
|
21
|
+
export function defaultOutputDirFor(pkgJson) {
|
|
22
|
+
return join(defaultOutputParent(), buildOutputDirName({
|
|
23
|
+
pkgName: pkgJson.name ?? 'package',
|
|
24
|
+
version: pkgJson.version,
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Split the dependency list into "inline this" and "leave it out", with a reason for
|
|
29
|
+
* every exclusion so the metadata and README can explain themselves.
|
|
30
|
+
*/
|
|
31
|
+
export function decideExternals({ pkgJson, options, warnings, }) {
|
|
32
|
+
const dependencies = Object.keys(pkgJson.dependencies ?? {});
|
|
33
|
+
const peers = Object.keys(pkgJson.peerDependencies ?? {});
|
|
34
|
+
const externals = new Map();
|
|
35
|
+
const forceInline = new Set(options.inline);
|
|
36
|
+
if (options.strategy === 'vendor') {
|
|
37
|
+
for (const name of [...dependencies, ...peers]) {
|
|
38
|
+
externals.set(name, {
|
|
39
|
+
name,
|
|
40
|
+
reason: EXTERNAL_REASONS.vendorStrategy,
|
|
41
|
+
vendored: !peers.includes(name),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return { externals: [...externals.values()], inlined: [] };
|
|
45
|
+
}
|
|
46
|
+
// Peers belong to the consumer by definition.
|
|
47
|
+
if (!options.includePeerDeps) {
|
|
48
|
+
for (const name of peers) {
|
|
49
|
+
externals.set(name, {
|
|
50
|
+
name,
|
|
51
|
+
version: pkgJson.peerDependencies?.[name],
|
|
52
|
+
reason: EXTERNAL_REASONS.peerDependency,
|
|
53
|
+
vendored: false,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Frameworks stay out even when declared as a regular dependency, which design
|
|
58
|
+
// systems frequently do. Inlining one hands the consumer a second copy.
|
|
59
|
+
for (const name of dependencies) {
|
|
60
|
+
if (forceInline.has(name))
|
|
61
|
+
continue;
|
|
62
|
+
if (!NEVER_INLINE_BY_DEFAULT.includes(name))
|
|
63
|
+
continue;
|
|
64
|
+
externals.set(name, {
|
|
65
|
+
name,
|
|
66
|
+
version: pkgJson.dependencies?.[name],
|
|
67
|
+
reason: EXTERNAL_REASONS.framework,
|
|
68
|
+
vendored: false,
|
|
69
|
+
});
|
|
70
|
+
warnings.push({
|
|
71
|
+
code: 'FRAMEWORK_NOT_INLINED',
|
|
72
|
+
message: `${name} is a regular dependency but was left out of the bundle.`,
|
|
73
|
+
hint: `Whoever uses the bundle must provide ${name}. Pass --inline ${name} to bundle it anyway.`,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
// Explicit user requests are copied in as files, so the bundle still runs.
|
|
77
|
+
for (const name of options.external) {
|
|
78
|
+
externals.set(name, {
|
|
79
|
+
name,
|
|
80
|
+
version: pkgJson.dependencies?.[name],
|
|
81
|
+
reason: EXTERNAL_REASONS.requested,
|
|
82
|
+
vendored: true,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
for (const name of forceInline) {
|
|
86
|
+
externals.delete(name);
|
|
87
|
+
}
|
|
88
|
+
const inlined = dependencies.filter((name) => !externals.has(name));
|
|
89
|
+
return { externals: [...externals.values()], inlined };
|
|
90
|
+
}
|
|
91
|
+
export async function run({ options, logger, bundlerVersion, outputDirOverride, resolvedSource, }) {
|
|
92
|
+
const warnings = [];
|
|
93
|
+
// --- 1. Find the package -------------------------------------------------------
|
|
94
|
+
logger.debug('Resolving source', {
|
|
95
|
+
evt: { name: 'packageBundler.resolveSource', outcome: 'unknown' },
|
|
96
|
+
});
|
|
97
|
+
const { pkgDir, pkgJson, origin } = resolvedSource ??
|
|
98
|
+
resolveSource({ input: options.source, verbose: options.verbose });
|
|
99
|
+
const packageLabel = `${pkgJson.name ?? '(unnamed)'}${pkgJson.version ? `@${pkgJson.version}` : ''}`;
|
|
100
|
+
// --- 2. Work out what to bundle ------------------------------------------------
|
|
101
|
+
const entries = resolveEntries({
|
|
102
|
+
pkgDir,
|
|
103
|
+
pkgJson,
|
|
104
|
+
entryOverrides: options.entry.map((entry) => resolve(process.cwd(), entry)),
|
|
105
|
+
});
|
|
106
|
+
logger.debug(`Found ${entries.length} entry point(s)`, {
|
|
107
|
+
evt: { name: 'packageBundler.resolveEntries', outcome: 'success' },
|
|
108
|
+
});
|
|
109
|
+
const wildcardEntries = entries.filter((entry) => entry.fromWildcard);
|
|
110
|
+
if (wildcardEntries.length > 0) {
|
|
111
|
+
warnings.push({
|
|
112
|
+
code: 'WILDCARD_EXPORTS_EXPANDED',
|
|
113
|
+
message: `package.json uses wildcard exports; expanded to ${wildcardEntries.length} concrete entry point(s).`,
|
|
114
|
+
hint: "Check the bundle's exports map covers everything your consumers import.",
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// --- 3. Decide what stays outside the bundle -----------------------------------
|
|
118
|
+
const { externals, inlined } = decideExternals({
|
|
119
|
+
pkgJson,
|
|
120
|
+
options,
|
|
121
|
+
warnings,
|
|
122
|
+
});
|
|
123
|
+
const buildTimeCss = Object.keys(pkgJson.dependencies ?? {}).filter((name) => BUILD_TIME_CSS_PACKAGES.includes(name));
|
|
124
|
+
if (buildTimeCss.length > 0) {
|
|
125
|
+
// Their styling is resolved by a build-time transform that no longer runs. The
|
|
126
|
+
// failure otherwise surfaces as an opaque throw on import, so name it up front.
|
|
127
|
+
warnings.push({
|
|
128
|
+
code: 'BUILD_TIME_CSS',
|
|
129
|
+
message: `Depends on ${buildTimeCss.join(', ')}, whose styles are generated at build time by a compiler plugin.`,
|
|
130
|
+
hint: "Styling may not work in the bundle. Ship your package's prebuilt CSS separately if so.",
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
// --- 4. Pick the output location -----------------------------------------------
|
|
134
|
+
const outputDir = outputDirOverride ??
|
|
135
|
+
(options.outDir
|
|
136
|
+
? resolve(process.cwd(), options.outDir)
|
|
137
|
+
: defaultOutputDirFor(pkgJson));
|
|
138
|
+
if (existsSync(outputDir) &&
|
|
139
|
+
readdirSync(outputDir).length > 0 &&
|
|
140
|
+
!options.force) {
|
|
141
|
+
throw new BundlerError({
|
|
142
|
+
code: ERROR_CODES.ERR_OUTPUT_NOT_EMPTY,
|
|
143
|
+
message: `${outputDir} already exists and is not empty.`,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const bundleDir = join(outputDir, 'bundle');
|
|
147
|
+
ensureDirSync(bundleDir);
|
|
148
|
+
// --- 5. Bundle -----------------------------------------------------------------
|
|
149
|
+
logger.info(`Bundling ${packageLabel}`, {
|
|
150
|
+
evt: { name: 'packageBundler.build', outcome: 'unknown' },
|
|
151
|
+
});
|
|
152
|
+
const externalNames = externals.map((external) => external.name);
|
|
153
|
+
const { warnings: buildWarnings, hadUseClientDirective, emittedImports, } = await bundlePackage({
|
|
154
|
+
pkgDir,
|
|
155
|
+
entries,
|
|
156
|
+
outDir: bundleDir,
|
|
157
|
+
externals: externalNames,
|
|
158
|
+
treeshake: options.treeshake,
|
|
159
|
+
verbose: options.verbose,
|
|
160
|
+
});
|
|
161
|
+
warnings.push(...buildWarnings);
|
|
162
|
+
// --- 6. Copy what the bundler cannot see ---------------------------------------
|
|
163
|
+
const buildRoots = findBuildRoots({
|
|
164
|
+
pkgDir,
|
|
165
|
+
entrySourceFiles: entries.map((entry) => entry.sourceFile),
|
|
166
|
+
});
|
|
167
|
+
copyNonJsAssets({ buildRoots, bundleDir });
|
|
168
|
+
copyRootFiles({ pkgDir, bundleDir });
|
|
169
|
+
// --- 7. Ship the packages that refused to be inlined ---------------------------
|
|
170
|
+
const toVendor = externals
|
|
171
|
+
.filter((external) => external.vendored)
|
|
172
|
+
.map((e) => e.name);
|
|
173
|
+
let vendoredExternals = externals;
|
|
174
|
+
if (toVendor.length > 0) {
|
|
175
|
+
logger.debug(`Vendoring ${toVendor.length} package(s)`, {
|
|
176
|
+
evt: { name: 'packageBundler.vendor', outcome: 'unknown' },
|
|
177
|
+
});
|
|
178
|
+
const { vendored, missing } = vendorPackages({
|
|
179
|
+
names: toVendor,
|
|
180
|
+
fromDir: pkgDir,
|
|
181
|
+
bundleDir,
|
|
182
|
+
});
|
|
183
|
+
const versions = new Map(vendored.map((item) => [item.name, item.version]));
|
|
184
|
+
vendoredExternals = externals.map((external) => versions.has(external.name)
|
|
185
|
+
? { ...external, version: versions.get(external.name) }
|
|
186
|
+
: external);
|
|
187
|
+
for (const name of missing) {
|
|
188
|
+
warnings.push({
|
|
189
|
+
code: 'VENDOR_MISSING',
|
|
190
|
+
message: `Could not find ${name} to copy into the bundle.`,
|
|
191
|
+
hint: 'Run your install so the package is present, then bundle again.',
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// --- 8. Post-process the emitted files -----------------------------------------
|
|
196
|
+
if (hadUseClientDirective) {
|
|
197
|
+
for (const entry of entries) {
|
|
198
|
+
const file = join(bundleDir, `${entry.name}.mjs`);
|
|
199
|
+
if (existsSync(file))
|
|
200
|
+
hoistUseClient(file);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
for (const entry of entries) {
|
|
204
|
+
if (!entry.binName)
|
|
205
|
+
continue;
|
|
206
|
+
const file = join(bundleDir, `${entry.name}.mjs`);
|
|
207
|
+
if (existsSync(file))
|
|
208
|
+
fixBinShebang(file);
|
|
209
|
+
}
|
|
210
|
+
writeBundlePackageJson({
|
|
211
|
+
bundleDir,
|
|
212
|
+
contents: buildBundlePackageJson({
|
|
213
|
+
bundleDir,
|
|
214
|
+
pkgJson,
|
|
215
|
+
entries,
|
|
216
|
+
externals: vendoredExternals,
|
|
217
|
+
origin: {
|
|
218
|
+
kind: origin.kind,
|
|
219
|
+
detail: origin.kind === 'npm' ? origin.spec : origin.path,
|
|
220
|
+
},
|
|
221
|
+
bundlerVersion,
|
|
222
|
+
hadUseClientDirective,
|
|
223
|
+
}),
|
|
224
|
+
});
|
|
225
|
+
// --- 9. Prove it works ---------------------------------------------------------
|
|
226
|
+
logger.debug('Verifying bundle', {
|
|
227
|
+
evt: { name: 'packageBundler.verify', outcome: 'unknown' },
|
|
228
|
+
});
|
|
229
|
+
const verifyReport = verifyBundle({
|
|
230
|
+
bundleDir,
|
|
231
|
+
emittedImports,
|
|
232
|
+
peerDependencies: vendoredExternals
|
|
233
|
+
.filter((external) => !external.vendored)
|
|
234
|
+
.map((external) => external.name),
|
|
235
|
+
vendoredPackages: vendoredExternals
|
|
236
|
+
.filter((external) => external.vendored)
|
|
237
|
+
.map((external) => external.name),
|
|
238
|
+
strict: options.strict,
|
|
239
|
+
});
|
|
240
|
+
if (options.strict && warnings.length > 0) {
|
|
241
|
+
throw new BundlerError({
|
|
242
|
+
code: ERROR_CODES.ERR_STRICT_WARNINGS,
|
|
243
|
+
message: `--strict is set and the run produced ${warnings.length} warning(s).`,
|
|
244
|
+
details: warnings.map((warning) => `${warning.code}: ${warning.message}`),
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
// --- 10. Write the paperwork ---------------------------------------------------
|
|
248
|
+
writeFileSync(join(outputDir, 'package.original.json'), readFileSync(join(pkgDir, 'package.json'), 'utf8'));
|
|
249
|
+
const metadata = buildMetadata({
|
|
250
|
+
pkgJson,
|
|
251
|
+
origin,
|
|
252
|
+
entries,
|
|
253
|
+
externals: vendoredExternals,
|
|
254
|
+
inlined,
|
|
255
|
+
warnings,
|
|
256
|
+
verifyReport,
|
|
257
|
+
bundleDir,
|
|
258
|
+
bundlerVersion,
|
|
259
|
+
hadUseClientDirective,
|
|
260
|
+
treeshake: options.treeshake,
|
|
261
|
+
});
|
|
262
|
+
writeMetadata({ outputDir, metadata });
|
|
263
|
+
writeBundleReadme({ outputDir, metadata });
|
|
264
|
+
writeFileSync(join(outputDir, 'build-log.txt'), `${[
|
|
265
|
+
`Bundled ${packageLabel} at ${metadata.bundledAt}`,
|
|
266
|
+
`Bundler ${bundlerVersion}, Node ${process.version}`,
|
|
267
|
+
'',
|
|
268
|
+
`Warnings (${warnings.length}):`,
|
|
269
|
+
...warnings.map((warning) => ` [${warning.code}] ${warning.message}${warning.module ? `\n module: ${warning.module}` : ''}${warning.hint ? `\n hint: ${warning.hint}` : ''}`),
|
|
270
|
+
].join('\n')}\n`);
|
|
271
|
+
logger.info(`Bundle complete: ${outputDir}`, {
|
|
272
|
+
evt: { name: 'packageBundler.complete', outcome: 'success' },
|
|
273
|
+
});
|
|
274
|
+
return { ok: true, outputDir, bundleDir, metadata };
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=run.js.map
|
package/dist/run.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GAEd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO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ACd,qBAAqB;QACrB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC,CAAC;IAEH,aAAa,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IACvC,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC3C,aAAa,CACX,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,EAChC,GAAG;QACD,WAAW,YAAY,OAAO,QAAQ,CAAC,SAAS,EAAE;QAClD,WAAW,cAAc,UAAU,OAAO,CAAC,OAAO,EAAE;QACpD,EAAE;QACF,aAAa,QAAQ,CAAC,MAAM,IAAI;QAChC,GAAG,QAAQ,CAAC,GAAG,CACb,CAAC,OAAO,EAAE,EAAE,CACV,MAAM,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACzJ;KACF,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACjB,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,oBAAoB,SAAS,EAAE,EAAE;QAC3C,GAAG,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,SAAS,EAAE;KAC7D,CAAC,CAAC;IAEH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACtD,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** Shared shapes for the bundling pipeline. */
|
|
2
|
+
/** Why a package ended up outside the bundle. */
|
|
3
|
+
export declare const EXTERNAL_REASONS: {
|
|
4
|
+
/** Declared in `peerDependencies` — the consumer supplies it. */
|
|
5
|
+
readonly peerDependency: "peerDependency";
|
|
6
|
+
/** A UI framework we never inline, even when listed as a regular dependency. */
|
|
7
|
+
readonly framework: "framework";
|
|
8
|
+
/** The user asked for it via `--external`. */
|
|
9
|
+
readonly requested: "requested";
|
|
10
|
+
/** Ships a native `.node` binding. */
|
|
11
|
+
readonly nativeBinding: "nativeBinding";
|
|
12
|
+
/** Builds a native addon at install time. */
|
|
13
|
+
readonly nativeBuild: "nativeBuild";
|
|
14
|
+
/** Runs code in a worker thread from a separate entry file. */
|
|
15
|
+
readonly workerThread: "workerThread";
|
|
16
|
+
/** `--strategy vendor`: nothing gets inlined. */
|
|
17
|
+
readonly vendorStrategy: "vendorStrategy";
|
|
18
|
+
};
|
|
19
|
+
export type ExternalReason = (typeof EXTERNAL_REASONS)[keyof typeof EXTERNAL_REASONS];
|
|
20
|
+
/** Human-readable explanation per reason, for the README and metadata. */
|
|
21
|
+
export declare const EXTERNAL_REASON_LABELS: Record<ExternalReason, string>;
|
|
22
|
+
/**
|
|
23
|
+
* UI frameworks are never inlined, even when a package lists them under
|
|
24
|
+
* `dependencies` rather than `peerDependencies` (which design systems often do).
|
|
25
|
+
* Two copies of React in one process is a broken app, so the safer default is to
|
|
26
|
+
* leave them out and record them as required. `--inline <pkg>` overrides.
|
|
27
|
+
*/
|
|
28
|
+
export declare const NEVER_INLINE_BY_DEFAULT: readonly string[];
|
|
29
|
+
/**
|
|
30
|
+
* Packages whose styling is resolved by a build-time transform. Re-bundling their
|
|
31
|
+
* output leaves the runtime half without its compile-time half, and the failure shows
|
|
32
|
+
* up as an unhelpful throw on import — so we warn up front instead.
|
|
33
|
+
*/
|
|
34
|
+
export declare const BUILD_TIME_CSS_PACKAGES: readonly string[];
|
|
35
|
+
/** A package left outside the bundle, and whether we shipped it alongside. */
|
|
36
|
+
export interface ExternalPackage {
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly reason: ExternalReason;
|
|
39
|
+
/** Resolved version, when we could determine one. */
|
|
40
|
+
readonly version?: string;
|
|
41
|
+
/** True when the package's real files were copied into `bundle/node_modules/`. */
|
|
42
|
+
readonly vendored: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** Something worth telling the user that didn't stop the build. */
|
|
45
|
+
export interface BundleWarning extends Readonly<{
|
|
46
|
+
code: string;
|
|
47
|
+
message: string;
|
|
48
|
+
/** The module that triggered it, when known. */
|
|
49
|
+
module?: string;
|
|
50
|
+
/** What the user can do about it. */
|
|
51
|
+
hint?: string;
|
|
52
|
+
}> {
|
|
53
|
+
}
|
|
54
|
+
/** One entry point: the subpath consumers import, and the built file behind it. */
|
|
55
|
+
export interface EntryPoint {
|
|
56
|
+
/** Output name, e.g. `index` or `components/button`. */
|
|
57
|
+
readonly name: string;
|
|
58
|
+
/** Absolute path to the already-built source file. */
|
|
59
|
+
readonly sourceFile: string;
|
|
60
|
+
/** The `exports` subpath this satisfies, e.g. `.` or `./button`. */
|
|
61
|
+
readonly subpath: string;
|
|
62
|
+
/** Set when this came from `bin` rather than `exports`. */
|
|
63
|
+
readonly binName?: string;
|
|
64
|
+
/** True when this entry was produced by expanding a wildcard `exports` pattern. */
|
|
65
|
+
readonly fromWildcard: boolean;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C,iDAAiD;AACjD,eAAO,MAAM,gBAAgB;IAC3B,iEAAiE;;IAEjE,gFAAgF;;IAEhF,8CAA8C;;IAE9C,sCAAsC;;IAEtC,6CAA6C;;IAE7C,+DAA+D;;IAE/D,iDAAiD;;CAEzC,CAAC;AAEX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,cAAc,EAAE,MAA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