@atlaspack/reporter-conditional-manifest 2.14.18-noselfbuild-4bb690920.0 → 2.14.18-noselfbuild-8163359c1.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.
|
@@ -28,13 +28,6 @@ function _plugin() {
|
|
|
28
28
|
return data;
|
|
29
29
|
}
|
|
30
30
|
var _Config = require("./Config");
|
|
31
|
-
function _featureFlags() {
|
|
32
|
-
const data = require("@atlaspack/feature-flags");
|
|
33
|
-
_featureFlags = function () {
|
|
34
|
-
return data;
|
|
35
|
-
};
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
32
|
const manifestHashes = exports.manifestHashes = new Map();
|
|
40
33
|
const updateManifest = async (outputFS, logger, conditionalManifestFilename, conditionalManifest) => {
|
|
@@ -63,29 +56,17 @@ async function report({
|
|
|
63
56
|
const mapBundles = bundles => bundles.map(bundle => (0, _path().relative)(bundle.target.distDir, bundle.filePath));
|
|
64
57
|
const manifest = {};
|
|
65
58
|
for (const conditions of bundles.values()) {
|
|
66
|
-
const oldBundleInfo = {};
|
|
67
59
|
for (const [key, cond] of conditions) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
bundleInfo[key]
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
manifest[bundle.target.name][relativeBundlePath] = bundleInfo;
|
|
79
|
-
} else {
|
|
80
|
-
const bundle = cond.bundle;
|
|
81
|
-
oldBundleInfo[key] = {
|
|
82
|
-
// Reverse bundles so we load children bundles first
|
|
83
|
-
ifTrueBundles: mapBundles(cond.ifTrueBundles).reverse(),
|
|
84
|
-
ifFalseBundles: mapBundles(cond.ifFalseBundles).reverse()
|
|
85
|
-
};
|
|
86
|
-
manifest[bundle.target.name] ??= {};
|
|
87
|
-
manifest[bundle.target.name][(0, _path().relative)(bundle.target.distDir, bundle.filePath)] = oldBundleInfo;
|
|
88
|
-
}
|
|
60
|
+
var _manifest$bundle$targ, _bundleInfo$key, _bundleInfo$key2;
|
|
61
|
+
const bundle = cond.bundle;
|
|
62
|
+
const relativeBundlePath = (0, _path().relative)(bundle.target.distDir, bundle.filePath);
|
|
63
|
+
const bundleInfo = ((_manifest$bundle$targ = manifest[bundle.target.name]) === null || _manifest$bundle$targ === void 0 ? void 0 : _manifest$bundle$targ[relativeBundlePath]) ?? {};
|
|
64
|
+
bundleInfo[key] = {
|
|
65
|
+
ifTrueBundles: mapBundles(cond.ifTrueBundles).concat(((_bundleInfo$key = bundleInfo[key]) === null || _bundleInfo$key === void 0 ? void 0 : _bundleInfo$key.ifTrueBundles) ?? []).sort(),
|
|
66
|
+
ifFalseBundles: mapBundles(cond.ifFalseBundles).concat(((_bundleInfo$key2 = bundleInfo[key]) === null || _bundleInfo$key2 === void 0 ? void 0 : _bundleInfo$key2.ifFalseBundles) ?? []).sort()
|
|
67
|
+
};
|
|
68
|
+
manifest[bundle.target.name] ??= {};
|
|
69
|
+
manifest[bundle.target.name][relativeBundlePath] = bundleInfo;
|
|
89
70
|
}
|
|
90
71
|
}
|
|
91
72
|
const targets = new Set(event.bundleGraph.getBundles().map(bundle => bundle.target));
|
|
@@ -97,17 +78,7 @@ async function report({
|
|
|
97
78
|
const conditionalManifest = JSON.stringify(
|
|
98
79
|
// If there's no content, send an empty manifest so we can still map from it safely
|
|
99
80
|
manifest[target.name] ?? {}, null, 2);
|
|
100
|
-
|
|
101
|
-
await updateManifest(options.outputFS, logger, conditionalManifestFilename, conditionalManifest);
|
|
102
|
-
} else {
|
|
103
|
-
await options.outputFS.mkdirp((0, _path().dirname)(conditionalManifestFilename));
|
|
104
|
-
await options.outputFS.writeFile(conditionalManifestFilename, conditionalManifest, {
|
|
105
|
-
mode: 0o666
|
|
106
|
-
});
|
|
107
|
-
logger.info({
|
|
108
|
-
message: 'Wrote conditional manifest to ' + conditionalManifestFilename
|
|
109
|
-
});
|
|
110
|
-
}
|
|
81
|
+
await updateManifest(options.outputFS, logger, conditionalManifestFilename, conditionalManifest);
|
|
111
82
|
}
|
|
112
83
|
}
|
|
113
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/reporter-conditional-manifest",
|
|
3
|
-
"version": "2.14.18-noselfbuild-
|
|
3
|
+
"version": "2.14.18-noselfbuild-8163359c1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"node": ">= 16.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@atlaspack/feature-flags": "2.18.5-noselfbuild-
|
|
19
|
-
"@atlaspack/plugin": "2.14.18-noselfbuild-
|
|
18
|
+
"@atlaspack/feature-flags": "2.18.5-noselfbuild-8163359c1.0",
|
|
19
|
+
"@atlaspack/plugin": "2.14.18-noselfbuild-8163359c1.0",
|
|
20
20
|
"nullthrows": "^1.1.1"
|
|
21
21
|
},
|
|
22
22
|
"type": "commonjs",
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "8163359c1a8d316bfd4ca81f9f13f94bc5963fe9"
|
|
24
24
|
}
|
|
@@ -12,7 +12,6 @@ import type {
|
|
|
12
12
|
FilePath,
|
|
13
13
|
} from '@atlaspack/types-internal';
|
|
14
14
|
import {getConfig} from './Config';
|
|
15
|
-
import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
16
15
|
|
|
17
16
|
export const manifestHashes: Map<FilePath, string> = new Map();
|
|
18
17
|
|
|
@@ -60,41 +59,27 @@ export async function report({
|
|
|
60
59
|
|
|
61
60
|
const manifest = {};
|
|
62
61
|
for (const conditions of bundles.values()) {
|
|
63
|
-
const oldBundleInfo = {};
|
|
64
62
|
for (const [key, cond] of conditions) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
ifTrueBundles
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
ifFalseBundles
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
manifest[bundle.target.name][relativeBundlePath] = bundleInfo;
|
|
86
|
-
} else {
|
|
87
|
-
const bundle = cond.bundle;
|
|
88
|
-
oldBundleInfo[key] = {
|
|
89
|
-
// Reverse bundles so we load children bundles first
|
|
90
|
-
ifTrueBundles: mapBundles(cond.ifTrueBundles).reverse(),
|
|
91
|
-
ifFalseBundles: mapBundles(cond.ifFalseBundles).reverse(),
|
|
92
|
-
};
|
|
93
|
-
manifest[bundle.target.name] ??= {};
|
|
94
|
-
manifest[bundle.target.name][
|
|
95
|
-
relative(bundle.target.distDir, bundle.filePath)
|
|
96
|
-
] = oldBundleInfo;
|
|
97
|
-
}
|
|
63
|
+
const bundle = cond.bundle;
|
|
64
|
+
const relativeBundlePath = relative(
|
|
65
|
+
bundle.target.distDir,
|
|
66
|
+
bundle.filePath,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const bundleInfo =
|
|
70
|
+
manifest[bundle.target.name]?.[relativeBundlePath] ?? {};
|
|
71
|
+
|
|
72
|
+
bundleInfo[key] = {
|
|
73
|
+
ifTrueBundles: mapBundles(cond.ifTrueBundles)
|
|
74
|
+
.concat(bundleInfo[key]?.ifTrueBundles ?? [])
|
|
75
|
+
.sort(),
|
|
76
|
+
ifFalseBundles: mapBundles(cond.ifFalseBundles)
|
|
77
|
+
.concat(bundleInfo[key]?.ifFalseBundles ?? [])
|
|
78
|
+
.sort(),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
manifest[bundle.target.name] ??= {};
|
|
82
|
+
manifest[bundle.target.name][relativeBundlePath] = bundleInfo;
|
|
98
83
|
}
|
|
99
84
|
}
|
|
100
85
|
|
|
@@ -113,26 +98,12 @@ export async function report({
|
|
|
113
98
|
2,
|
|
114
99
|
);
|
|
115
100
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
);
|
|
123
|
-
} else {
|
|
124
|
-
await options.outputFS.mkdirp(dirname(conditionalManifestFilename));
|
|
125
|
-
await options.outputFS.writeFile(
|
|
126
|
-
conditionalManifestFilename,
|
|
127
|
-
conditionalManifest,
|
|
128
|
-
{mode: 0o666},
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
logger.info({
|
|
132
|
-
message:
|
|
133
|
-
'Wrote conditional manifest to ' + conditionalManifestFilename,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
101
|
+
await updateManifest(
|
|
102
|
+
options.outputFS,
|
|
103
|
+
logger,
|
|
104
|
+
conditionalManifestFilename,
|
|
105
|
+
conditionalManifest,
|
|
106
|
+
);
|
|
136
107
|
}
|
|
137
108
|
}
|
|
138
109
|
}
|