@ms-cloudpack/api-server 0.30.1 → 0.30.3
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.
|
@@ -105,12 +105,16 @@ async function bundle(bundleRequest, force) {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
else {
|
|
108
|
-
const { userPackageSettings } = getPackageSettings({
|
|
108
|
+
const { userPackageSettings, generatedPackageSettings } = getPackageSettings({
|
|
109
109
|
name: bundleRequest.packageName,
|
|
110
110
|
version: bundleRequest.version,
|
|
111
111
|
config,
|
|
112
112
|
}) || {};
|
|
113
113
|
const { bundlerType, bundlerOptions } = userPackageSettings || {};
|
|
114
|
+
const inlinedDependencies = [
|
|
115
|
+
...(userPackageSettings?.inlinedDependencies || []),
|
|
116
|
+
...(generatedPackageSettings?.inlinedDependencies || []),
|
|
117
|
+
];
|
|
114
118
|
const bundleOptions = {
|
|
115
119
|
bundlerType: bundleRequest.bundlerType || bundlerType,
|
|
116
120
|
overrideOptions: bundlerOptions,
|
|
@@ -119,6 +123,7 @@ async function bundle(bundleRequest, force) {
|
|
|
119
123
|
incremental: isIncremental !== undefined ? isIncremental : !isExternal,
|
|
120
124
|
sourcemap: disableSourceMaps ? undefined : 'linked',
|
|
121
125
|
entries: await getEntriesMapFromPackage({ inputPath: packagePath }, context),
|
|
126
|
+
inlined: inlinedDependencies,
|
|
122
127
|
external: await getExternalsFromPackage({ inputPath: packagePath }, context),
|
|
123
128
|
};
|
|
124
129
|
const bundleInternalResult = await bundleInternal(bundleOptions, { config });
|
|
@@ -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;AACpH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,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;QAC9C,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;QAEjE,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC;YACrC,UAAU;YACV,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,WAAW;YAC7C,UAAU;YACV,UAAU;SACX,CAAC,CAAC;QAEH,aAAa,CAAC,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 { writeJson } from '@ms-cloudpack/json-utilities';\nimport { safeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport {\n bulletedList,\n formatPackageName,\n type TaskReporter,\n type TaskReporterTaskResult,\n} from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport { prepareOutputPath } from '../common/prepareOutputPath.js';\nimport type { BundleTaskOptions } from '../types/BundleTaskOptions.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport { formatBundleErrors } from './formatBundleErrors.js';\nimport { getFileSizeSync } from './getFileSizeSync.js';\nimport type { BundleOptions } from '@ms-cloudpack/bundler-types';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport { isCachedResultValid } from './isCachedResultValid.js';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport { diskCacheRatioMetricEventAggregator } from './diskCacheRatioMetricEventAggregator.js';\nimport { getBundleLocation } from './getBundleLocation.js';\nimport { getBundleInfo } from './getBundleInfo.js';\nimport { getExportsMap } from '@ms-cloudpack/package-utilities';\nimport { readResultFromCache } from './readResultFromCache.js';\nimport { saveResultToCache } from './saveResultToCache.js';\n\nexport async function bundleTask(params: {\n bundleRequest: BundleRequest;\n options?: BundleTaskOptions;\n reporter?: TaskReporter;\n telemetryClient?: TelemetryClient;\n}): Promise<BundleRequest> {\n const { bundleRequest, options = {}, reporter, telemetryClient } = params;\n const { packageName, version } = bundleRequest;\n const { force } = options || {};\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, force);\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: `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 });\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 `${safeRelativePath(path.relative(result.outputPath, 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(bundleRequest: BundleRequest, force?: boolean): Promise<BundleRequest> {\n const { packages, config, packageHashes } = bundleRequest;\n const context = { packages, config, packageHashes };\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 {\n packagePath,\n isExternal,\n isIncremental,\n disableSourceMaps,\n shouldGetBundleInfo,\n shouldCacheInternalPackages,\n } = bundleRequest;\n\n const outputPath =\n bundleRequest.outputPath ?? (await getBundleLocation({ packagePath, shouldRecalculate: force }, context)).path;\n\n // Rehydrate the result if not incremental.\n if (bundleRequest.result === undefined && (isExternal || shouldCacheInternalPackages) && !force) {\n bundleRequest.result = await readResultFromCache(outputPath, {\n inputPath: packagePath,\n });\n }\n\n const hash =\n !isExternal && shouldCacheInternalPackages\n ? 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 })) {\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,\n };\n } else {\n const { userPackageSettings } =\n getPackageSettings({\n name: bundleRequest.packageName,\n version: bundleRequest.version,\n config,\n }) || {};\n const { bundlerType, bundlerOptions } = userPackageSettings || {};\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 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,\n };\n }\n\n // Write the result to disk.\n if (isExternal || shouldCacheInternalPackages) {\n await saveResultToCache(bundleRequest.result);\n }\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;AACpH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,iBAAiB,GAGlB,MAAM,6BAA6B,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,M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8D;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 { writeJson } from '@ms-cloudpack/json-utilities';\nimport { safeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport {\n bulletedList,\n formatPackageName,\n type TaskReporter,\n type TaskReporterTaskResult,\n} from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport { prepareOutputPath } from '../common/prepareOutputPath.js';\nimport type { BundleTaskOptions } from '../types/BundleTaskOptions.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport { formatBundleErrors } from './formatBundleErrors.js';\nimport { getFileSizeSync } from './getFileSizeSync.js';\nimport type { BundleOptions } from '@ms-cloudpack/bundler-types';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport { isCachedResultValid } from './isCachedResultValid.js';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport { diskCacheRatioMetricEventAggregator } from './diskCacheRatioMetricEventAggregator.js';\nimport { getBundleLocation } from './getBundleLocation.js';\nimport { getBundleInfo } from './getBundleInfo.js';\nimport { getExportsMap } from '@ms-cloudpack/package-utilities';\nimport { readResultFromCache } from './readResultFromCache.js';\nimport { saveResultToCache } from './saveResultToCache.js';\n\nexport async function bundleTask(params: {\n bundleRequest: BundleRequest;\n options?: BundleTaskOptions;\n reporter?: TaskReporter;\n telemetryClient?: TelemetryClient;\n}): Promise<BundleRequest> {\n const { bundleRequest, options = {}, reporter, telemetryClient } = params;\n const { packageName, version } = bundleRequest;\n const { force } = options || {};\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, force);\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: `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 });\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 `${safeRelativePath(path.relative(result.outputPath, 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(bundleRequest: BundleRequest, force?: boolean): Promise<BundleRequest> {\n const { packages, config, packageHashes } = bundleRequest;\n const context = { packages, config, packageHashes };\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 {\n packagePath,\n isExternal,\n isIncremental,\n disableSourceMaps,\n shouldGetBundleInfo,\n shouldCacheInternalPackages,\n } = bundleRequest;\n\n const outputPath =\n bundleRequest.outputPath ?? (await getBundleLocation({ packagePath, shouldRecalculate: force }, context)).path;\n\n // Rehydrate the result if not incremental.\n if (bundleRequest.result === undefined && (isExternal || shouldCacheInternalPackages) && !force) {\n bundleRequest.result = await readResultFromCache(outputPath, {\n inputPath: packagePath,\n });\n }\n\n const hash =\n !isExternal && shouldCacheInternalPackages\n ? 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 })) {\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,\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,\n };\n }\n\n // Write the result to disk.\n if (isExternal || shouldCacheInternalPackages) {\n await saveResultToCache(bundleRequest.result);\n }\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/api-server",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.3",
|
|
4
4
|
"description": "An implementation of the API server that does interacts with a task scheduler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"@lage-run/scheduler": "^1.1.9",
|
|
29
29
|
"@lage-run/target-graph": "^0.8.9",
|
|
30
30
|
"@lage-run/hasher": "^1.0.5",
|
|
31
|
-
"@ms-cloudpack/bundler": "^0.17.
|
|
32
|
-
"@ms-cloudpack/bundler-types": "^0.24.
|
|
33
|
-
"@ms-cloudpack/config": "^0.17.
|
|
31
|
+
"@ms-cloudpack/bundler": "^0.17.28",
|
|
32
|
+
"@ms-cloudpack/bundler-types": "^0.24.1",
|
|
33
|
+
"@ms-cloudpack/config": "^0.17.23",
|
|
34
34
|
"@ms-cloudpack/config-types": "^0.4.3",
|
|
35
35
|
"@ms-cloudpack/create-express-app": "^1.4.0",
|
|
36
36
|
"@ms-cloudpack/data-bus": "^0.4.2",
|
|
37
37
|
"@ms-cloudpack/file-watcher": "^0.1.2",
|
|
38
38
|
"@ms-cloudpack/json-utilities": "^0.1.3",
|
|
39
|
-
"@ms-cloudpack/package-hashes": "^0.3.
|
|
40
|
-
"@ms-cloudpack/package-utilities": "^5.8.
|
|
39
|
+
"@ms-cloudpack/package-hashes": "^0.3.20",
|
|
40
|
+
"@ms-cloudpack/package-utilities": "^5.8.3",
|
|
41
41
|
"@ms-cloudpack/path-string-parsing": "^1.1.3",
|
|
42
42
|
"@ms-cloudpack/path-utilities": "^2.5.0",
|
|
43
43
|
"@ms-cloudpack/task-reporter": "^0.11.1",
|