@atlaspack/reporter-conditional-manifest 2.14.5-canary.138 → 2.14.5-canary.139
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/lib/ConditionalManifestReporter.d.ts +12 -0
- package/lib/ConditionalManifestReporter.js +3 -0
- package/lib/Config.d.ts +6 -0
- package/package.json +11 -7
- package/src/{ConditionalManifestReporter.js → ConditionalManifestReporter.ts} +11 -10
- package/src/{Config.js → Config.ts} +3 -4
- package/test/{ConditionalManifestReporter.test.js → ConditionalManifestReporter.test.ts} +0 -1
- package/test/{Config.test.js → Config.test.ts} +1 -2
- package/tsconfig.json +4 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Reporter } from '@atlaspack/plugin';
|
|
2
|
+
import type { Async, PluginLogger, PluginOptions, PluginTracer, ReporterEvent, FileSystem, FilePath } from '@atlaspack/types-internal';
|
|
3
|
+
export declare const manifestHashes: Map<FilePath, string>;
|
|
4
|
+
export declare const updateManifest: (outputFS: FileSystem, logger: PluginLogger, conditionalManifestFilename: FilePath, conditionalManifest: string) => Promise<void>;
|
|
5
|
+
export declare function report({ event, options, logger, }: {
|
|
6
|
+
event: ReporterEvent;
|
|
7
|
+
options: PluginOptions;
|
|
8
|
+
logger: PluginLogger;
|
|
9
|
+
tracer: PluginTracer;
|
|
10
|
+
}): Promise<Async<void>>;
|
|
11
|
+
declare const _default: Reporter;
|
|
12
|
+
export default _default;
|
|
@@ -53,6 +53,7 @@ async function report({
|
|
|
53
53
|
const bundles = event.bundleGraph.getConditionalBundleMapping();
|
|
54
54
|
|
|
55
55
|
// Replace bundles with file paths
|
|
56
|
+
// @ts-expect-error TS2304
|
|
56
57
|
const mapBundles = bundles => bundles.map(bundle => (0, _path().relative)(bundle.target.distDir, bundle.filePath));
|
|
57
58
|
const manifest = {};
|
|
58
59
|
for (const conditions of bundles.values()) {
|
|
@@ -82,6 +83,8 @@ async function report({
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
}
|
|
86
|
+
|
|
87
|
+
// @ts-expect-error TS2322
|
|
85
88
|
var _default = exports.default = new (_plugin().Reporter)({
|
|
86
89
|
report
|
|
87
90
|
});
|
package/lib/Config.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/reporter-conditional-manifest",
|
|
3
|
-
"version": "2.14.5-canary.
|
|
3
|
+
"version": "2.14.5-canary.139+d2fd84977",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,16 +9,20 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
11
11
|
},
|
|
12
|
-
"main": "lib/ConditionalManifestReporter.js",
|
|
13
|
-
"source": "src/ConditionalManifestReporter.
|
|
12
|
+
"main": "./lib/ConditionalManifestReporter.js",
|
|
13
|
+
"source": "./src/ConditionalManifestReporter.ts",
|
|
14
|
+
"types": "./lib/ConditionalManifestReporter.d.ts",
|
|
14
15
|
"engines": {
|
|
15
16
|
"node": ">= 16.0.0"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@atlaspack/feature-flags": "2.14.1-canary.
|
|
19
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
19
|
+
"@atlaspack/feature-flags": "2.14.1-canary.207+d2fd84977",
|
|
20
|
+
"@atlaspack/plugin": "2.14.5-canary.139+d2fd84977",
|
|
20
21
|
"nullthrows": "^1.1.1"
|
|
21
22
|
},
|
|
22
23
|
"type": "commonjs",
|
|
23
|
-
"
|
|
24
|
-
|
|
24
|
+
"scripts": {
|
|
25
|
+
"check-ts": "tsc --emitDeclarationOnly --rootDir src"
|
|
26
|
+
},
|
|
27
|
+
"gitHead": "d2fd849770fe6305e9c694bd97b1bd905abd9d94"
|
|
28
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
1
|
import {relative, join, dirname} from 'path';
|
|
3
2
|
import crypto from 'crypto';
|
|
4
3
|
import {Reporter} from '@atlaspack/plugin';
|
|
@@ -44,20 +43,21 @@ export async function report({
|
|
|
44
43
|
event,
|
|
45
44
|
options,
|
|
46
45
|
logger,
|
|
47
|
-
}: {
|
|
48
|
-
event: ReporterEvent
|
|
49
|
-
options: PluginOptions
|
|
50
|
-
logger: PluginLogger
|
|
51
|
-
tracer: PluginTracer
|
|
52
|
-
|
|
46
|
+
}: {
|
|
47
|
+
event: ReporterEvent;
|
|
48
|
+
options: PluginOptions;
|
|
49
|
+
logger: PluginLogger;
|
|
50
|
+
tracer: PluginTracer;
|
|
51
|
+
}): Promise<Async<void>> {
|
|
53
52
|
if (event.type === 'buildSuccess') {
|
|
54
53
|
const bundles = event.bundleGraph.getConditionalBundleMapping();
|
|
55
54
|
|
|
56
55
|
// Replace bundles with file paths
|
|
57
|
-
|
|
56
|
+
// @ts-expect-error TS2304
|
|
57
|
+
const mapBundles = (bundles: Array<PackagedBundle>) =>
|
|
58
58
|
bundles.map((bundle) => relative(bundle.target.distDir, bundle.filePath));
|
|
59
59
|
|
|
60
|
-
const manifest = {};
|
|
60
|
+
const manifest: Record<string, any> = {};
|
|
61
61
|
for (const conditions of bundles.values()) {
|
|
62
62
|
for (const [key, cond] of conditions) {
|
|
63
63
|
const bundle = cond.bundle;
|
|
@@ -108,4 +108,5 @@ export async function report({
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
// @ts-expect-error TS2322
|
|
112
|
+
export default new Reporter({report}) as Reporter;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
1
|
import type {PluginOptions, EnvMap} from '@atlaspack/types-internal';
|
|
3
2
|
|
|
4
3
|
import {NodePackageManager} from '@atlaspack/package-manager';
|
|
@@ -7,7 +6,7 @@ import {overlayFS, fsFixture} from '@atlaspack/test-utils';
|
|
|
7
6
|
import assert from 'assert';
|
|
8
7
|
import {DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
|
|
9
8
|
|
|
10
|
-
function getPluginOptions({env}: {env?: EnvMap
|
|
9
|
+
function getPluginOptions({env}: {env?: EnvMap}): PluginOptions {
|
|
11
10
|
return {
|
|
12
11
|
mode: 'development',
|
|
13
12
|
parcelVersion: 'version',
|
package/tsconfig.json
ADDED