@atlaspack/core 2.12.1-dev.3450 → 2.12.1-dev.3466

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.
Files changed (112) hide show
  1. package/lib/AssetGraph.js +5 -1
  2. package/lib/Atlaspack.js +2 -2
  3. package/lib/CommittedAsset.js +11 -5
  4. package/lib/Dependency.js +1 -1
  5. package/lib/PackagerRunner.js +53 -5
  6. package/lib/RequestTracker.js +10 -4
  7. package/lib/SymbolPropagation.js +25 -36
  8. package/lib/UncommittedAsset.js +8 -2
  9. package/lib/assetUtils.js +9 -3
  10. package/lib/atlaspack-v3/fs.js +31 -29
  11. package/lib/atlaspack-v3/index.js +2 -2
  12. package/lib/atlaspack-v3/jsCallable.js +9 -4
  13. package/lib/atlaspack-v3/worker/compat/asset-symbols.js +192 -0
  14. package/lib/atlaspack-v3/worker/compat/bitflags.js +84 -0
  15. package/lib/atlaspack-v3/worker/compat/dependency.js +44 -0
  16. package/lib/atlaspack-v3/worker/compat/environment.js +68 -0
  17. package/lib/atlaspack-v3/worker/compat/index.js +104 -0
  18. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +144 -0
  19. package/lib/atlaspack-v3/worker/compat/plugin-config.js +58 -0
  20. package/lib/atlaspack-v3/worker/compat/plugin-logger.js +29 -0
  21. package/lib/atlaspack-v3/worker/compat/plugin-options.js +113 -0
  22. package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +12 -0
  23. package/lib/atlaspack-v3/worker/compat/target.js +17 -0
  24. package/lib/atlaspack-v3/worker/worker.js +115 -127
  25. package/lib/index.js +0 -43
  26. package/lib/projectPath.js +12 -4
  27. package/lib/registerCoreWithSerializer.js +11 -5
  28. package/lib/requests/AtlaspackConfigRequest.js +8 -2
  29. package/lib/requests/ConfigRequest.js +9 -4
  30. package/lib/requests/DevDepRequest.js +9 -3
  31. package/lib/requests/PathRequest.js +8 -2
  32. package/lib/requests/WriteBundleRequest.js +15 -15
  33. package/lib/worker.js +8 -2
  34. package/package.json +24 -16
  35. package/src/AssetGraph.js +15 -13
  36. package/src/Atlaspack.js +5 -6
  37. package/src/AtlaspackConfig.js +11 -9
  38. package/src/AtlaspackConfig.schema.js +1 -1
  39. package/src/BundleGraph.js +83 -79
  40. package/src/CommittedAsset.js +5 -3
  41. package/src/Dependency.js +1 -1
  42. package/src/PackagerRunner.js +57 -9
  43. package/src/ReporterRunner.js +4 -4
  44. package/src/RequestTracker.js +19 -19
  45. package/src/SymbolPropagation.js +40 -52
  46. package/src/Transformation.js +12 -12
  47. package/src/UncommittedAsset.js +3 -3
  48. package/src/Validation.js +5 -5
  49. package/src/applyRuntimes.js +2 -2
  50. package/src/assetUtils.js +2 -2
  51. package/src/atlaspack-v3/AtlaspackV3.js +1 -1
  52. package/src/atlaspack-v3/fs.js +39 -25
  53. package/src/atlaspack-v3/index.js +1 -1
  54. package/src/atlaspack-v3/jsCallable.js +11 -10
  55. package/src/atlaspack-v3/worker/compat/asset-symbols.js +225 -0
  56. package/src/atlaspack-v3/worker/compat/bitflags.js +100 -0
  57. package/src/atlaspack-v3/worker/compat/dependency.js +83 -0
  58. package/src/atlaspack-v3/worker/compat/environment.js +92 -0
  59. package/src/atlaspack-v3/worker/compat/index.js +10 -0
  60. package/src/atlaspack-v3/worker/compat/mutable-asset.js +184 -0
  61. package/src/atlaspack-v3/worker/compat/plugin-config.js +94 -0
  62. package/src/atlaspack-v3/worker/compat/plugin-logger.js +47 -0
  63. package/src/atlaspack-v3/worker/compat/plugin-options.js +137 -0
  64. package/src/atlaspack-v3/worker/compat/plugin-tracer.js +11 -0
  65. package/src/atlaspack-v3/worker/compat/target.js +27 -0
  66. package/src/atlaspack-v3/worker/worker.js +148 -134
  67. package/src/dumpGraphToGraphViz.js +1 -1
  68. package/src/index.js +0 -10
  69. package/src/loadDotEnv.js +1 -1
  70. package/src/projectPath.js +12 -4
  71. package/src/public/Asset.js +1 -1
  72. package/src/public/Bundle.js +3 -3
  73. package/src/public/BundleGraph.js +20 -20
  74. package/src/public/Config.js +1 -1
  75. package/src/public/MutableBundleGraph.js +8 -8
  76. package/src/registerCoreWithSerializer.js +7 -4
  77. package/src/requests/AssetGraphRequest.js +10 -10
  78. package/src/requests/AssetGraphRequestRust.js +3 -3
  79. package/src/requests/AssetRequest.js +3 -3
  80. package/src/requests/AtlaspackConfigRequest.js +6 -4
  81. package/src/requests/BundleGraphRequest.js +6 -6
  82. package/src/requests/ConfigRequest.js +5 -6
  83. package/src/requests/DevDepRequest.js +8 -8
  84. package/src/requests/EntryRequest.js +2 -2
  85. package/src/requests/PathRequest.js +1 -1
  86. package/src/requests/TargetRequest.js +9 -8
  87. package/src/requests/ValidationRequest.js +2 -2
  88. package/src/requests/WriteBundleRequest.js +26 -20
  89. package/src/requests/WriteBundlesRequest.js +6 -6
  90. package/src/requests/asset-graph-diff.js +4 -4
  91. package/src/resolveOptions.js +3 -3
  92. package/src/serializerCore.browser.js +3 -2
  93. package/src/utils.js +2 -2
  94. package/src/worker.js +1 -1
  95. package/test/AtlaspackConfigRequest.test.js +1 -1
  96. package/test/BundleGraph.test.js +3 -3
  97. package/test/Dependency.test.js +28 -0
  98. package/test/PublicMutableBundleGraph.test.js +2 -2
  99. package/test/RequestTracker.test.js +7 -6
  100. package/test/SymbolPropagation.test.js +9 -9
  101. package/test/requests/ConfigRequest.test.js +3 -6
  102. package/test/utils.test.js +1 -1
  103. package/lib/atlaspack-v3/worker/compat.js +0 -57
  104. package/lib/buildCache.js +0 -18
  105. package/lib/serializer.js +0 -216
  106. package/lib/serializerCore.js +0 -16
  107. package/src/atlaspack-v3/worker/compat.js +0 -82
  108. package/src/buildCache.js +0 -15
  109. package/src/serializer.js +0 -255
  110. package/src/serializerCore.js +0 -5
  111. package/test/requests/WriteBundleRequest.test.js +0 -132
  112. package/test/serializer.test.js +0 -302
@@ -0,0 +1,94 @@
1
+ // @flow
2
+
3
+ import type {
4
+ Config as IPluginConfig,
5
+ DevDepOptions,
6
+ FilePath,
7
+ Environment,
8
+ FileCreateInvalidation,
9
+ ConfigResultWithFilePath,
10
+ PackageJSON,
11
+ } from '@atlaspack/types';
12
+
13
+ export type PluginConfigOptions = {|
14
+ isSource: boolean,
15
+ searchPath: FilePath,
16
+ env: Environment,
17
+ |};
18
+
19
+ export class PluginConfig implements IPluginConfig {
20
+ isSource: boolean;
21
+ searchPath: FilePath;
22
+ env: Environment;
23
+
24
+ constructor({env, isSource, searchPath}: PluginConfigOptions) {
25
+ this.env = env;
26
+ this.isSource = isSource;
27
+ this.searchPath = searchPath;
28
+ }
29
+
30
+ // eslint-disable-next-line no-unused-vars
31
+ invalidateOnFileChange(filePath: FilePath): void {
32
+ throw new Error('PluginOptions.invalidateOnFileChange');
33
+ }
34
+
35
+ // eslint-disable-next-line no-unused-vars
36
+ invalidateOnFileCreate(invalidations: FileCreateInvalidation): void {
37
+ throw new Error('PluginOptions.invalidateOnFileCreate');
38
+ }
39
+
40
+ // eslint-disable-next-line no-unused-vars
41
+ invalidateOnEnvChange(invalidation: string): void {
42
+ throw new Error('PluginOptions.invalidateOnEnvChange');
43
+ }
44
+
45
+ invalidateOnStartup(): void {
46
+ throw new Error('PluginOptions.invalidateOnStartup');
47
+ }
48
+
49
+ invalidateOnBuild(): void {
50
+ throw new Error('PluginOptions.invalidateOnBuild');
51
+ }
52
+
53
+ // eslint-disable-next-line no-unused-vars
54
+ addDevDependency(options: DevDepOptions): void {
55
+ throw new Error('PluginOptions.addDevDependency');
56
+ }
57
+
58
+ // eslint-disable-next-line no-unused-vars
59
+ setCacheKey(key: string): void {
60
+ throw new Error('PluginOptions.setCacheKey');
61
+ }
62
+
63
+ getConfig<T>(
64
+ // eslint-disable-next-line no-unused-vars
65
+ filePaths: Array<FilePath>,
66
+ // eslint-disable-next-line no-unused-vars
67
+ options?: {|
68
+ packageKey?: string,
69
+ parse?: boolean,
70
+ exclude?: boolean,
71
+ |},
72
+ ): Promise<?ConfigResultWithFilePath<T>> {
73
+ throw new Error('PluginOptions.getConfig');
74
+ }
75
+
76
+ getConfigFrom<T>(
77
+ // eslint-disable-next-line no-unused-vars
78
+ searchPath: FilePath,
79
+ // eslint-disable-next-line no-unused-vars
80
+ filePaths: Array<FilePath>,
81
+ // eslint-disable-next-line no-unused-vars
82
+ options?: {|
83
+ packageKey?: string,
84
+ parse?: boolean,
85
+ exclude?: boolean,
86
+ |},
87
+ ): Promise<?ConfigResultWithFilePath<T>> {
88
+ throw new Error('PluginOptions.getConfigFrom');
89
+ }
90
+
91
+ getPackage(): Promise<?PackageJSON> {
92
+ throw new Error('PluginOptions.getPackage');
93
+ }
94
+ }
@@ -0,0 +1,47 @@
1
+ // @flow
2
+
3
+ import type {PluginLogger as IPlguinLogger} from '@atlaspack/types';
4
+ import type {
5
+ Diagnostifiable,
6
+ DiagnosticWithoutOrigin,
7
+ } from '@atlaspack/diagnostic';
8
+
9
+ export class PluginLogger implements IPlguinLogger {
10
+ verbose(
11
+ diagnostic: DiagnosticWithoutOrigin | Array<DiagnosticWithoutOrigin>,
12
+ ): void {
13
+ // eslint-disable-next-line no-console
14
+ console.log(diagnostic);
15
+ }
16
+
17
+ info(
18
+ diagnostic: DiagnosticWithoutOrigin | Array<DiagnosticWithoutOrigin>,
19
+ ): void {
20
+ // eslint-disable-next-line no-console
21
+ console.info(diagnostic);
22
+ }
23
+
24
+ log(
25
+ diagnostic: DiagnosticWithoutOrigin | Array<DiagnosticWithoutOrigin>,
26
+ ): void {
27
+ // eslint-disable-next-line no-console
28
+ console.log(diagnostic);
29
+ }
30
+
31
+ warn(
32
+ diagnostic: DiagnosticWithoutOrigin | Array<DiagnosticWithoutOrigin>,
33
+ ): void {
34
+ // eslint-disable-next-line no-console
35
+ console.warn(diagnostic);
36
+ }
37
+
38
+ error(
39
+ input:
40
+ | Diagnostifiable
41
+ | DiagnosticWithoutOrigin
42
+ | Array<DiagnosticWithoutOrigin>,
43
+ ): void {
44
+ // eslint-disable-next-line no-console
45
+ console.error(input);
46
+ }
47
+ }
@@ -0,0 +1,137 @@
1
+ // @flow
2
+
3
+ import type {
4
+ PluginOptions as IPluginOptions,
5
+ LogLevel,
6
+ FileSystem,
7
+ PackageManager,
8
+ EnvMap,
9
+ FilePath,
10
+ HMROptions,
11
+ ServerOptions,
12
+ DetailedReportOptions,
13
+ BuildMode,
14
+ } from '@atlaspack/types';
15
+ import type {FeatureFlags} from '@atlaspack/feature-flags';
16
+
17
+ export class PluginOptions implements IPluginOptions {
18
+ #options: IPluginOptions;
19
+
20
+ get env(): EnvMap {
21
+ if (!('env' in this.#options)) {
22
+ return process.env;
23
+ // throw new Error('PluginOptions.env');
24
+ }
25
+ return this.#options.env;
26
+ }
27
+
28
+ get projectRoot(): FilePath {
29
+ if (!('projectRoot' in this.#options)) {
30
+ throw new Error('PluginOptions.projectRoot');
31
+ }
32
+ return this.#options.projectRoot;
33
+ }
34
+
35
+ get packageManager(): PackageManager {
36
+ if (!('packageManager' in this.#options)) {
37
+ throw new Error('PluginOptions.packageManager');
38
+ }
39
+ return this.#options.packageManager;
40
+ }
41
+
42
+ get mode(): BuildMode {
43
+ if (!('mode' in this.#options)) {
44
+ throw new Error('PluginOptions.mode');
45
+ }
46
+ return this.#options.mode;
47
+ }
48
+
49
+ get parcelVersion(): string {
50
+ if (!('parcelVersion' in this.#options)) {
51
+ return 'UNKNOWN VERSION';
52
+ // throw new Error('PluginOptions.parcelVersion');
53
+ }
54
+ return this.#options.parcelVersion;
55
+ }
56
+
57
+ get hmrOptions(): ?HMROptions {
58
+ if (!('hmrOptions' in this.#options)) {
59
+ throw new Error('PluginOptions.hmrOptions');
60
+ }
61
+ return this.#options.hmrOptions;
62
+ }
63
+
64
+ get serveOptions(): ServerOptions | false {
65
+ if (!('serveOptions' in this.#options)) {
66
+ throw new Error('PluginOptions.serveOptions');
67
+ }
68
+ return this.#options.serveOptions;
69
+ }
70
+
71
+ get shouldBuildLazily(): boolean {
72
+ if (!('shouldBuildLazily' in this.#options)) {
73
+ throw new Error('PluginOptions.shouldBuildLazily');
74
+ }
75
+ return this.#options.shouldBuildLazily;
76
+ }
77
+
78
+ get shouldAutoInstall(): boolean {
79
+ if (!('shouldAutoInstall' in this.#options)) {
80
+ throw new Error('PluginOptions.shouldAutoInstall');
81
+ }
82
+ return this.#options.shouldAutoInstall;
83
+ }
84
+
85
+ get logLevel(): LogLevel {
86
+ if (!('logLevel' in this.#options)) {
87
+ throw new Error('PluginOptions.logLevel');
88
+ }
89
+ return this.#options.logLevel;
90
+ }
91
+
92
+ get cacheDir(): string {
93
+ if (!('cacheDir' in this.#options)) {
94
+ throw new Error('PluginOptions.cacheDir');
95
+ }
96
+ return this.#options.cacheDir;
97
+ }
98
+
99
+ get inputFS(): FileSystem {
100
+ if (!('inputFS' in this.#options)) {
101
+ throw new Error('PluginOptions.inputFS');
102
+ }
103
+ return this.#options.inputFS;
104
+ }
105
+
106
+ get outputFS(): FileSystem {
107
+ if (!('outputFS' in this.#options)) {
108
+ throw new Error('PluginOptions.outputFS');
109
+ }
110
+ return this.#options.outputFS;
111
+ }
112
+
113
+ get instanceId(): string {
114
+ if (!('instanceId' in this.#options)) {
115
+ throw new Error('PluginOptions.instanceId');
116
+ }
117
+ return this.#options.instanceId;
118
+ }
119
+
120
+ get detailedReport(): ?DetailedReportOptions {
121
+ if (!('detailedReport' in this.#options)) {
122
+ throw new Error('PluginOptions.detailedReport');
123
+ }
124
+ return this.#options.detailedReport;
125
+ }
126
+
127
+ get featureFlags(): FeatureFlags {
128
+ if (!('featureFlags' in this.#options)) {
129
+ throw new Error('PluginOptions.featureFlags');
130
+ }
131
+ return this.#options.featureFlags;
132
+ }
133
+
134
+ constructor(options: $Partial<IPluginOptions>) {
135
+ this.#options = options;
136
+ }
137
+ }
@@ -0,0 +1,11 @@
1
+ // @flow
2
+
3
+ import type {PluginTracer as IPluginTracer} from '@atlaspack/types';
4
+
5
+ export class PluginTracer implements IPluginTracer {
6
+ enabled: false;
7
+
8
+ createMeasurement() {
9
+ throw new Error('PluginTracer.createMeasurement');
10
+ }
11
+ }
@@ -0,0 +1,27 @@
1
+ // @flow
2
+
3
+ import type {Target as NapiTarget} from '@atlaspack/rust';
4
+ import type {
5
+ Target as ClassicTarget,
6
+ FilePath,
7
+ Environment,
8
+ SourceLocation,
9
+ } from '@atlaspack/types';
10
+
11
+ export class Target implements ClassicTarget {
12
+ distEntry: ?FilePath;
13
+ distDir: FilePath;
14
+ env: Environment;
15
+ name: string;
16
+ publicUrl: string;
17
+ loc: ?SourceLocation;
18
+
19
+ constructor(inner: NapiTarget, env: Environment) {
20
+ this.distDir = inner.distDir;
21
+ this.distEntry = inner.distEntry;
22
+ this.name = inner.name;
23
+ this.publicUrl = inner.publicUrl;
24
+ this.loc = inner.loc;
25
+ this.env = env;
26
+ }
27
+ }