@atlaspack/packager-js 2.23.3 → 2.23.5-dev-af891f2f6.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.md +12 -0
- package/LICENSE +201 -0
- package/dist/DevPackager.js +1 -2
- package/dist/ScopeHoistingPackager.js +6 -7
- package/dist/index.js +9 -5
- package/lib/DevPackager.js +1 -2
- package/lib/ScopeHoistingPackager.js +5 -8
- package/lib/index.js +10 -5
- package/lib/types/DevPackager.d.ts +1 -1
- package/lib/types/ScopeHoistingPackager.d.ts +3 -2
- package/lib/types/utils.d.ts +1 -1
- package/package.json +10 -9
- package/src/DevPackager.ts +1 -2
- package/src/ScopeHoistingPackager.ts +10 -6
- package/src/index.ts +16 -5
- package/src/utils.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {Async} from '@atlaspack/types';
|
|
2
|
-
import type SourceMap from '@
|
|
2
|
+
import type SourceMap from '@atlaspack/source-map';
|
|
3
3
|
import {Packager} from '@atlaspack/plugin';
|
|
4
4
|
import {
|
|
5
5
|
replaceInlineReferences,
|
|
@@ -16,6 +16,7 @@ import {ScopeHoistingPackager} from './ScopeHoistingPackager';
|
|
|
16
16
|
type JSPackagerConfig = {
|
|
17
17
|
parcelRequireName: string;
|
|
18
18
|
unstable_asyncBundleRuntime: boolean;
|
|
19
|
+
unstable_manualStaticBindingExports: string[] | null;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
const CONFIG_SCHEMA: SchemaEntity = {
|
|
@@ -24,6 +25,12 @@ const CONFIG_SCHEMA: SchemaEntity = {
|
|
|
24
25
|
unstable_asyncBundleRuntime: {
|
|
25
26
|
type: 'boolean',
|
|
26
27
|
},
|
|
28
|
+
unstable_manualStaticBindingExports: {
|
|
29
|
+
type: 'array',
|
|
30
|
+
items: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
27
34
|
},
|
|
28
35
|
additionalProperties: false,
|
|
29
36
|
};
|
|
@@ -31,7 +38,10 @@ const CONFIG_SCHEMA: SchemaEntity = {
|
|
|
31
38
|
export default new Packager({
|
|
32
39
|
async loadConfig({config, options}): Promise<JSPackagerConfig> {
|
|
33
40
|
let packageKey = '@atlaspack/packager-js';
|
|
34
|
-
let conf = await config.getConfigFrom
|
|
41
|
+
let conf = await config.getConfigFrom<{
|
|
42
|
+
unstable_asyncBundleRuntime?: boolean;
|
|
43
|
+
unstable_manualStaticBindingExports?: string[];
|
|
44
|
+
}>(options.projectRoot + '/index', [], {
|
|
35
45
|
packageKey,
|
|
36
46
|
});
|
|
37
47
|
|
|
@@ -51,7 +61,7 @@ export default new Packager({
|
|
|
51
61
|
|
|
52
62
|
// Generate a name for the global parcelRequire function that is unique to this project.
|
|
53
63
|
// This allows multiple parcel builds to coexist on the same page.
|
|
54
|
-
let packageName = await config.getConfigFrom(
|
|
64
|
+
let packageName = await config.getConfigFrom<string>(
|
|
55
65
|
options.projectRoot + '/index',
|
|
56
66
|
[],
|
|
57
67
|
{
|
|
@@ -61,12 +71,12 @@ export default new Packager({
|
|
|
61
71
|
|
|
62
72
|
let name = packageName?.contents ?? '';
|
|
63
73
|
return {
|
|
64
|
-
// @ts-expect-error TS2345
|
|
65
74
|
parcelRequireName: 'parcelRequire' + hashString(name).slice(-4),
|
|
66
75
|
unstable_asyncBundleRuntime: Boolean(
|
|
67
|
-
// @ts-expect-error TS2339
|
|
68
76
|
conf?.contents?.unstable_asyncBundleRuntime,
|
|
69
77
|
),
|
|
78
|
+
unstable_manualStaticBindingExports:
|
|
79
|
+
conf?.contents?.unstable_manualStaticBindingExports ?? null,
|
|
70
80
|
};
|
|
71
81
|
},
|
|
72
82
|
async package({
|
|
@@ -100,6 +110,7 @@ export default new Packager({
|
|
|
100
110
|
bundle,
|
|
101
111
|
nullthrows(config).parcelRequireName,
|
|
102
112
|
nullthrows(config).unstable_asyncBundleRuntime,
|
|
113
|
+
nullthrows(config).unstable_manualStaticBindingExports,
|
|
103
114
|
logger,
|
|
104
115
|
)
|
|
105
116
|
: new DevPackager(
|
package/src/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {BundleGraph, Dependency, NamedBundle} from '@atlaspack/types';
|
|
2
|
-
import type SourceMap from '@
|
|
2
|
+
import type SourceMap from '@atlaspack/source-map';
|
|
3
3
|
import nullthrows from 'nullthrows';
|
|
4
4
|
|
|
5
5
|
// This replaces __parcel__require__ references left by the transformer with
|