@ms-cloudpack/bundler 0.6.6 → 0.7.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/CHANGELOG.json +49 -1
- package/CHANGELOG.md +21 -2
- package/lib/allBundlers.js +2 -4
- package/lib/allBundlers.js.map +1 -1
- package/lib/bundle.d.ts +6 -0
- package/lib/bundle.js +41 -0
- package/lib/bundle.js.map +1 -0
- package/lib/bundlePackage.d.ts +3 -13
- package/lib/bundlePackage.js +10 -28
- package/lib/bundlePackage.js.map +1 -1
- package/lib/chooseBundler.d.ts +2 -2
- package/lib/chooseBundler.js +3 -6
- package/lib/chooseBundler.js.map +1 -1
- package/lib/getEntriesMapFromPackage.d.ts +10 -0
- package/lib/getEntriesMapFromPackage.js +53 -0
- package/lib/getEntriesMapFromPackage.js.map +1 -0
- package/lib/getEntriesMapFromPackage.test.d.ts +1 -0
- package/lib/getEntriesMapFromPackage.test.js +82 -0
- package/lib/getEntriesMapFromPackage.test.js.map +1 -0
- package/lib/getExternalsFromPackage.d.ts +8 -0
- package/lib/getExternalsFromPackage.js +17 -0
- package/lib/getExternalsFromPackage.js.map +1 -0
- package/lib/getExternalsFromPackage.test.d.ts +1 -0
- package/lib/getExternalsFromPackage.test.js +41 -0
- package/lib/getExternalsFromPackage.test.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +9 -6
- package/lib/abstractions/webpack.d.ts +0 -2
- package/lib/abstractions/webpack.js +0 -9
- package/lib/abstractions/webpack.js.map +0 -1
- package/lib/getBundlerOptions.d.ts +0 -3
- package/lib/getBundlerOptions.js +0 -13
- package/lib/getBundlerOptions.js.map +0 -1
- package/lib/getCachedResult.d.ts +0 -5
- package/lib/getCachedResult.js +0 -8
- package/lib/getCachedResult.js.map +0 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,55 @@
|
|
|
2
2
|
"name": "@ms-cloudpack/bundler",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Wed,
|
|
5
|
+
"date": "Wed, 02 Nov 2022 08:10:59 GMT",
|
|
6
|
+
"tag": "@ms-cloudpack/bundler_v0.7.0",
|
|
7
|
+
"version": "0.7.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dzearing@microsoft.com",
|
|
12
|
+
"package": "@ms-cloudpack/bundler",
|
|
13
|
+
"commit": "3439c51ff4eb7cb624cf84fb2881a781eabca83f",
|
|
14
|
+
"comment": "Implementing updates to adhere to changes in bundler-types."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@ms-cloudpack/bundler",
|
|
19
|
+
"comment": "Bump @ms-cloudpack/bundler-plugin-ori to v0.7.0",
|
|
20
|
+
"commit": "24143dab856b05b0b516edcb8a5cc72563ecb380"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@ms-cloudpack/bundler",
|
|
25
|
+
"comment": "Bump @ms-cloudpack/bundler-plugin-rollup to v0.4.0",
|
|
26
|
+
"commit": "24143dab856b05b0b516edcb8a5cc72563ecb380"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@ms-cloudpack/bundler",
|
|
31
|
+
"comment": "Bump @ms-cloudpack/package-utilities to v1.2.0",
|
|
32
|
+
"commit": "24143dab856b05b0b516edcb8a5cc72563ecb380"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"date": "Tue, 01 Nov 2022 08:11:03 GMT",
|
|
39
|
+
"tag": "@ms-cloudpack/bundler_v0.6.7",
|
|
40
|
+
"version": "0.6.7",
|
|
41
|
+
"comments": {
|
|
42
|
+
"patch": [
|
|
43
|
+
{
|
|
44
|
+
"author": "dzearing@microsoft.com",
|
|
45
|
+
"package": "@ms-cloudpack/bundler",
|
|
46
|
+
"commit": "264fdebf12d3c964f2520feef232af76425cdc4c",
|
|
47
|
+
"comment": "Removing esbuild and webpack plugins."
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"date": "Wed, 26 Oct 2022 08:13:21 GMT",
|
|
6
54
|
"tag": "@ms-cloudpack/bundler_v0.6.6",
|
|
7
55
|
"version": "0.6.6",
|
|
8
56
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
# Change Log - @ms-cloudpack/bundler
|
|
2
2
|
|
|
3
|
-
This log was last generated on Wed,
|
|
3
|
+
This log was last generated on Wed, 02 Nov 2022 08:10:59 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.7.0
|
|
8
|
+
|
|
9
|
+
Wed, 02 Nov 2022 08:10:59 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Implementing updates to adhere to changes in bundler-types. (dzearing@microsoft.com)
|
|
14
|
+
- Bump @ms-cloudpack/bundler-plugin-ori to v0.7.0
|
|
15
|
+
- Bump @ms-cloudpack/bundler-plugin-rollup to v0.4.0
|
|
16
|
+
- Bump @ms-cloudpack/package-utilities to v1.2.0
|
|
17
|
+
|
|
18
|
+
## 0.6.7
|
|
19
|
+
|
|
20
|
+
Tue, 01 Nov 2022 08:11:03 GMT
|
|
21
|
+
|
|
22
|
+
### Patches
|
|
23
|
+
|
|
24
|
+
- Removing esbuild and webpack plugins. (dzearing@microsoft.com)
|
|
25
|
+
|
|
7
26
|
## 0.6.6
|
|
8
27
|
|
|
9
|
-
Wed, 26 Oct 2022 08:13:
|
|
28
|
+
Wed, 26 Oct 2022 08:13:21 GMT
|
|
10
29
|
|
|
11
30
|
### Patches
|
|
12
31
|
|
package/lib/allBundlers.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export const allBundlers = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
webpack: async () => (await import('./abstractions/webpack.js')).webpack,
|
|
5
|
-
ori: async () => (await import('@ms-cloudpack/bundler-plugin-ori')).oriBuild,
|
|
2
|
+
rollup: async () => (await import('@ms-cloudpack/bundler-plugin-rollup')).default,
|
|
3
|
+
ori: async () => (await import('@ms-cloudpack/bundler-plugin-ori')).default,
|
|
6
4
|
};
|
|
7
5
|
//# sourceMappingURL=allBundlers.js.map
|
package/lib/allBundlers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"allBundlers.js","sourceRoot":"","sources":["../src/allBundlers.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAA2C;IACjE,
|
|
1
|
+
{"version":3,"file":"allBundlers.js","sourceRoot":"","sources":["../src/allBundlers.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAA2C;IACjE,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAAC,OAAO;IACjF,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,kCAAkC,CAAC,CAAC,CAAC,OAAO;CAC5E,CAAC"}
|
package/lib/bundle.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BundleOptions, BundleResult } from '@ms-cloudpack/bundler-types';
|
|
2
|
+
/**
|
|
3
|
+
* Abstracted consumer input to the bundle method for the appropriate bundler. Provides a more
|
|
4
|
+
* advanced api surface.
|
|
5
|
+
*/
|
|
6
|
+
export declare function bundle(options: BundleOptions): Promise<BundleResult>;
|
package/lib/bundle.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { chooseBundler } from './chooseBundler.js';
|
|
2
|
+
import { writeJson } from '@ms-cloudpack/json-utilities';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
const log = (...messages) => console.log('Bundler:', ...messages);
|
|
5
|
+
/**
|
|
6
|
+
* Abstracted consumer input to the bundle method for the appropriate bundler. Provides a more
|
|
7
|
+
* advanced api surface.
|
|
8
|
+
*/
|
|
9
|
+
export async function bundle(options) {
|
|
10
|
+
// Choose the bundler type and bundle.
|
|
11
|
+
const { inputPath, outputPath = options.inputPath } = options;
|
|
12
|
+
const bundler = await chooseBundler(options);
|
|
13
|
+
let result = undefined;
|
|
14
|
+
const start = Date.now();
|
|
15
|
+
try {
|
|
16
|
+
log(`Bundling "${options.inputPath}" with "${bundler.name}"`);
|
|
17
|
+
result = await bundler.bundle(options);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
result = {
|
|
21
|
+
errors: [
|
|
22
|
+
{
|
|
23
|
+
text: `Unexpected exception: ${e}`,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
const { rawInput, rawOutput } = result || {};
|
|
30
|
+
await Promise.all([
|
|
31
|
+
rawInput && writeJson(path.join(outputPath, `${bundler.name}-input.json`), rawInput),
|
|
32
|
+
rawOutput && writeJson(path.join(outputPath, `${bundler.name}-output.json`), rawOutput),
|
|
33
|
+
]);
|
|
34
|
+
log(`Bundled "${inputPath}" with "${bundler.name}", ${result?.errors?.length || 0} error(s), ${Date.now() - start}ms`);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
bundlerName: bundler.name,
|
|
38
|
+
...result,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEn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,OAAO,CAAC,IAAI,MAAM,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,cAAc,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAClH,CAAC;KACH;IAED,OAAO;QACL,WAAW,EAAE,OAAO,CAAC,IAAI;QACzB,GAAG,MAAM;KACV,CAAC;AACJ,CAAC"}
|
package/lib/bundlePackage.d.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { allBundlers } from './allBundlers.js';
|
|
1
|
+
import type { BundleOptions, BundleResult } from '@ms-cloudpack/bundler-types';
|
|
3
2
|
import type { PackageDefinitions } from '@ms-cloudpack/package-utilities';
|
|
4
|
-
export interface BundlePackageOptions {
|
|
5
|
-
packagePath: string;
|
|
6
|
-
outputPath: string;
|
|
7
|
-
bundlerOptions?: Record<string, unknown>;
|
|
8
|
-
bundlerType?: 'auto' | keyof typeof allBundlers;
|
|
9
|
-
disableSourceMaps?: boolean;
|
|
10
|
-
entries?: string[];
|
|
11
|
-
force?: boolean;
|
|
12
|
-
incremental?: boolean;
|
|
13
|
-
outputType?: 'library' | 'app';
|
|
3
|
+
export interface BundlePackageOptions extends Omit<BundleOptions, 'entries'> {
|
|
14
4
|
packages?: PackageDefinitions;
|
|
15
5
|
}
|
|
16
6
|
/**
|
|
17
7
|
* Abstracted consumer input to the bundlePackage API.
|
|
18
8
|
*/
|
|
19
|
-
export declare function bundlePackage(options: BundlePackageOptions): Promise<
|
|
9
|
+
export declare function bundlePackage(options: BundlePackageOptions): Promise<BundleResult>;
|
package/lib/bundlePackage.js
CHANGED
|
@@ -1,34 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { bundle } from './bundle.js';
|
|
2
|
+
import { getExternalsFromPackage } from './getExternalsFromPackage.js';
|
|
3
|
+
import { getEntriesMapFromPackage } from './getEntriesMapFromPackage.js';
|
|
4
4
|
/**
|
|
5
5
|
* Abstracted consumer input to the bundlePackage API.
|
|
6
6
|
*/
|
|
7
7
|
export async function bundlePackage(options) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
result = await bundler.bundle(bundlerOptions);
|
|
16
|
-
}
|
|
17
|
-
catch (e) {
|
|
18
|
-
result = {
|
|
19
|
-
errors: [
|
|
20
|
-
{
|
|
21
|
-
text: `Unexpected exception: ${e}`,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
finally {
|
|
27
|
-
log(`Bundled "${options.packagePath}" with "${bundler.name}", ${result?.errors?.length || 0} error(s), ${Date.now() - start}ms`);
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
bundlerName: bundler.name,
|
|
31
|
-
...result,
|
|
32
|
-
};
|
|
8
|
+
const entries = await getEntriesMapFromPackage(options);
|
|
9
|
+
const { external = await getExternalsFromPackage(options) } = options;
|
|
10
|
+
return await bundle({
|
|
11
|
+
...options,
|
|
12
|
+
entries,
|
|
13
|
+
external,
|
|
14
|
+
});
|
|
33
15
|
}
|
|
34
16
|
//# sourceMappingURL=bundlePackage.js.map
|
package/lib/bundlePackage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundlePackage.js","sourceRoot":"","sources":["../src/bundlePackage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundlePackage.js","sourceRoot":"","sources":["../src/bundlePackage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAMzE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA6B;IAC/D,MAAM,OAAO,GAAG,MAAM,wBAAwB,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,EAAE,QAAQ,GAAG,MAAM,uBAAuB,CAAC,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC;IAEtE,OAAO,MAAM,MAAM,CAAC;QAClB,GAAG,OAAO;QACV,OAAO;QACP,QAAQ;KACT,CAAC,CAAC;AACL,CAAC"}
|
package/lib/chooseBundler.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Bundler,
|
|
1
|
+
import type { Bundler, BundleOptions } from '@ms-cloudpack/bundler-types';
|
|
2
2
|
/**
|
|
3
3
|
* Mediates which bundler to use.
|
|
4
4
|
* @param options Bundler options, defining what we expect to bundle and how.
|
|
5
5
|
* @returns A bundler plugin.
|
|
6
6
|
*/
|
|
7
|
-
export declare function chooseBundler(options:
|
|
7
|
+
export declare function chooseBundler(options: BundleOptions): Promise<Bundler>;
|
package/lib/chooseBundler.js
CHANGED
|
@@ -7,13 +7,10 @@ import { detectModuleType } from '@ms-cloudpack/package-utilities';
|
|
|
7
7
|
* @returns A bundler plugin.
|
|
8
8
|
*/
|
|
9
9
|
export async function chooseBundler(options) {
|
|
10
|
-
const { bundlerType,
|
|
11
|
-
const {
|
|
10
|
+
const { bundlerType, inputPath, entries } = options;
|
|
11
|
+
const { rollup, ori } = allBundlers;
|
|
12
12
|
if (!bundlerType || bundlerType === 'auto') {
|
|
13
|
-
|
|
14
|
-
return await webpack();
|
|
15
|
-
}
|
|
16
|
-
const moduleType = await detectModuleType(path.resolve(packagePath, entries[0]));
|
|
13
|
+
const moduleType = await detectModuleType(path.resolve(inputPath, Object.values(entries)[0]));
|
|
17
14
|
if (moduleType === 'cjs') {
|
|
18
15
|
return await rollup();
|
|
19
16
|
}
|
package/lib/chooseBundler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chooseBundler.js","sourceRoot":"","sources":["../src/chooseBundler.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"chooseBundler.js","sourceRoot":"","sources":["../src/chooseBundler.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAsB;IACxD,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACpD,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC;IAEpC,IAAI,CAAC,WAAW,IAAI,WAAW,KAAK,MAAM,EAAE;QAC1C,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE9F,IAAI,UAAU,KAAK,KAAK,EAAE;YACxB,OAAO,MAAM,MAAM,EAAE,CAAC;SACvB;QAED,OAAO,MAAM,GAAG,EAAE,CAAC;KACpB;IAED,OAAO,MAAM,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PackageDefinitions } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
/**
|
|
3
|
+
* Gets the entries map for a given package. An entries map is different from an exports map in that
|
|
4
|
+
* the keys are relative paths to where the output should live, rather than how the entry is imported.
|
|
5
|
+
* The data structure is used for bundler config; not for resolution of imports.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getEntriesMapFromPackage(options: {
|
|
8
|
+
inputPath: string;
|
|
9
|
+
packages?: PackageDefinitions;
|
|
10
|
+
}): Promise<Record<string, string>>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { flattenExportsMap, getExportsMap, isExternalPackage, } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
import { intermediateToSourcePath } from '@ms-cloudpack/path-utilities';
|
|
3
|
+
import { isValidBundleEntry } from './isValidBundleEntry.js';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { slash } from '@ms-cloudpack/path-string-parsing';
|
|
6
|
+
/**
|
|
7
|
+
* Gets the entries map for a given package. An entries map is different from an exports map in that
|
|
8
|
+
* the keys are relative paths to where the output should live, rather than how the entry is imported.
|
|
9
|
+
* The data structure is used for bundler config; not for resolution of imports.
|
|
10
|
+
*/
|
|
11
|
+
export async function getEntriesMapFromPackage(options) {
|
|
12
|
+
const { inputPath } = options;
|
|
13
|
+
const isInternal = !isExternalPackage(inputPath);
|
|
14
|
+
const exportsMap = await getExportsMap(inputPath, options);
|
|
15
|
+
const flattenedMap = flattenExportsMap(exportsMap);
|
|
16
|
+
let sourceExportsMap;
|
|
17
|
+
// The flattened map values tell us what physical files will show up in the import map on the page. We use these
|
|
18
|
+
// as the keys for the entries map, which results in physical file output from the bundler.
|
|
19
|
+
// For internal packages, we want the values (the inputs to the each entry) to use source paths if available. To
|
|
20
|
+
// get these, we can either derive from exports map "source" entries, or if those are not available, we can attempt
|
|
21
|
+
// to derive source paths from intermediate paths.
|
|
22
|
+
if (isInternal) {
|
|
23
|
+
sourceExportsMap = flattenExportsMap(exportsMap, { conditions: ['source'], requiredConditions: ['source'] });
|
|
24
|
+
for (const [key, value] of Object.entries(flattenedMap)) {
|
|
25
|
+
if (!sourceExportsMap[key]) {
|
|
26
|
+
sourceExportsMap[key] = intermediateToSourcePath(value, inputPath) || value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return Object.fromEntries(Object.entries(flattenedMap)
|
|
31
|
+
.filter(([, value]) => isValidBundleEntry(value))
|
|
32
|
+
.map(([key, value]) => [
|
|
33
|
+
toSafeEntryKey(value),
|
|
34
|
+
makeSafeRelativePath(inputPath, sourceExportsMap?.[key] || value),
|
|
35
|
+
]));
|
|
36
|
+
}
|
|
37
|
+
// When we derive keys, we want to preserve unknown script extensions. For others, remove them as the bundler
|
|
38
|
+
// will add back `'.js'` for us in the output.
|
|
39
|
+
const extensionsToStrip = ['.js', '.jsx', '.mjs', '.cjs', '.ts', '.tsx', '.mts', '.cts', '.cjs'];
|
|
40
|
+
function toSafeEntryKey(entry) {
|
|
41
|
+
const extension = path.extname(entry);
|
|
42
|
+
if (extensionsToStrip.includes(extension)) {
|
|
43
|
+
return entry.slice(0, -extension.length);
|
|
44
|
+
}
|
|
45
|
+
return entry;
|
|
46
|
+
}
|
|
47
|
+
function makeSafeRelativePath(inputPath, entry) {
|
|
48
|
+
if (path.isAbsolute(entry)) {
|
|
49
|
+
entry = path.relative(inputPath, entry);
|
|
50
|
+
}
|
|
51
|
+
return slash(entry.startsWith('.') ? entry : `./${entry}`);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=getEntriesMapFromPackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntriesMapFromPackage.js","sourceRoot":"","sources":["../src/getEntriesMapFromPackage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,iBAAiB,GAElB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,OAG9C;IACC,MA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EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjG,SAAS,cAAc,CAAC,KAAa;IACnC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACzC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;KAC1C;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,oBAAoB,CAAC,SAAiB,EAAE,KAAa;IAC5D,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QAC1B,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;KACzC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { describe, it, expect } from '@jest/globals';
|
|
2
|
+
import { getEntriesMapFromPackage } from './getEntriesMapFromPackage.js';
|
|
3
|
+
import { createTestFileStructure } from '@ms-cloudpack/test-utilities';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
describe('getEntriesMapFromPackage', () => {
|
|
6
|
+
it('returns an index.js entry correctly by inferring entries from the main entry', async () => {
|
|
7
|
+
const inputPath = await createTestFileStructure({
|
|
8
|
+
'package.json': { main: 'index.js' },
|
|
9
|
+
'index.js': 'export default 1;',
|
|
10
|
+
});
|
|
11
|
+
expect(await getEntriesMapFromPackage({ inputPath })).toEqual({
|
|
12
|
+
'./index': './index.js',
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
it('references source paths for an internal package', async () => {
|
|
16
|
+
const inputPath = await createTestFileStructure({
|
|
17
|
+
'package.json': { main: './lib/index.js' },
|
|
18
|
+
'src/index.ts': 'export default 1;',
|
|
19
|
+
});
|
|
20
|
+
expect(await getEntriesMapFromPackage({ inputPath })).toEqual({
|
|
21
|
+
'./lib/index': './src/index.ts',
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
it('references intermediate paths for an external package', async () => {
|
|
25
|
+
const inputPath = await createTestFileStructure({
|
|
26
|
+
'node_modules/foo/package.json': { main: './lib/index.js' },
|
|
27
|
+
'node_modules/foo/src/index.ts': 'export default 1;',
|
|
28
|
+
'node_modules/foo/lib/index.js': 'export default 1;',
|
|
29
|
+
});
|
|
30
|
+
expect(await getEntriesMapFromPackage({ inputPath: path.join(inputPath, 'node_modules/foo') })).toEqual({
|
|
31
|
+
'./lib/index': './lib/index.js',
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
it('respects exports maps and references intermediate when src path does not exist', async () => {
|
|
35
|
+
const inputPath = await createTestFileStructure({
|
|
36
|
+
'package.json': {
|
|
37
|
+
exports: {
|
|
38
|
+
'.': './lib/index.js',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
'lib/index.js': 'export default 1;',
|
|
42
|
+
});
|
|
43
|
+
// Note: the key is the output path to the input; not the key of the exports map.
|
|
44
|
+
expect(await getEntriesMapFromPackage({ inputPath })).toEqual({
|
|
45
|
+
'./lib/index': './lib/index.js',
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
it('ignores entries that are not valid bundle-able entries', async () => {
|
|
49
|
+
const inputPath = await createTestFileStructure({
|
|
50
|
+
'package.json': {
|
|
51
|
+
exports: {
|
|
52
|
+
'./index': './lib/index.js',
|
|
53
|
+
'./index.js.map': './lib/index.js.map',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
expect(await getEntriesMapFromPackage({ inputPath })).toEqual({
|
|
58
|
+
'./lib/index': './lib/index.js',
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
it('respects source entries in the exports map', async () => {
|
|
62
|
+
const inputPath = await createTestFileStructure({
|
|
63
|
+
'package.json': {
|
|
64
|
+
exports: {
|
|
65
|
+
'./index': {
|
|
66
|
+
import: './lib/index.js',
|
|
67
|
+
source: './random/path/to/source/index.ts',
|
|
68
|
+
},
|
|
69
|
+
'./lib/foo': './lib/foo.js',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
'lib/index.js': 'export default 1;',
|
|
73
|
+
'src/foo.ts': 'export default 1;',
|
|
74
|
+
'random/path/to/source/index.ts': 'export default 1;',
|
|
75
|
+
});
|
|
76
|
+
expect(await getEntriesMapFromPackage({ inputPath })).toEqual({
|
|
77
|
+
'./lib/index': './random/path/to/source/index.ts',
|
|
78
|
+
'./lib/foo': './src/foo.ts',
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=getEntriesMapFromPackage.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntriesMapFromPackage.test.js","sourceRoot":"","sources":["../src/getEntriesMapFromPackage.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,8EAA8E,EAAE,KAAK,IAAI,EAAE;QAC5F,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAAC;YAC9C,cAAc,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;YACpC,UAAU,EAAE,mBAAmB;SAChC,CAAC,CAAC;QAEH,MAAM,CAAC,M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AC;YAC5D,aAAa,EAAE,gBAAgB;SAChC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACtE,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAAC;YAC9C,cAAc,EAAE;gBACd,OAAO,EAAE;oBACP,SAAS,EAAE,gBAAgB;oBAC3B,gBAAgB,EAAE,oBAAoB;iBACvC;aACF;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,wBAAwB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAC5D,aAAa,EAAE,gBAAgB;SAChC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;QAC1D,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAAC;YAC9C,cAAc,EAAE;gBACd,OAAO,EAAE;oBACP,SAAS,EAAE;wBACT,MAAM,EAAE,gBAAgB;wBACxB,MAAM,EAAE,kCAAkC;qBAC3C;oBACD,WAAW,EAAE,cAAc;iBAC5B;aACF;YACD,cAAc,EAAE,mBAAmB;YACnC,YAAY,EAAE,mBAAmB;YACjC,gCAAgC,EAAE,mBAAmB;SACtD,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,wBAAwB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAC5D,aAAa,EAAE,kCAAkC;YACjD,WAAW,EAAE,cAAc;SAC5B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PackageDefinitions } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
/**
|
|
3
|
+
* Reads a package definition and derives a flat array of dependencies to externalize for bundling.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getExternalsFromPackage(options: {
|
|
6
|
+
inputPath: string;
|
|
7
|
+
packages?: PackageDefinitions;
|
|
8
|
+
}): Promise<string[]>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PackageDefinitions } from '@ms-cloudpack/package-utilities';
|
|
2
|
+
/**
|
|
3
|
+
* Reads a package definition and derives a flat array of dependencies to externalize for bundling.
|
|
4
|
+
*/
|
|
5
|
+
export async function getExternalsFromPackage(options) {
|
|
6
|
+
const { inputPath, packages = PackageDefinitions.getInstance() } = options;
|
|
7
|
+
const definition = await packages?.get(inputPath);
|
|
8
|
+
if (definition) {
|
|
9
|
+
return Array.from(new Set([
|
|
10
|
+
...Object.keys(definition.dependencies || {}),
|
|
11
|
+
...Object.keys(definition.devDependencies || {}),
|
|
12
|
+
...Object.keys(definition.peerDependencies || {}),
|
|
13
|
+
]));
|
|
14
|
+
}
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=getExternalsFromPackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getExternalsFromPackage.js","sourceRoot":"","sources":["../src/getExternalsFromPackage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,OAG7C;IACC,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAG,kBAAkB,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC;IAC3E,MAAM,UAAU,GAAG,MAAM,QAAQ,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IAElD,IAAI,UAAU,EAAE;QACd,OAAO,KAAK,CAAC,IAAI,CACf,IAAI,GAAG,CAAC;YACN,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,IAAI,EAAE,CAAC;YAC7C,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,IAAI,EAAE,CAAC;YAChD,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,gBAAgB,IAAI,EAAE,CAAC;SAClD,CAAC,CACH,CAAC;KACH;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describe, it, expect } from '@jest/globals';
|
|
2
|
+
import { getExternalsFromPackage } from './getExternalsFromPackage.js';
|
|
3
|
+
import { createTestFileStructure } from '@ms-cloudpack/test-utilities';
|
|
4
|
+
describe('getExternalsFromPackage', () => {
|
|
5
|
+
it('returns an empty array when no package definition is found', async () => {
|
|
6
|
+
const inputPath = await createTestFileStructure({
|
|
7
|
+
'package.json': {},
|
|
8
|
+
});
|
|
9
|
+
expect(await getExternalsFromPackage({ inputPath })).toEqual([]);
|
|
10
|
+
});
|
|
11
|
+
it('returns dependencies from the package', async () => {
|
|
12
|
+
const inputPath = await createTestFileStructure({
|
|
13
|
+
'package.json': {
|
|
14
|
+
dependencies: {
|
|
15
|
+
dep1: '1.0.0',
|
|
16
|
+
dep2: '2.0.0',
|
|
17
|
+
},
|
|
18
|
+
devDependencies: {
|
|
19
|
+
devDep1: '1.0.0',
|
|
20
|
+
devDep2: '2.0.0',
|
|
21
|
+
react: '1.0.0',
|
|
22
|
+
},
|
|
23
|
+
peerDependencies: {
|
|
24
|
+
peer1: '1.0.0',
|
|
25
|
+
peer2: '2.0.0',
|
|
26
|
+
react: '^1.0.0',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
expect(await getExternalsFromPackage({ inputPath })).toEqual([
|
|
31
|
+
'dep1',
|
|
32
|
+
'dep2',
|
|
33
|
+
'devDep1',
|
|
34
|
+
'devDep2',
|
|
35
|
+
'react',
|
|
36
|
+
'peer1',
|
|
37
|
+
'peer2',
|
|
38
|
+
]);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=getExternalsFromPackage.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getExternalsFromPackage.test.js","sourceRoot":"","sources":["../src/getExternalsFromPackage.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE;QAC1E,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAAC;YAC9C,cAAc,EAAE,EAAE;SACnB,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,uBAAuB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;QACrD,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAAC;YAC9C,cAAc,EAAE;gBACd,YAAY,EAAE;oBACZ,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,OAAO;iBACd;gBACD,eAAe,EAAE;oBACf,OAAO,EAAE,OAAO;oBAChB,OAAO,EAAE,OAAO;oBAChB,KAAK,EAAE,OAAO;iBACf;gBACD,gBAAgB,EAAE;oBAChB,KAAK,EAAE,OAAO;oBACd,KAAK,EAAE,OAAO;oBACd,KAAK,EAAE,QAAQ;iBAChB;aACF;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,uBAAuB,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAC3D,MAAM;YACN,MAAM;YACN,SAAS;YACT,SAAS;YACT,OAAO;YACP,OAAO;YACP,OAAO;SACR,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA6B,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAA6B,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/bundler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "An abstraction to bundle source code.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ms-cloudpack/
|
|
17
|
-
"@ms-cloudpack/bundler-plugin-ori": "^0.
|
|
18
|
-
"@ms-cloudpack/bundler-plugin-rollup": "^0.
|
|
19
|
-
"@ms-cloudpack/package-utilities": "^1.
|
|
16
|
+
"@ms-cloudpack/json-utilities": "^0.0.4",
|
|
17
|
+
"@ms-cloudpack/bundler-plugin-ori": "^0.7.0",
|
|
18
|
+
"@ms-cloudpack/bundler-plugin-rollup": "^0.4.0",
|
|
19
|
+
"@ms-cloudpack/package-utilities": "^1.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@ms-cloudpack/scripts": "*",
|
|
@@ -29,7 +29,10 @@
|
|
|
29
29
|
"build:watch": "cloudpack-scripts build-watch",
|
|
30
30
|
"build": "cloudpack-scripts build",
|
|
31
31
|
"lint:update": "cloudpack-scripts lint-update",
|
|
32
|
-
"lint": "cloudpack-scripts lint"
|
|
32
|
+
"lint": "cloudpack-scripts lint",
|
|
33
|
+
"test:update": "cloudpack-scripts test-update",
|
|
34
|
+
"test:watch": "cloudpack-scripts test-watch",
|
|
35
|
+
"test": "cloudpack-scripts test"
|
|
33
36
|
},
|
|
34
37
|
"files": [
|
|
35
38
|
"/lib"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const webpack = {
|
|
2
|
-
name: 'webpack',
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-unused-vars
|
|
4
|
-
bundle: async function bundle(options) {
|
|
5
|
-
const result = {};
|
|
6
|
-
return result;
|
|
7
|
-
},
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=webpack.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.js","sourceRoot":"","sources":["../../src/abstractions/webpack.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAY;IAC9B,IAAI,EAAE,SAAS;IACf,+FAA+F;IAC/F,MAAM,EAAE,KAAK,UAAU,MAAM,CAAC,OAAuB;QACnD,MAAM,MAAM,GAAkB,EAAE,CAAC;QAEjC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
package/lib/getBundlerOptions.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { getPackageEntries } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
import { isValidBundleEntry } from './isValidBundleEntry.js';
|
|
3
|
-
export async function getBundlerOptions(options) {
|
|
4
|
-
const entries = options.entries || (await getPackageEntries(options.packagePath, options)).filter(isValidBundleEntry);
|
|
5
|
-
if (Object.keys(entries).length === 0) {
|
|
6
|
-
throw new Error(`Package definition at "${options.packagePath}" missing entries.`);
|
|
7
|
-
}
|
|
8
|
-
return {
|
|
9
|
-
...options,
|
|
10
|
-
entries,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=getBundlerOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBundlerOptions.js","sourceRoot":"","sources":["../src/getBundlerOptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAA6B;IACnE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,MAAM,iBAAiB,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAEtH,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC,0BAA0B,OAAO,CAAC,WAAW,oBAAoB,CAAC,CAAC;KACpF;IAED,OAAO;QACL,GAAG,OAAO;QACV,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/lib/getCachedResult.d.ts
DELETED
package/lib/getCachedResult.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TODO: placeholder method for getting cached bundle results. Not sure this is the best layer.
|
|
3
|
-
*/
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
5
|
-
export async function getCachedResult() {
|
|
6
|
-
return undefined;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=getCachedResult.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCachedResult.js","sourceRoot":"","sources":["../src/getCachedResult.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,OAAO,SAAS,CAAC;AACnB,CAAC"}
|