@ms-cloudpack/api-server 0.36.0 → 0.37.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/lib/apis/ensurePackageBundled.d.ts.map +1 -1
- package/lib/apis/ensurePackageBundled.js +9 -11
- package/lib/apis/ensurePackageBundled.js.map +1 -1
- package/lib/apis/openCodeEditor.d.ts.map +1 -1
- package/lib/apis/openCodeEditor.js +3 -2
- package/lib/apis/openCodeEditor.js.map +1 -1
- package/lib/data/busSources.d.ts +80 -80
- package/lib/types/BundleInfo.d.ts +25 -11
- package/lib/types/BundleInfo.d.ts.map +1 -1
- package/lib/types/BundleInfo.js.map +1 -1
- package/lib/types/TaskDescription.d.ts +64 -64
- package/lib/types/TaskEndDescription.d.ts +64 -64
- package/lib/types/TaskMessage.d.ts +34 -34
- package/lib/types/TaskMessageLocation.d.ts +6 -6
- package/lib/types/TaskMessageLocation.js +2 -2
- package/lib/types/TaskMessageLocation.js.map +1 -1
- package/lib/types/TaskResponse.d.ts +80 -80
- package/lib/types/TaskResult.d.ts +64 -64
- package/lib/utilities/bundleTask.js +1 -1
- package/lib/utilities/bundleTask.js.map +1 -1
- package/lib/utilities/createRemoteCacheClient.js +2 -2
- package/lib/utilities/createRemoteCacheClient.js.map +1 -1
- package/lib/utilities/ensureRemoteCacheEnabled.d.ts +1 -0
- package/lib/utilities/ensureRemoteCacheEnabled.d.ts.map +1 -1
- package/lib/utilities/formatBundleErrors.d.ts +1 -1
- package/lib/utilities/formatBundleErrors.d.ts.map +1 -1
- package/lib/utilities/formatBundleErrors.js +7 -6
- package/lib/utilities/formatBundleErrors.js.map +1 -1
- package/lib/utilities/getBundleInfo.d.ts.map +1 -1
- package/lib/utilities/getBundleInfo.js +12 -13
- package/lib/utilities/getBundleInfo.js.map +1 -1
- package/lib/utilities/getConsumedDependencies.js +2 -2
- package/lib/utilities/getConsumedDependencies.js.map +1 -1
- package/lib/utilities/getConsumedPaths.js +2 -2
- package/lib/utilities/getConsumedPaths.js.map +1 -1
- package/package.json +11 -11
|
@@ -5,45 +5,45 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
5
5
|
source: z.ZodString;
|
|
6
6
|
location: z.ZodOptional<z.ZodObject<{
|
|
7
7
|
file: z.ZodString;
|
|
8
|
-
line: z.ZodNumber
|
|
9
|
-
column: z.ZodNumber
|
|
8
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
file: string;
|
|
12
|
-
line
|
|
13
|
-
column
|
|
12
|
+
line?: number | undefined;
|
|
13
|
+
column?: number | undefined;
|
|
14
14
|
}, {
|
|
15
15
|
file: string;
|
|
16
|
-
line
|
|
17
|
-
column
|
|
16
|
+
line?: number | undefined;
|
|
17
|
+
column?: number | undefined;
|
|
18
18
|
}>>;
|
|
19
19
|
notes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
20
20
|
text: z.ZodString;
|
|
21
21
|
location: z.ZodOptional<z.ZodObject<{
|
|
22
22
|
file: z.ZodString;
|
|
23
|
-
line: z.ZodNumber
|
|
24
|
-
column: z.ZodNumber
|
|
23
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
25
25
|
}, "strip", z.ZodTypeAny, {
|
|
26
26
|
file: string;
|
|
27
|
-
line
|
|
28
|
-
column
|
|
27
|
+
line?: number | undefined;
|
|
28
|
+
column?: number | undefined;
|
|
29
29
|
}, {
|
|
30
30
|
file: string;
|
|
31
|
-
line
|
|
32
|
-
column
|
|
31
|
+
line?: number | undefined;
|
|
32
|
+
column?: number | undefined;
|
|
33
33
|
}>>;
|
|
34
34
|
}, "strip", z.ZodTypeAny, {
|
|
35
35
|
text: string;
|
|
36
36
|
location?: {
|
|
37
37
|
file: string;
|
|
38
|
-
line
|
|
39
|
-
column
|
|
38
|
+
line?: number | undefined;
|
|
39
|
+
column?: number | undefined;
|
|
40
40
|
} | undefined;
|
|
41
41
|
}, {
|
|
42
42
|
text: string;
|
|
43
43
|
location?: {
|
|
44
44
|
file: string;
|
|
45
|
-
line
|
|
46
|
-
column
|
|
45
|
+
line?: number | undefined;
|
|
46
|
+
column?: number | undefined;
|
|
47
47
|
} | undefined;
|
|
48
48
|
}>, "many">>;
|
|
49
49
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -51,15 +51,15 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
51
51
|
source: string;
|
|
52
52
|
location?: {
|
|
53
53
|
file: string;
|
|
54
|
-
line
|
|
55
|
-
column
|
|
54
|
+
line?: number | undefined;
|
|
55
|
+
column?: number | undefined;
|
|
56
56
|
} | undefined;
|
|
57
57
|
notes?: {
|
|
58
58
|
text: string;
|
|
59
59
|
location?: {
|
|
60
60
|
file: string;
|
|
61
|
-
line
|
|
62
|
-
column
|
|
61
|
+
line?: number | undefined;
|
|
62
|
+
column?: number | undefined;
|
|
63
63
|
} | undefined;
|
|
64
64
|
}[] | undefined;
|
|
65
65
|
}, {
|
|
@@ -67,15 +67,15 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
67
67
|
source: string;
|
|
68
68
|
location?: {
|
|
69
69
|
file: string;
|
|
70
|
-
line
|
|
71
|
-
column
|
|
70
|
+
line?: number | undefined;
|
|
71
|
+
column?: number | undefined;
|
|
72
72
|
} | undefined;
|
|
73
73
|
notes?: {
|
|
74
74
|
text: string;
|
|
75
75
|
location?: {
|
|
76
76
|
file: string;
|
|
77
|
-
line
|
|
78
|
-
column
|
|
77
|
+
line?: number | undefined;
|
|
78
|
+
column?: number | undefined;
|
|
79
79
|
} | undefined;
|
|
80
80
|
}[] | undefined;
|
|
81
81
|
}>, "many">>;
|
|
@@ -84,45 +84,45 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
84
84
|
source: z.ZodString;
|
|
85
85
|
location: z.ZodOptional<z.ZodObject<{
|
|
86
86
|
file: z.ZodString;
|
|
87
|
-
line: z.ZodNumber
|
|
88
|
-
column: z.ZodNumber
|
|
87
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
89
89
|
}, "strip", z.ZodTypeAny, {
|
|
90
90
|
file: string;
|
|
91
|
-
line
|
|
92
|
-
column
|
|
91
|
+
line?: number | undefined;
|
|
92
|
+
column?: number | undefined;
|
|
93
93
|
}, {
|
|
94
94
|
file: string;
|
|
95
|
-
line
|
|
96
|
-
column
|
|
95
|
+
line?: number | undefined;
|
|
96
|
+
column?: number | undefined;
|
|
97
97
|
}>>;
|
|
98
98
|
notes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
99
99
|
text: z.ZodString;
|
|
100
100
|
location: z.ZodOptional<z.ZodObject<{
|
|
101
101
|
file: z.ZodString;
|
|
102
|
-
line: z.ZodNumber
|
|
103
|
-
column: z.ZodNumber
|
|
102
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
104
104
|
}, "strip", z.ZodTypeAny, {
|
|
105
105
|
file: string;
|
|
106
|
-
line
|
|
107
|
-
column
|
|
106
|
+
line?: number | undefined;
|
|
107
|
+
column?: number | undefined;
|
|
108
108
|
}, {
|
|
109
109
|
file: string;
|
|
110
|
-
line
|
|
111
|
-
column
|
|
110
|
+
line?: number | undefined;
|
|
111
|
+
column?: number | undefined;
|
|
112
112
|
}>>;
|
|
113
113
|
}, "strip", z.ZodTypeAny, {
|
|
114
114
|
text: string;
|
|
115
115
|
location?: {
|
|
116
116
|
file: string;
|
|
117
|
-
line
|
|
118
|
-
column
|
|
117
|
+
line?: number | undefined;
|
|
118
|
+
column?: number | undefined;
|
|
119
119
|
} | undefined;
|
|
120
120
|
}, {
|
|
121
121
|
text: string;
|
|
122
122
|
location?: {
|
|
123
123
|
file: string;
|
|
124
|
-
line
|
|
125
|
-
column
|
|
124
|
+
line?: number | undefined;
|
|
125
|
+
column?: number | undefined;
|
|
126
126
|
} | undefined;
|
|
127
127
|
}>, "many">>;
|
|
128
128
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -130,15 +130,15 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
130
130
|
source: string;
|
|
131
131
|
location?: {
|
|
132
132
|
file: string;
|
|
133
|
-
line
|
|
134
|
-
column
|
|
133
|
+
line?: number | undefined;
|
|
134
|
+
column?: number | undefined;
|
|
135
135
|
} | undefined;
|
|
136
136
|
notes?: {
|
|
137
137
|
text: string;
|
|
138
138
|
location?: {
|
|
139
139
|
file: string;
|
|
140
|
-
line
|
|
141
|
-
column
|
|
140
|
+
line?: number | undefined;
|
|
141
|
+
column?: number | undefined;
|
|
142
142
|
} | undefined;
|
|
143
143
|
}[] | undefined;
|
|
144
144
|
}, {
|
|
@@ -146,15 +146,15 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
146
146
|
source: string;
|
|
147
147
|
location?: {
|
|
148
148
|
file: string;
|
|
149
|
-
line
|
|
150
|
-
column
|
|
149
|
+
line?: number | undefined;
|
|
150
|
+
column?: number | undefined;
|
|
151
151
|
} | undefined;
|
|
152
152
|
notes?: {
|
|
153
153
|
text: string;
|
|
154
154
|
location?: {
|
|
155
155
|
file: string;
|
|
156
|
-
line
|
|
157
|
-
column
|
|
156
|
+
line?: number | undefined;
|
|
157
|
+
column?: number | undefined;
|
|
158
158
|
} | undefined;
|
|
159
159
|
}[] | undefined;
|
|
160
160
|
}>, "many">>;
|
|
@@ -164,15 +164,15 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
164
164
|
source: string;
|
|
165
165
|
location?: {
|
|
166
166
|
file: string;
|
|
167
|
-
line
|
|
168
|
-
column
|
|
167
|
+
line?: number | undefined;
|
|
168
|
+
column?: number | undefined;
|
|
169
169
|
} | undefined;
|
|
170
170
|
notes?: {
|
|
171
171
|
text: string;
|
|
172
172
|
location?: {
|
|
173
173
|
file: string;
|
|
174
|
-
line
|
|
175
|
-
column
|
|
174
|
+
line?: number | undefined;
|
|
175
|
+
column?: number | undefined;
|
|
176
176
|
} | undefined;
|
|
177
177
|
}[] | undefined;
|
|
178
178
|
}[] | undefined;
|
|
@@ -181,15 +181,15 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
181
181
|
source: string;
|
|
182
182
|
location?: {
|
|
183
183
|
file: string;
|
|
184
|
-
line
|
|
185
|
-
column
|
|
184
|
+
line?: number | undefined;
|
|
185
|
+
column?: number | undefined;
|
|
186
186
|
} | undefined;
|
|
187
187
|
notes?: {
|
|
188
188
|
text: string;
|
|
189
189
|
location?: {
|
|
190
190
|
file: string;
|
|
191
|
-
line
|
|
192
|
-
column
|
|
191
|
+
line?: number | undefined;
|
|
192
|
+
column?: number | undefined;
|
|
193
193
|
} | undefined;
|
|
194
194
|
}[] | undefined;
|
|
195
195
|
}[] | undefined;
|
|
@@ -199,15 +199,15 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
199
199
|
source: string;
|
|
200
200
|
location?: {
|
|
201
201
|
file: string;
|
|
202
|
-
line
|
|
203
|
-
column
|
|
202
|
+
line?: number | undefined;
|
|
203
|
+
column?: number | undefined;
|
|
204
204
|
} | undefined;
|
|
205
205
|
notes?: {
|
|
206
206
|
text: string;
|
|
207
207
|
location?: {
|
|
208
208
|
file: string;
|
|
209
|
-
line
|
|
210
|
-
column
|
|
209
|
+
line?: number | undefined;
|
|
210
|
+
column?: number | undefined;
|
|
211
211
|
} | undefined;
|
|
212
212
|
}[] | undefined;
|
|
213
213
|
}[] | undefined;
|
|
@@ -216,15 +216,15 @@ export declare const ZodTaskResult: z.ZodObject<{
|
|
|
216
216
|
source: string;
|
|
217
217
|
location?: {
|
|
218
218
|
file: string;
|
|
219
|
-
line
|
|
220
|
-
column
|
|
219
|
+
line?: number | undefined;
|
|
220
|
+
column?: number | undefined;
|
|
221
221
|
} | undefined;
|
|
222
222
|
notes?: {
|
|
223
223
|
text: string;
|
|
224
224
|
location?: {
|
|
225
225
|
file: string;
|
|
226
|
-
line
|
|
227
|
-
column
|
|
226
|
+
line?: number | undefined;
|
|
227
|
+
column?: number | undefined;
|
|
228
228
|
} | undefined;
|
|
229
229
|
}[] | undefined;
|
|
230
230
|
}[] | undefined;
|
|
@@ -48,7 +48,7 @@ export async function bundleTask(params) {
|
|
|
48
48
|
return {
|
|
49
49
|
status: result.errors.length ? 'fail' : 'complete',
|
|
50
50
|
...(result.errors?.length
|
|
51
|
-
? formatBundleErrors(result.errors)
|
|
51
|
+
? formatBundleErrors(result.errors, bundleRequest.packagePath)
|
|
52
52
|
: {
|
|
53
53
|
details: bulletedList([
|
|
54
54
|
`Package: ${bundleRequest.packageName}@${bundleRequest.version}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleTask.js","sourceRoot":"","sources":["../../src/utilities/bundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGpH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAmB,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EACL,YAAY,EACZ,iBAAiB,GAGlB,MAAM,6BAA6B,CAAC;AAErC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;A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AmE;QACnE,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { bundle as bundleInternal, getEntriesMapFromPackage, getExternalsFromPackage } from '@ms-cloudpack/bundler';\nimport type { BundleOptions, CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { getExportsMap, type ResolveMap } from '@ms-cloudpack/package-utilities';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport {\n bulletedList,\n formatPackageName,\n type TaskReporter,\n type TaskReporterTaskResult,\n} from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport path from 'path';\nimport { prepareOutputPath } from '../common/prepareOutputPath.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport type { BundleTaskOptions } from '../types/BundleTaskOptions.js';\nimport { diskCacheRatioMetricEventAggregator } from './diskCacheRatioMetricEventAggregator.js';\nimport { formatBundleErrors } from './formatBundleErrors.js';\nimport { getBundleInfo } from './getBundleInfo.js';\nimport { getBundleLocation } from './getBundleLocation.js';\nimport { getFileSizeSync } from './getFileSizeSync.js';\nimport { isCachedResultValid } from './isCachedResultValid.js';\nimport { readResultFromCache } from './readResultFromCache.js';\nimport { saveResultToCache } from './saveResultToCache.js';\n\nexport async function bundleTask(params: {\n bundleRequest: BundleRequest;\n options?: BundleTaskOptions;\n context: {\n packages: PackageDefinitionsCache;\n config: CloudpackConfig;\n resolveMap: ResolveMap;\n packageHashes: PackageHashes;\n reporter?: TaskReporter;\n telemetryClient?: TelemetryClient;\n };\n}): Promise<BundleRequest> {\n const { bundleRequest, options = {}, context } = params;\n const { packageName, version } = bundleRequest;\n const { reporter, telemetryClient } = context;\n\n const taskName = `Bundle ${formatPackageName({\n name: packageName,\n version,\n })}`;\n\n telemetryClient?.performance.registerAggregator(diskCacheRatioMetricEventAggregator);\n\n const executeBundle = async (): Promise<TaskReporterTaskResult> => {\n await bundle({ bundleRequest, context, options });\n\n diskCacheRatioMetricEventAggregator?.record({\n isCacheHit: !!bundleRequest.resultFromCache,\n isExternal: bundleRequest.isExternal,\n });\n\n const { result } = bundleRequest;\n\n if (!result) {\n return {\n status: 'fail',\n details: `[bundleTask] No result was found for \"${packageName}@${version}\"`,\n };\n }\n\n result.outputFiles ??= [];\n result.errors ??= [];\n result.warnings ??= [];\n\n if (!result.outputFiles.length && !result.errors?.length) {\n result.warnings.push({\n text: `No output files were found for \"${packageName}\" in \"${result.outputPath}\"`,\n source: 'bundleTask',\n });\n }\n\n return {\n status: result.errors.length ? 'fail' : 'complete',\n ...(result.errors?.length\n ? formatBundleErrors(result.errors)\n : {\n details: bulletedList([\n `Package: ${bundleRequest.packageName}@${bundleRequest.version}`,\n `Bundler: ${result.bundlerName || 'unknown'}`,\n `Input path: ${bundleRequest.packagePath}`,\n `Entries:`,\n Object.values(result.entries || {}),\n `Output path: ${result.outputPath}`,\n result.outputFiles?.map(\n (file) =>\n `${normalizeRelativePath(file.outputPath)} (${getFileSizeSync(\n path.resolve(result.outputPath, file.outputPath),\n )})`,\n ),\n ]),\n }),\n };\n };\n\n if (reporter) {\n await reporter.runTask(taskName, executeBundle);\n } else {\n await executeBundle();\n }\n\n return bundleRequest;\n}\n\nasync function bundle(params: {\n bundleRequest: BundleRequest;\n context: {\n packages: PackageDefinitionsCache;\n config: CloudpackConfig;\n packageHashes: PackageHashes;\n };\n options?: BundleTaskOptions;\n}): Promise<BundleRequest> {\n const { bundleRequest, context, options = {} } = params;\n const { config, packageHashes } = context;\n const { force, hash, sourceHash } = options;\n\n // If force is set, dispose the existing result.\n if (force && bundleRequest?.result?.dispose) {\n bundleRequest.result.dispose();\n bundleRequest.result = undefined;\n }\n\n const { packagePath, isExternal, isIncremental, disableSourceMaps, shouldGetBundleInfo } = bundleRequest;\n\n const outputPath =\n bundleRequest.outputPath ??\n (await getBundleLocation({ packagePath, shouldRecalculate: force, hash }, context)).path;\n\n // Rehydrate the result if not incremental.\n if (bundleRequest.result === undefined && !force) {\n bundleRequest.result = await readResultFromCache(outputPath, {\n inputPath: packagePath,\n });\n }\n\n const cacheValidationHash = !isExternal\n ? sourceHash || (await packageHashes.get({ packagePath, isSourceHashingEnabled: true, shouldRecalculate: true }))\n : undefined;\n\n // if the cached result is valid, use it.\n if (!force && isCachedResultValid({ bundleRequest, hash: cacheValidationHash })) {\n console.debug(`Using cached result for ${bundleRequest.packageName}@${bundleRequest.version}`);\n bundleRequest.resultFromCache = true;\n } else {\n bundleRequest.resultFromCache = false;\n\n // Only use cached result if it's successful.\n await prepareOutputPath(outputPath);\n\n if (bundleRequest.result?.rebuild) {\n bundleRequest.result = {\n ...(await bundleRequest.result.rebuild()),\n outputPath: bundleRequest.result.outputPath,\n hash: cacheValidationHash,\n };\n } else {\n const { userPackageSettings, generatedPackageSettings } =\n getPackageSettings({\n name: bundleRequest.packageName,\n version: bundleRequest.version,\n config,\n }) || {};\n const { bundlerType, bundlerOptions } = userPackageSettings || {};\n\n const inlinedDependencies = [\n ...(userPackageSettings?.inlinedDependencies || []),\n ...(generatedPackageSettings?.inlinedDependencies || []),\n ];\n\n const bundleOptions: BundleOptions = {\n bundlerType: bundleRequest.bundlerType || bundlerType,\n overrideOptions: bundlerOptions,\n inputPath: packagePath,\n outputPath,\n incremental: isIncremental !== undefined ? isIncremental : !isExternal,\n sourcemap: disableSourceMaps ? undefined : 'linked',\n entries: await getEntriesMapFromPackage({ inputPath: packagePath }, context),\n inlined: inlinedDependencies,\n external: await getExternalsFromPackage({ inputPath: packagePath }, context),\n };\n\n const bundleInternalResult = await bundleInternal(bundleOptions, { config });\n bundleRequest.result = {\n ...bundleInternalResult,\n outputPath: bundleOptions.outputPath ?? outputPath,\n hash: cacheValidationHash,\n };\n }\n\n // Write the result to disk.\n await saveResultToCache(bundleRequest.result);\n }\n\n // If we should find required imports and exports per bundle\n if (shouldGetBundleInfo && !bundleRequest.result?.errors?.length && bundleRequest.result?.outputFiles?.length) {\n const bundleInfoPath = path.join(outputPath, 'bundle-info.json');\n\n // Exports map is needed to find the bundle info per entry we intend to bundle.\n // Exports map is used instead of bundleRequest.entries since it is easier to use\n // because it contains the paths other packages use to import the entry and\n // the relative location of the bundled files.\n const exportsMap = await getExportsMap({ packagePath }, context);\n\n const bundleInfo = await getBundleInfo({\n outputPath,\n outputFiles: bundleRequest.result.outputFiles,\n exportsMap,\n isExternal,\n });\n\n bundleRequest.result.info = bundleInfo;\n\n // Write to cache for future use. (Ignore the promise result.)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n writeJson(bundleInfoPath, bundleInfo);\n }\n\n return bundleRequest;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bundleTask.js","sourceRoot":"","sources":["../../src/utilities/bundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGpH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAmB,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EACL,YAAY,EACZ,iBAAiB,GAGlB,MAAM,6BAA6B,CAAC;AAErC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAA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,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;QAEvC,8DAA8D;QAC9D,mEAAmE;QACnE,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { bundle as bundleInternal, getEntriesMapFromPackage, getExternalsFromPackage } from '@ms-cloudpack/bundler';\nimport type { BundleOptions, CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { getExportsMap, type ResolveMap } from '@ms-cloudpack/package-utilities';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport {\n bulletedList,\n formatPackageName,\n type TaskReporter,\n type TaskReporterTaskResult,\n} from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport path from 'path';\nimport { prepareOutputPath } from '../common/prepareOutputPath.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport type { BundleTaskOptions } from '../types/BundleTaskOptions.js';\nimport { diskCacheRatioMetricEventAggregator } from './diskCacheRatioMetricEventAggregator.js';\nimport { formatBundleErrors } from './formatBundleErrors.js';\nimport { getBundleInfo } from './getBundleInfo.js';\nimport { getBundleLocation } from './getBundleLocation.js';\nimport { getFileSizeSync } from './getFileSizeSync.js';\nimport { isCachedResultValid } from './isCachedResultValid.js';\nimport { readResultFromCache } from './readResultFromCache.js';\nimport { saveResultToCache } from './saveResultToCache.js';\n\nexport async function bundleTask(params: {\n bundleRequest: BundleRequest;\n options?: BundleTaskOptions;\n context: {\n packages: PackageDefinitionsCache;\n config: CloudpackConfig;\n resolveMap: ResolveMap;\n packageHashes: PackageHashes;\n reporter?: TaskReporter;\n telemetryClient?: TelemetryClient;\n };\n}): Promise<BundleRequest> {\n const { bundleRequest, options = {}, context } = params;\n const { packageName, version } = bundleRequest;\n const { reporter, telemetryClient } = context;\n\n const taskName = `Bundle ${formatPackageName({\n name: packageName,\n version,\n })}`;\n\n telemetryClient?.performance.registerAggregator(diskCacheRatioMetricEventAggregator);\n\n const executeBundle = async (): Promise<TaskReporterTaskResult> => {\n await bundle({ bundleRequest, context, options });\n\n diskCacheRatioMetricEventAggregator?.record({\n isCacheHit: !!bundleRequest.resultFromCache,\n isExternal: bundleRequest.isExternal,\n });\n\n const { result } = bundleRequest;\n\n if (!result) {\n return {\n status: 'fail',\n details: `[bundleTask] No result was found for \"${packageName}@${version}\"`,\n };\n }\n\n result.outputFiles ??= [];\n result.errors ??= [];\n result.warnings ??= [];\n\n if (!result.outputFiles.length && !result.errors?.length) {\n result.warnings.push({\n text: `No output files were found for \"${packageName}\" in \"${result.outputPath}\"`,\n source: 'bundleTask',\n });\n }\n\n return {\n status: result.errors.length ? 'fail' : 'complete',\n ...(result.errors?.length\n ? formatBundleErrors(result.errors, bundleRequest.packagePath)\n : {\n details: bulletedList([\n `Package: ${bundleRequest.packageName}@${bundleRequest.version}`,\n `Bundler: ${result.bundlerName || 'unknown'}`,\n `Input path: ${bundleRequest.packagePath}`,\n `Entries:`,\n Object.values(result.entries || {}),\n `Output path: ${result.outputPath}`,\n result.outputFiles?.map(\n (file) =>\n `${normalizeRelativePath(file.outputPath)} (${getFileSizeSync(\n path.resolve(result.outputPath, file.outputPath),\n )})`,\n ),\n ]),\n }),\n };\n };\n\n if (reporter) {\n await reporter.runTask(taskName, executeBundle);\n } else {\n await executeBundle();\n }\n\n return bundleRequest;\n}\n\nasync function bundle(params: {\n bundleRequest: BundleRequest;\n context: {\n packages: PackageDefinitionsCache;\n config: CloudpackConfig;\n packageHashes: PackageHashes;\n };\n options?: BundleTaskOptions;\n}): Promise<BundleRequest> {\n const { bundleRequest, context, options = {} } = params;\n const { config, packageHashes } = context;\n const { force, hash, sourceHash } = options;\n\n // If force is set, dispose the existing result.\n if (force && bundleRequest?.result?.dispose) {\n bundleRequest.result.dispose();\n bundleRequest.result = undefined;\n }\n\n const { packagePath, isExternal, isIncremental, disableSourceMaps, shouldGetBundleInfo } = bundleRequest;\n\n const outputPath =\n bundleRequest.outputPath ??\n (await getBundleLocation({ packagePath, shouldRecalculate: force, hash }, context)).path;\n\n // Rehydrate the result if not incremental.\n if (bundleRequest.result === undefined && !force) {\n bundleRequest.result = await readResultFromCache(outputPath, {\n inputPath: packagePath,\n });\n }\n\n const cacheValidationHash = !isExternal\n ? sourceHash || (await packageHashes.get({ packagePath, isSourceHashingEnabled: true, shouldRecalculate: true }))\n : undefined;\n\n // if the cached result is valid, use it.\n if (!force && isCachedResultValid({ bundleRequest, hash: cacheValidationHash })) {\n console.debug(`Using cached result for ${bundleRequest.packageName}@${bundleRequest.version}`);\n bundleRequest.resultFromCache = true;\n } else {\n bundleRequest.resultFromCache = false;\n\n // Only use cached result if it's successful.\n await prepareOutputPath(outputPath);\n\n if (bundleRequest.result?.rebuild) {\n bundleRequest.result = {\n ...(await bundleRequest.result.rebuild()),\n outputPath: bundleRequest.result.outputPath,\n hash: cacheValidationHash,\n };\n } else {\n const { userPackageSettings, generatedPackageSettings } =\n getPackageSettings({\n name: bundleRequest.packageName,\n version: bundleRequest.version,\n config,\n }) || {};\n const { bundlerType, bundlerOptions } = userPackageSettings || {};\n\n const inlinedDependencies = [\n ...(userPackageSettings?.inlinedDependencies || []),\n ...(generatedPackageSettings?.inlinedDependencies || []),\n ];\n\n const bundleOptions: BundleOptions = {\n bundlerType: bundleRequest.bundlerType || bundlerType,\n overrideOptions: bundlerOptions,\n inputPath: packagePath,\n outputPath,\n incremental: isIncremental !== undefined ? isIncremental : !isExternal,\n sourcemap: disableSourceMaps ? undefined : 'linked',\n entries: await getEntriesMapFromPackage({ inputPath: packagePath }, context),\n inlined: inlinedDependencies,\n external: await getExternalsFromPackage({ inputPath: packagePath }, context),\n };\n\n const bundleInternalResult = await bundleInternal(bundleOptions, { config });\n bundleRequest.result = {\n ...bundleInternalResult,\n outputPath: bundleOptions.outputPath ?? outputPath,\n hash: cacheValidationHash,\n };\n }\n\n // Write the result to disk.\n await saveResultToCache(bundleRequest.result);\n }\n\n // If we should find required imports and exports per bundle\n if (shouldGetBundleInfo && !bundleRequest.result?.errors?.length && bundleRequest.result?.outputFiles?.length) {\n const bundleInfoPath = path.join(outputPath, 'bundle-info.json');\n\n // Exports map is needed to find the bundle info per entry we intend to bundle.\n // Exports map is used instead of bundleRequest.entries since it is easier to use\n // because it contains the paths other packages use to import the entry and\n // the relative location of the bundled files.\n const exportsMap = await getExportsMap({ packagePath }, context);\n\n const bundleInfo = await getBundleInfo({\n outputPath,\n outputFiles: bundleRequest.result.outputFiles,\n exportsMap,\n isExternal,\n });\n\n bundleRequest.result.info = bundleInfo;\n\n // Write to cache for future use. (Ignore the promise result.)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n writeJson(bundleInfoPath, bundleInfo);\n }\n\n return bundleRequest;\n}\n"]}
|
|
@@ -4,11 +4,11 @@ export async function createRemoteCacheClient(params) {
|
|
|
4
4
|
const { ctx, input } = params;
|
|
5
5
|
const { loginMethod } = input;
|
|
6
6
|
const { session, reporter, telemetryClient } = ctx;
|
|
7
|
-
const { container, storageAccount } = ensureRemoteCacheEnabled(session.config);
|
|
7
|
+
const { container, storageAccount, tenantId } = ensureRemoteCacheEnabled(session.config);
|
|
8
8
|
const remoteCacheModule = await import('@ms-cloudpack/remote-cache');
|
|
9
9
|
const client = await remoteCacheModule.createRemoteCacheClient({
|
|
10
10
|
context: { reporter, telemetryClient },
|
|
11
|
-
options: { container, loginMethod, storageAccount, cachePath: getCachePath() },
|
|
11
|
+
options: { container, loginMethod, storageAccount, cachePath: getCachePath(), tenantId },
|
|
12
12
|
});
|
|
13
13
|
return client;
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRemoteCacheClient.js","sourceRoot":"","sources":["../../src/utilities/createRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAA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,QAAQ,EAAE;KACzF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { ensureRemoteCacheEnabled } from '../utilities/ensureRemoteCacheEnabled.js';\nimport type { LoginMethod } from '@ms-cloudpack/remote-cache';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { getCachePath } from './getCachePath.js';\n\nexport async function createRemoteCacheClient(\n params: ApiParams<\n {\n loginMethod: LoginMethod;\n },\n 'session' | 'reporter' | 'telemetryClient'\n >,\n) {\n const { ctx, input } = params;\n const { loginMethod } = input;\n const { session, reporter, telemetryClient } = ctx;\n const { container, storageAccount, tenantId } = ensureRemoteCacheEnabled(session.config);\n\n const remoteCacheModule = await import('@ms-cloudpack/remote-cache');\n\n const client = await remoteCacheModule.createRemoteCacheClient({\n context: { reporter, telemetryClient },\n options: { container, loginMethod, storageAccount, cachePath: getCachePath(), tenantId },\n });\n\n return client;\n}\n"]}
|
|
@@ -7,5 +7,6 @@ import type { CloudpackConfig } from '@ms-cloudpack/common-types';
|
|
|
7
7
|
export declare function ensureRemoteCacheEnabled({ remoteCache }: CloudpackConfig): {
|
|
8
8
|
storageAccount: string;
|
|
9
9
|
container: string;
|
|
10
|
+
tenantId?: string | undefined;
|
|
10
11
|
};
|
|
11
12
|
//# sourceMappingURL=ensureRemoteCacheEnabled.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureRemoteCacheEnabled.d.ts","sourceRoot":"","sources":["../../src/utilities/ensureRemoteCacheEnabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,WAAW,EAAE,EAAE,eAAe
|
|
1
|
+
{"version":3,"file":"ensureRemoteCacheEnabled.d.ts","sourceRoot":"","sources":["../../src/utilities/ensureRemoteCacheEnabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,WAAW,EAAE,EAAE,eAAe;;;;EAMxE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BundleMessage } from '@ms-cloudpack/common-types';
|
|
2
|
-
export declare function formatBundleErrors(errors: BundleMessage[] | undefined): {
|
|
2
|
+
export declare function formatBundleErrors(errors: BundleMessage[] | undefined, packagePath: string): {
|
|
3
3
|
message?: undefined;
|
|
4
4
|
details?: undefined;
|
|
5
5
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatBundleErrors.d.ts","sourceRoot":"","sources":["../../src/utilities/formatBundleErrors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"formatBundleErrors.d.ts","sourceRoot":"","sources":["../../src/utilities/formatBundleErrors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM;;;;;;EAO1F"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { formatLocation } from '@ms-cloudpack/path-utilities';
|
|
2
|
+
import { red, bulletedList, plural, indent } from '@ms-cloudpack/task-reporter';
|
|
3
|
+
export function formatBundleErrors(errors, packagePath) {
|
|
3
4
|
if (!errors?.length)
|
|
4
5
|
return {};
|
|
5
6
|
return {
|
|
6
7
|
message: plural(errors.length, 'error$s found'),
|
|
7
|
-
details: bulletedList(errors.map((error) => formatError(error))),
|
|
8
|
+
details: bulletedList(errors.map((error) => formatError(error, packagePath))),
|
|
8
9
|
};
|
|
9
10
|
}
|
|
10
|
-
function formatError(error) {
|
|
11
|
+
function formatError(error, packagePath) {
|
|
11
12
|
const { text, source, location } = error;
|
|
12
|
-
const
|
|
13
|
-
return
|
|
13
|
+
const filePath = location ? ' ' + formatLocation({ ...location, fromPath: packagePath }) : '';
|
|
14
|
+
return `[${source}]${filePath}\n${red(indent(text, 1))}`;
|
|
14
15
|
}
|
|
15
16
|
//# sourceMappingURL=formatBundleErrors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatBundleErrors.js","sourceRoot":"","sources":["../../src/utilities/formatBundleErrors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"formatBundleErrors.js","sourceRoot":"","sources":["../../src/utilities/formatBundleErrors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAEhF,MAAM,UAAU,kBAAkB,CAAC,MAAmC,EAAE,WAAmB;IACzF,IAAI,CAAC,MAAM,EAAE,MAAM;QAAE,OAAO,EAAE,CAAC;IAE/B,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;QAC/C,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;KAC9E,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,KAAoB,EAAE,WAAmB;IAC5D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEzC,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9F,OAAO,IAAI,MAAM,IAAI,QAAQ,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["import type { BundleMessage } from '@ms-cloudpack/common-types';\nimport { formatLocation } from '@ms-cloudpack/path-utilities';\nimport { red, bulletedList, plural, indent } from '@ms-cloudpack/task-reporter';\n\nexport function formatBundleErrors(errors: BundleMessage[] | undefined, packagePath: string) {\n if (!errors?.length) return {};\n\n return {\n message: plural(errors.length, 'error$s found'),\n details: bulletedList(errors.map((error) => formatError(error, packagePath))),\n };\n}\n\nfunction formatError(error: BundleMessage, packagePath: string) {\n const { text, source, location } = error;\n\n const filePath = location ? ' ' + formatLocation({ ...location, fromPath: packagePath }) : '';\n return `[${source}]${filePath}\\n${red(indent(text, 1))}`;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBundleInfo.d.ts","sourceRoot":"","sources":["../../src/utilities/getBundleInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"getBundleInfo.d.ts","sourceRoot":"","sources":["../../src/utilities/getBundleInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,OAAO,CAAC,UAAU,CAAC,CAmHtB"}
|
|
@@ -7,9 +7,7 @@ import { getImportsAndExports } from './getImportsAndExports.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export async function getBundleInfo(params) {
|
|
9
9
|
const { outputPath, outputFiles, exportsMap, isExternal } = params;
|
|
10
|
-
const bundleInfo = {
|
|
11
|
-
entry: {},
|
|
12
|
-
};
|
|
10
|
+
const bundleInfo = {};
|
|
13
11
|
// If there are no output files, return the empty bundle info.
|
|
14
12
|
if (!outputFiles.length) {
|
|
15
13
|
return bundleInfo;
|
|
@@ -54,7 +52,7 @@ export async function getBundleInfo(params) {
|
|
|
54
52
|
continue;
|
|
55
53
|
}
|
|
56
54
|
const safePath = localPathToSafe[filePath];
|
|
57
|
-
if (safePath === undefined) {
|
|
55
|
+
if (safePath === undefined || !outputFileInfo[safePath]) {
|
|
58
56
|
throw new Error(`Found file that was not expected to be processed: ${filePath}`);
|
|
59
57
|
}
|
|
60
58
|
const parseResult = await getImportsAndExports(filePath);
|
|
@@ -62,12 +60,9 @@ export async function getBundleInfo(params) {
|
|
|
62
60
|
continue;
|
|
63
61
|
}
|
|
64
62
|
const { exportNames, imports } = parseResult;
|
|
65
|
-
const { entry, produces } = outputFileInfo[safePath]
|
|
66
|
-
entry: safePath,
|
|
67
|
-
produces: new Set(),
|
|
68
|
-
};
|
|
63
|
+
const { entry, produces } = outputFileInfo[safePath];
|
|
69
64
|
exportNames.forEach((name) => produces.add(name));
|
|
70
|
-
bundleInfo
|
|
65
|
+
bundleInfo[entry] ??= {
|
|
71
66
|
bundlePath: safePath,
|
|
72
67
|
produces: Array.from(produces),
|
|
73
68
|
consumes: [],
|
|
@@ -83,15 +78,19 @@ export async function getBundleInfo(params) {
|
|
|
83
78
|
}
|
|
84
79
|
else if (packageName && !packageName.startsWith('node:')) {
|
|
85
80
|
// Find if the import is already in the consumes list.
|
|
86
|
-
const entryIndex = bundleInfo
|
|
81
|
+
const entryIndex = bundleInfo[entry].consumes.findIndex((c) => c.packageName === packageName && c.importPath === importPath);
|
|
87
82
|
if (entryIndex < 0) {
|
|
88
83
|
// If not, add it.
|
|
89
|
-
bundleInfo
|
|
84
|
+
bundleInfo[entry].consumes.push({
|
|
85
|
+
packageName: packageName,
|
|
86
|
+
importPath: importPath || '.',
|
|
87
|
+
names: [...names],
|
|
88
|
+
});
|
|
90
89
|
}
|
|
91
90
|
else {
|
|
92
91
|
// If so, add the names to the existing entry.
|
|
93
92
|
// This is necessary because the same import may be used in multiple places.
|
|
94
|
-
bundleInfo
|
|
93
|
+
bundleInfo[entry].consumes[entryIndex].names = Array.from(new Set([...names, ...bundleInfo[entry].consumes[entryIndex].names]));
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
}
|
|
@@ -99,7 +98,7 @@ export async function getBundleInfo(params) {
|
|
|
99
98
|
// Multiple entries for the same path.
|
|
100
99
|
for (const repeatedEntry of repeatedExports[safePath]) {
|
|
101
100
|
if (repeatedEntry !== entry) {
|
|
102
|
-
bundleInfo
|
|
101
|
+
bundleInfo[repeatedEntry] = bundleInfo[entry];
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBundleInfo.js","sourceRoot":"","sources":["../../src/utilities/getBundleInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aA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;gBAC3D,sDAAsD;gBACtD,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,SAAS,CACrD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,IAAI,CAAC,CAAC,UAAU,KAAK,UAAU,CACpE,CAAC;gBACF,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;oBACnB,kBAAkB;oBAClB,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;wBAC9B,WAAW,EAAE,WAAW;wBACxB,UAAU,EAAE,UAAU,IAAI,GAAG;wBAC7B,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC;qBAClB,CAAC,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACN,8CAA8C;oBAC9C,4EAA4E;oBAC5E,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CACvD,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CACrE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,sCAAsC;YACtC,KAAK,MAAM,aAAa,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACtD,IAAI,aAAa,KAAK,KAAK,EAAE,CAAC;oBAC5B,UAAU,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import type { BundleOutputFile, PackageJsonExports } from '@ms-cloudpack/common-types';\nimport { getRuntimeEntryPaths } from '@ms-cloudpack/import-map';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport path from 'path';\nimport type { BundleInfo } from '../types/BundleInfo.js';\nimport { getImportsAndExports } from './getImportsAndExports.js';\n/**\n * Returns a mapping from entry file path to list of paths that are produced and consumed in the searched files.\n */\nexport async function getBundleInfo(params: {\n outputPath: string;\n outputFiles: BundleOutputFile[];\n exportsMap: PackageJsonExports;\n isExternal: boolean;\n}): Promise<BundleInfo> {\n const { outputPath, outputFiles, exportsMap, isExternal } = params;\n const bundleInfo: BundleInfo = {};\n\n // If there are no output files, return the empty bundle info.\n if (!outputFiles.length) {\n return bundleInfo;\n }\n\n /** Mapping from output file (safe/normalized relative path) to possible entry path and exports. */\n const outputFileInfo: Record<string, { entry: string; produces: Set<string> }> = {};\n outputFiles.forEach((file) => {\n // Normalize the path to start with ./ (or . for an empty path)\n const safePath = normalizeRelativePath(file.outputPath);\n // Store safe path to possible entry path and exports.\n outputFileInfo[safePath] = {\n entry: safePath,\n produces: new Set<string>(file.exports),\n };\n });\n\n const repeatedExports: Record<string, string[]> = {};\n const entryPaths = getRuntimeEntryPaths({ isExternal, exportsMap });\n\n for (const [importPath, actualEntryPath] of Object.entries(entryPaths)) {\n const safePath = normalizeRelativePath(actualEntryPath);\n\n if (outputFileInfo[safePath]) {\n if (repeatedExports[safePath]) {\n repeatedExports[safePath].push(importPath);\n } else {\n // Change best guess entry path to exports map entry.\n outputFileInfo[safePath].entry = importPath;\n repeatedExports[safePath] = [importPath];\n }\n }\n }\n\n const localPathToSafe: Record<string, string> = {};\n Object.keys(outputFileInfo).forEach((safePath) => {\n localPathToSafe[path.resolve(outputPath, safePath)] = safePath;\n });\n\n const filePaths = Object.keys(localPathToSafe);\n const visitedPaths = new Set(filePaths);\n const pathsToParse = [...filePaths];\n\n while (pathsToParse.length) {\n const filePath = pathsToParse.shift();\n // Ignore any non-JS/TS files such as SVGs and sourcemaps\n if (!filePath || path.extname(filePath) !== '.js') {\n continue;\n }\n\n const safePath = localPathToSafe[filePath];\n if (safePath === undefined || !outputFileInfo[safePath]) {\n throw new Error(`Found file that was not expected to be processed: ${filePath}`);\n }\n\n const parseResult = await getImportsAndExports(filePath);\n if (!parseResult) {\n continue;\n }\n const { exportNames, imports } = parseResult;\n\n const { entry, produces } = outputFileInfo[safePath];\n exportNames.forEach((name) => produces.add(name));\n\n bundleInfo[entry] ??= {\n bundlePath: safePath,\n produces: Array.from(produces),\n consumes: [],\n };\n\n for (const { packageName, importPath, names } of imports) {\n if (packageName?.startsWith('.')) {\n const localPath = path.resolve(path.dirname(filePath), packageName, importPath || '');\n\n if (!visitedPaths.has(localPath)) {\n visitedPaths.add(localPath);\n pathsToParse.push(localPath);\n localPathToSafe[localPath] = importPath;\n }\n } else if (packageName && !packageName.startsWith('node:')) {\n // Find if the import is already in the consumes list.\n const entryIndex = bundleInfo[entry].consumes.findIndex(\n (c) => c.packageName === packageName && c.importPath === importPath,\n );\n if (entryIndex < 0) {\n // If not, add it.\n bundleInfo[entry].consumes.push({\n packageName: packageName,\n importPath: importPath || '.',\n names: [...names],\n });\n } else {\n // If so, add the names to the existing entry.\n // This is necessary because the same import may be used in multiple places.\n bundleInfo[entry].consumes[entryIndex].names = Array.from(\n new Set([...names, ...bundleInfo[entry].consumes[entryIndex].names]),\n );\n }\n }\n }\n if (repeatedExports[safePath]?.length > 1) {\n // Multiple entries for the same path.\n for (const repeatedEntry of repeatedExports[safePath]) {\n if (repeatedEntry !== entry) {\n bundleInfo[repeatedEntry] = bundleInfo[entry];\n }\n }\n }\n }\n\n return bundleInfo;\n}\n"]}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
export function getConsumedDependencies(info) {
|
|
7
7
|
const consumedDependencies = new Set();
|
|
8
8
|
// Iterate through imports and find their path from the resolve map.
|
|
9
|
-
for (const entryInfo of Object.values(info
|
|
10
|
-
// iterate through all package names of result.info.
|
|
9
|
+
for (const entryInfo of Object.values(info)) {
|
|
10
|
+
// iterate through all package names of result.info.consumes
|
|
11
11
|
for (const consume of entryInfo.consumes) {
|
|
12
12
|
consumedDependencies.add(consume.packageName);
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConsumedDependencies.js","sourceRoot":"","sources":["../../src/utilities/getConsumedDependencies.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAgB;IACtD,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/C,oEAAoE;IACpE,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"getConsumedDependencies.js","sourceRoot":"","sources":["../../src/utilities/getConsumedDependencies.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAgB;IACtD,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/C,oEAAoE;IACpE,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,4DAA4D;QAC5D,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;YACzC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,OAAO,oBAAoB,CAAC;AAC9B,CAAC","sourcesContent":["import type { BundleInfo } from '../types/BundleInfo.js';\n\n/**\n * Get the set of dependencies consumed by the given bundle info.\n * @param info - The bundle info.\n * @returns The deduplicated set of dependencies consumed by the given bundle info.\n */\nexport function getConsumedDependencies(info: BundleInfo) {\n const consumedDependencies = new Set<string>();\n // Iterate through imports and find their path from the resolve map.\n for (const entryInfo of Object.values(info)) {\n // iterate through all package names of result.info.consumes\n for (const consume of entryInfo.consumes) {\n consumedDependencies.add(consume.packageName);\n }\n }\n\n return consumedDependencies;\n}\n"]}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
export function getConsumedPaths(info) {
|
|
7
7
|
const consumedPaths = {};
|
|
8
8
|
// Iterate through imports and find their path from the resolve map.
|
|
9
|
-
for (const entryInfo of Object.values(info
|
|
10
|
-
// iterate through all package names of result.info.
|
|
9
|
+
for (const entryInfo of Object.values(info)) {
|
|
10
|
+
// iterate through all package names of result.info.consumes
|
|
11
11
|
for (const consume of entryInfo.consumes) {
|
|
12
12
|
consumedPaths[consume.packageName] ??= new Set();
|
|
13
13
|
consumedPaths[consume.packageName].add(consume.importPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConsumedPaths.js","sourceRoot":"","sources":["../../src/utilities/getConsumedPaths.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAC/C,MAAM,aAAa,GAAgC,EAAE,CAAC;IACtD,oEAAoE;IACpE,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"getConsumedPaths.js","sourceRoot":"","sources":["../../src/utilities/getConsumedPaths.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAC/C,MAAM,aAAa,GAAgC,EAAE,CAAC;IACtD,oEAAoE;IACpE,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,4DAA4D;QAC5D,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;YACzC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC;YACjD,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import type { BundleInfo } from '../types/BundleInfo.js';\n\n/**\n * Get a record of the consumed dependencies and their import paths by the given bundle info.\n * @param info - The bundle info.\n * @returns The record of consumed dependencies and their import paths.\n */\nexport function getConsumedPaths(info: BundleInfo) {\n const consumedPaths: Record<string, Set<string>> = {};\n // Iterate through imports and find their path from the resolve map.\n for (const entryInfo of Object.values(info)) {\n // iterate through all package names of result.info.consumes\n for (const consume of entryInfo.consumes) {\n consumedPaths[consume.packageName] ??= new Set();\n consumedPaths[consume.packageName].add(consume.importPath);\n }\n }\n\n return consumedPaths;\n}\n"]}
|