@ms-cloudpack/cli 0.56.1 → 0.56.2
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/commands/bundle/execute.d.ts.map +1 -1
- package/lib/commands/bundle/execute.js +0 -1
- package/lib/commands/bundle/execute.js.map +1 -1
- package/lib/commands/init/index.d.ts.map +1 -1
- package/lib/commands/init/index.js +1 -0
- package/lib/commands/init/index.js.map +1 -1
- package/lib/commands/init/init.d.ts.map +1 -1
- package/lib/commands/init/init.js +6 -0
- package/lib/commands/init/init.js.map +1 -1
- package/lib/commands/init/types/InitOptions.d.ts +2 -0
- package/lib/commands/init/types/InitOptions.d.ts.map +1 -1
- package/lib/commands/init/types/InitOptions.js.map +1 -1
- package/lib/commands/start/types/StartOptions.d.ts +1 -0
- package/lib/commands/start/types/StartOptions.d.ts.map +1 -1
- package/lib/commands/start/types/StartOptions.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,aAAa,CAwEhD,CAAC"}
|
|
@@ -7,7 +7,6 @@ export const execute = async (params) => {
|
|
|
7
7
|
const { package: packageArg } = options;
|
|
8
8
|
const { config, telemetryClient } = await initialize({
|
|
9
9
|
appPath,
|
|
10
|
-
overrideOptions: { debug: !process.env.JEST_WORKER_ID },
|
|
11
10
|
});
|
|
12
11
|
const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;
|
|
13
12
|
const [ctx] = autoDispose(await createPartialApiContext({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE9E,MAAM,CAAC,MAAM,OAAO,GAAiC,KAAK,EAAE,MAAM,EAAE,EAAE;IACpE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAClF,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,UAAU,CAAC;QACnD,OAAO;
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE9E,MAAM,CAAC,MAAM,OAAO,GAAiC,KAAK,EAAE,MAAM,EAAE,EAAE;IACpE,MAAM,EAAE,GAAG,E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AE,IAAI;YACjB,aAAa,EAAE,KAAK;SACrB;QACD,GAAG;KACJ,CAAC,CAAC;IACH,MAAM,IAAI,CAAC;QACT,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\nimport { createPartialApiContext, ensurePackageBundled } from '@ms-cloudpack/api-server/apis';\nimport path from 'path';\nimport { bulletedList, formatPackageName } from '@ms-cloudpack/task-reporter';\n\nexport const execute: CommandAction<BundleOptions> = async (params) => {\n const { cwd: appPath, options, reporter, initialize, exit, autoDispose } = params;\n const { package: packageArg } = options;\n const { config, telemetryClient } = await initialize({\n appPath,\n });\n\n const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;\n\n const [ctx] = autoDispose(\n await createPartialApiContext({\n appPath,\n config,\n reporter,\n telemetryClient,\n items: ['packages', 'watcher', 'session', 'taskRunner', 'bus', 'packageImportPaths', 'packageHashes'],\n }),\n );\n\n let packagePath = appPath;\n\n if (packageArg) {\n let packageName = packageArg;\n let version: string | undefined;\n\n const versionSeparatorIndex = packageName.lastIndexOf('@');\n\n if (versionSeparatorIndex > 0) {\n packageName = packageArg.substring(0, versionSeparatorIndex);\n version = packageArg.substring(versionSeparatorIndex + 1);\n }\n const { resolveMap } = ctx.session;\n const entry = findResolveMapEntry({ packageName, version, resolveMap });\n const versions = [resolveMap[packageName].version, ...Object.keys(resolveMap[packageName].scopedVersions || {})];\n\n if (entry) {\n if (!version && versions.length > 1) {\n // Error out if there are multiple versions available and no version was specified.\n await exit({\n message: `Package \"${packageName}\" has multiple versions available, specify one of the following:\\n${bulletedList(versions.map((v) => formatPackageName({ name: packageName, version: v })))}`,\n exitCode: 1,\n });\n }\n\n packagePath = entry.path;\n console.log(`Package ${formatPackageName({ name: packageName, version: entry.version })} found: ${entry.path}`);\n } else {\n await exit({\n message: `Package \"${packageArg}\" couldn't be found.`,\n exitCode: 1,\n });\n\n return;\n }\n }\n\n const definition = await ctx.packages.get(packagePath);\n const { result } = await ensurePackageBundled({\n input: {\n name: definition?.name ?? '<unknown>',\n version: definition?.version ?? '0.0.0',\n outputPath: path.resolve(packagePath, outdir),\n bundlerType,\n disableSourceMaps,\n shouldForce: true,\n isIncremental: false,\n },\n ctx,\n });\n await exit({\n exitCode: result?.errors?.length === 0 ? 0 : 1,\n });\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,mBAgBlB,CAAC"}
|
|
@@ -5,6 +5,7 @@ export const init = (program) => {
|
|
|
5
5
|
name: 'init',
|
|
6
6
|
description: 'Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.',
|
|
7
7
|
options: {
|
|
8
|
+
logResolveMap: new Option('--log-resolve-map', 'Logs the resolve map to "resolve-map.json" for diagnostics.'),
|
|
8
9
|
reset: new Option('--reset', 'Ignores existing overrides when determining all entries.'),
|
|
9
10
|
check: new Option('--check', 'Fails if any package exports are missing.'),
|
|
10
11
|
match: new Option('--match <name><@version>', 'Only evaluate a specific package match. This can be a partial match. (e.g. @ms-cloudpack/)'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,aAAa,CAAc;QACjC,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,sIAAsI;QACxI,OAAO,EAAE;YACP,KAAK,EAAE,IAAI,MAAM,CAAC,SAAS,EAAE,0DAA0D,CAAC;YACxF,KAAK,EAAE,IAAI,MAAM,CAAC,SAAS,EAAE,2CAA2C,CAAC;YACzE,KAAK,EAAE,IAAI,MAAM,CACf,0BAA0B,EAC1B,4FAA4F,CAC7F;SACF;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { InitOptions } from './types/InitOptions.js';\n\n/** Defines the \"init\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<InitOptions>({\n name: 'init',\n description:\n 'Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.',\n options: {\n reset: new Option('--reset', 'Ignores existing overrides when determining all entries.'),\n check: new Option('--check', 'Fails if any package exports are missing.'),\n match: new Option(\n '--match <name><@version>',\n 'Only evaluate a specific package match. This can be a partial match. (e.g. @ms-cloudpack/)',\n ),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,aAAa,CAAc;QACjC,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,sIAAsI;QACxI,OAAO,EAAE;YACP,aAAa,EAAE,IAAI,MAAM,CAAC,mBAAmB,EAAE,6DAA6D,CAAC;YAC7G,KAAK,EAAE,IAAI,MAAM,CAAC,SAAS,EAAE,0DAA0D,CAAC;YACxF,KAAK,EAAE,IAAI,MAAM,CAAC,SAAS,EAAE,2CAA2C,CAAC;YACzE,KAAK,EAAE,IAAI,MAAM,CACf,0BAA0B,EAC1B,4FAA4F,CAC7F;SACF;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { InitOptions } from './types/InitOptions.js';\n\n/** Defines the \"init\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<InitOptions>({\n name: 'init',\n description:\n 'Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.',\n options: {\n logResolveMap: new Option('--log-resolve-map', 'Logs the resolve map to \"resolve-map.json\" for diagnostics.'),\n reset: new Option('--reset', 'Ignores existing overrides when determining all entries.'),\n check: new Option('--check', 'Fails if any package exports are missing.'),\n match: new Option(\n '--match <name><@version>',\n 'Only evaluate a specific package match. This can be a partial match. (e.g. @ms-cloudpack/)',\n ),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAQ1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAQ1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAIhE;;GAEG;AACH,wBAAsB,IAAI,CAAC,UAAU,EAAE;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;CACxB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAgIzB"}
|
|
@@ -4,6 +4,8 @@ import { bold, bulletedList, formatPackageName, plural } from '@ms-cloudpack/tas
|
|
|
4
4
|
import { InitSummaryData } from './InitSummaryData.js';
|
|
5
5
|
import { evaluatePath } from './evaluatePath.js';
|
|
6
6
|
import { verifyExports } from './verifyExports.js';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { writeJson } from '@ms-cloudpack/json-utilities';
|
|
7
9
|
/**
|
|
8
10
|
* Init execution function.
|
|
9
11
|
*/
|
|
@@ -106,6 +108,10 @@ export async function init(parameters) {
|
|
|
106
108
|
sortExportKeys(config.generated);
|
|
107
109
|
await writeGeneratedConfig(config.generated, appPath);
|
|
108
110
|
}
|
|
111
|
+
if (options.logResolveMap) {
|
|
112
|
+
reporter.log('\nWriting resolve map to `resolve-map.json`.');
|
|
113
|
+
await writeJson(path.join(appPath, 'resolve-map.json'), resolveMap);
|
|
114
|
+
}
|
|
109
115
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AAC,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,eAAe,GAAG,EAAE,EAAmB;IAC/D,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,SAAS;QACX,CAAC;QAED,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAmC,CAAC;QAErE,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC;aACzB,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CACvC,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type { Context, TaskRunner } from '@ms-cloudpack/api-server';\nimport type { GeneratedConfig, PackageJsonExportsObject } from '@ms-cloudpack/config-types';\nimport type { PackageImporterContext } from '@ms-cloudpack/bundler-types';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { AutoDispose } from '../../types/AutoDispose.js';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { InitSummary } from './types/InitSummary.js';\n\nimport { createPartialApiContext } from '@ms-cloudpack/api-server/apis';\nimport { writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { bold, bulletedList, formatPackageName, plural } from '@ms-cloudpack/task-reporter';\nimport { InitSummaryData } from './InitSummaryData.js';\nimport { evaluatePath } from './evaluatePath.js';\nimport { verifyExports } from './verifyExports.js';\nimport type { InitContext } from '../../types/CommandAction.js';\n\n/**\n * Init execution function.\n */\nexport async function init(parameters: {\n options: InitOptions;\n contexts: InitContext[];\n autoDispose: AutoDispose;\n reporter: TaskReporter;\n}): Promise<InitSummary[]> {\n const { options, contexts, reporter, autoDispose } = parameters;\n\n const summaries = [];\n\n let taskRunner: TaskRunner | undefined = undefined;\n\n for (const initContext of contexts) {\n const { appPath, config, telemetryClient } = initContext;\n\n // Don't allow --check and --reset together.\n if (options.check && options.reset) {\n throw Error('Cannot use --check and --reset together.');\n }\n\n // If --reset is specified, reset the generated config.\n if (options.reset) {\n config.generated = {};\n }\n\n const apiContext: Context = await createPartialApiContext({\n appPath,\n config,\n reporter,\n telemetryClient,\n items: ['bus', 'taskRunner', 'watcher', 'packages', 'session', 'packageImportPaths', 'packageHashes'],\n taskRunner,\n });\n taskRunner ??= apiContext.taskRunner;\n autoDispose(apiContext);\n const resolveMap = apiContext.session.resolveMap;\n\n // Ensure config.generated.packageSettings is initialized.\n config.generated.packageSettings ??= [];\n\n const summaryData = new InitSummaryData(appPath);\n\n await new Promise<void>((resolve, reject) => {\n let pending = 0;\n let isExitingPrematurely = false;\n const visitedSet = new Set<string>();\n const refreshPaths = new Set<string>();\n\n // Start with the app path or requested matches\n enqueuePaths(getInitialPaths({ appPath, match: options.match, resolveMap, reporter }));\n\n /**\n * Enqueue more paths.\n * @param newPaths Mapping from package path to importer context.\n */\n function enqueuePaths(newPaths: Map<string, PackageImporterContext | undefined>) {\n if (isExitingPrematurely) {\n return;\n }\n\n // Iterate through the given paths.\n for (const [packagePath, importerContext] of newPaths) {\n if (visitedSet.has(packagePath)) {\n continue;\n }\n\n const shouldForce = refreshPaths.delete(packagePath);\n\n visitedSet.add(packagePath);\n pending++;\n\n // Evaluate this path, but don't await - when we're done, we'll re-enqueue newly discovered paths.\n evaluatePath({\n packagePath,\n importerContext,\n config,\n telemetryClient,\n resolveMap,\n shouldForce,\n initOptions: options,\n summaryData,\n ctx: apiContext,\n })\n .then(({ pathsToEvaluate, pathsToRefresh, shouldExit }) => {\n pending--;\n\n if (shouldExit) {\n isExitingPrematurely = true;\n } else if (pathsToEvaluate?.size && !options.match) {\n // If there are paths that need to be rebuilt, add them to the refresh set so that on re-enqueuing\n // we pass the `shouldRerun` flag through\n pathsToRefresh?.forEach((refreshPath) => {\n refreshPaths.add(refreshPath);\n visitedSet.delete(refreshPath);\n });\n\n // Try to enqueue the new paths.\n enqueuePaths(pathsToEvaluate);\n }\n\n // If nothing is pending after this call, we're complete.\n if (!pending) {\n resolve();\n }\n })\n .catch((error) => {\n reject(error);\n });\n }\n }\n });\n\n if (config.features?.verifyExports) {\n const warnings = verifyExports(summaryData.getResults(), resolveMap);\n warnings.forEach((warning) => summaryData.recordResult({ packageResult: warning, append: true }));\n }\n\n const summary = summaryData.summarize(options);\n summaries.push(summary);\n\n if (!options.check && summary.totalChanges && config.generated.packageSettings?.length) {\n sortExportKeys(config.generated);\n\n await writeGeneratedConfig(config.generated, appPath);\n }\n }\n\n return summaries;\n}\n\n/**\n * Get initial package paths to process: either the app path, or packages matching `match` in the init options.\n */\nfunction getInitialPaths(params: {\n appPath: string;\n /** Only evaluate packages matching this string (from init options). */\n match: string | undefined;\n resolveMap: ResolveMap;\n reporter: TaskReporter;\n}): Map<string, PackageImporterContext | undefined> {\n const { appPath, match, resolveMap, reporter } = params;\n\n if (!match) {\n return new Map([[appPath, undefined]]);\n }\n\n // Find matching packages in the resolve map\n const resolveMapEntries = Object.values(resolveMap).filter((entry) => entry.name.includes(match));\n\n reporter.log(\n `\\nFound ${plural(resolveMapEntries.length, 'package')} matching \"${bold(match)}\":\\n`,\n bulletedList(resolveMapEntries.map((entry) => `${formatPackageName(entry)}: ${entry.path}`)),\n );\n\n return new Map(resolveMapEntries.map((entry) => [entry.path, undefined]));\n}\n\nfunction sortExportKeys({ packageSettings = [] }: GeneratedConfig) {\n for (const settings of packageSettings) {\n if (!settings.exports) {\n continue;\n }\n\n const unsortedExports = settings.exports as PackageJsonExportsObject;\n\n settings.exports = Object.fromEntries(\n Object.keys(unsortedExports)\n .sort()\n .map((k) => [k, unsortedExports[k]]),\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,uBAAuB,EAAE,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;IAEF,OAAO,IAAI,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,eAAe,GAAG,EAAE,EAAmB;IAC/D,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,SAAS;QACX,CAAC;QAED,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAmC,CAAC;QAErE,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC;aACzB,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CACvC,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type { Context, TaskRunner } from '@ms-cloudpack/api-server';\nimport type { GeneratedConfig, PackageJsonExportsObject } from '@ms-cloudpack/config-types';\nimport type { PackageImporterContext } from '@ms-cloudpack/bundler-types';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { AutoDispose } from '../../types/AutoDispose.js';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { InitSummary } from './types/InitSummary.js';\n\nimport { createPartialApiContext } from '@ms-cloudpack/api-server/apis';\nimport { writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { bold, bulletedList, formatPackageName, plural } from '@ms-cloudpack/task-reporter';\nimport { InitSummaryData } from './InitSummaryData.js';\nimport { evaluatePath } from './evaluatePath.js';\nimport { verifyExports } from './verifyExports.js';\nimport type { InitContext } from '../../types/CommandAction.js';\nimport path from 'path';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\n\n/**\n * Init execution function.\n */\nexport async function init(parameters: {\n options: InitOptions;\n contexts: InitContext[];\n autoDispose: AutoDispose;\n reporter: TaskReporter;\n}): Promise<InitSummary[]> {\n const { options, contexts, reporter, autoDispose } = parameters;\n\n const summaries = [];\n\n let taskRunner: TaskRunner | undefined = undefined;\n\n for (const initContext of contexts) {\n const { appPath, config, telemetryClient } = initContext;\n\n // Don't allow --check and --reset together.\n if (options.check && options.reset) {\n throw Error('Cannot use --check and --reset together.');\n }\n\n // If --reset is specified, reset the generated config.\n if (options.reset) {\n config.generated = {};\n }\n\n const apiContext: Context = await createPartialApiContext({\n appPath,\n config,\n reporter,\n telemetryClient,\n items: ['bus', 'taskRunner', 'watcher', 'packages', 'session', 'packageImportPaths', 'packageHashes'],\n taskRunner,\n });\n taskRunner ??= apiContext.taskRunner;\n autoDispose(apiContext);\n const resolveMap = apiContext.session.resolveMap;\n\n // Ensure config.generated.packageSettings is initialized.\n config.generated.packageSettings ??= [];\n\n const summaryData = new InitSummaryData(appPath);\n\n await new Promise<void>((resolve, reject) => {\n let pending = 0;\n let isExitingPrematurely = false;\n const visitedSet = new Set<string>();\n const refreshPaths = new Set<string>();\n\n // Start with the app path or requested matches\n enqueuePaths(getInitialPaths({ appPath, match: options.match, resolveMap, reporter }));\n\n /**\n * Enqueue more paths.\n * @param newPaths Mapping from package path to importer context.\n */\n function enqueuePaths(newPaths: Map<string, PackageImporterContext | undefined>) {\n if (isExitingPrematurely) {\n return;\n }\n\n // Iterate through the given paths.\n for (const [packagePath, importerContext] of newPaths) {\n if (visitedSet.has(packagePath)) {\n continue;\n }\n\n const shouldForce = refreshPaths.delete(packagePath);\n\n visitedSet.add(packagePath);\n pending++;\n\n // Evaluate this path, but don't await - when we're done, we'll re-enqueue newly discovered paths.\n evaluatePath({\n packagePath,\n importerContext,\n config,\n telemetryClient,\n resolveMap,\n shouldForce,\n initOptions: options,\n summaryData,\n ctx: apiContext,\n })\n .then(({ pathsToEvaluate, pathsToRefresh, shouldExit }) => {\n pending--;\n\n if (shouldExit) {\n isExitingPrematurely = true;\n } else if (pathsToEvaluate?.size && !options.match) {\n // If there are paths that need to be rebuilt, add them to the refresh set so that on re-enqueuing\n // we pass the `shouldRerun` flag through\n pathsToRefresh?.forEach((refreshPath) => {\n refreshPaths.add(refreshPath);\n visitedSet.delete(refreshPath);\n });\n\n // Try to enqueue the new paths.\n enqueuePaths(pathsToEvaluate);\n }\n\n // If nothing is pending after this call, we're complete.\n if (!pending) {\n resolve();\n }\n })\n .catch((error) => {\n reject(error);\n });\n }\n }\n });\n\n if (config.features?.verifyExports) {\n const warnings = verifyExports(summaryData.getResults(), resolveMap);\n warnings.forEach((warning) => summaryData.recordResult({ packageResult: warning, append: true }));\n }\n\n const summary = summaryData.summarize(options);\n summaries.push(summary);\n\n if (!options.check && summary.totalChanges && config.generated.packageSettings?.length) {\n sortExportKeys(config.generated);\n\n await writeGeneratedConfig(config.generated, appPath);\n }\n\n if (options.logResolveMap) {\n reporter.log('\\nWriting resolve map to `resolve-map.json`.');\n await writeJson(path.join(appPath, 'resolve-map.json'), resolveMap);\n }\n }\n\n return summaries;\n}\n\n/**\n * Get initial package paths to process: either the app path, or packages matching `match` in the init options.\n */\nfunction getInitialPaths(params: {\n appPath: string;\n /** Only evaluate packages matching this string (from init options). */\n match: string | undefined;\n resolveMap: ResolveMap;\n reporter: TaskReporter;\n}): Map<string, PackageImporterContext | undefined> {\n const { appPath, match, resolveMap, reporter } = params;\n\n if (!match) {\n return new Map([[appPath, undefined]]);\n }\n\n // Find matching packages in the resolve map\n const resolveMapEntries = Object.values(resolveMap).filter((entry) => entry.name.includes(match));\n\n reporter.log(\n `\\nFound ${plural(resolveMapEntries.length, 'package')} matching \"${bold(match)}\":\\n`,\n bulletedList(resolveMapEntries.map((entry) => `${formatPackageName(entry)}: ${entry.path}`)),\n );\n\n return new Map(resolveMapEntries.map((entry) => [entry.path, undefined]));\n}\n\nfunction sortExportKeys({ packageSettings = [] }: GeneratedConfig) {\n for (const settings of packageSettings) {\n if (!settings.exports) {\n continue;\n }\n\n const unsortedExports = settings.exports as PackageJsonExportsObject;\n\n settings.exports = Object.fromEntries(\n Object.keys(unsortedExports)\n .sort()\n .map((k) => [k, unsortedExports[k]]),\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
1
|
+
{"version":3,"file":"InitOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitOptions.js","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Defines the options for the \"init\" command.\n */\nexport interface InitOptions {\n /**\n * Whether to ignore existing overrides when determining all entries.\n */\n reset?: boolean;\n\n /**\n * Whether to fail on missing exports.\n */\n check?: boolean;\n\n /**\n * Only evaluate packages matching this string (e.g. `@ms-cloudpack/`).\n */\n match?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InitOptions.js","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Defines the options for the \"init\" command.\n */\nexport interface InitOptions {\n /** Writes the resolve map to `resolve-map.json`. */\n logResolveMap?: boolean;\n\n /**\n * Whether to ignore existing overrides when determining all entries.\n */\n reset?: boolean;\n\n /**\n * Whether to fail on missing exports.\n */\n check?: boolean;\n\n /**\n * Only evaluate packages matching this string (e.g. `@ms-cloudpack/`).\n */\n match?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StartOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
|
1
|
+
{"version":3,"file":"StartOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StartOptions.js","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface StartOptions {\n logResolveMap?: boolean;\n app?: string;\n /** Whether to open the browser (default true) */\n open?: boolean;\n /** Whether to use the cache on first request (default true) */\n cache?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"StartOptions.js","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface StartOptions {\n /** Writes the resolve map to `resolve-map.json`. */\n logResolveMap?: boolean;\n app?: string;\n /** Whether to open the browser (default true) */\n open?: boolean;\n /** Whether to use the cache on first request (default true) */\n cache?: boolean;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
|
-
"version": "0.56.
|
|
3
|
+
"version": "0.56.2",
|
|
4
4
|
"description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
"cloudpack": "./bin/cloudpack.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@ms-cloudpack/api-server": "^0.31.
|
|
14
|
-
"@ms-cloudpack/bundle-server": "^0.2.
|
|
15
|
-
"@ms-cloudpack/config": "^0.17.
|
|
16
|
-
"@ms-cloudpack/config-types": "^0.5.
|
|
13
|
+
"@ms-cloudpack/api-server": "^0.31.2",
|
|
14
|
+
"@ms-cloudpack/bundle-server": "^0.2.26",
|
|
15
|
+
"@ms-cloudpack/config": "^0.17.30",
|
|
16
|
+
"@ms-cloudpack/config-types": "^0.5.1",
|
|
17
17
|
"@ms-cloudpack/feature-flags": "^0.0.2",
|
|
18
18
|
"@ms-cloudpack/json-utilities": "^0.1.4",
|
|
19
|
-
"@ms-cloudpack/package-utilities": "^5.10.
|
|
19
|
+
"@ms-cloudpack/package-utilities": "^5.10.5",
|
|
20
20
|
"@ms-cloudpack/path-string-parsing": "^1.1.3",
|
|
21
21
|
"@ms-cloudpack/path-utilities": "^2.5.0",
|
|
22
22
|
"@ms-cloudpack/remote-cache": "^0.5.0",
|
|
23
|
-
"@ms-cloudpack/app-server": "^0.1.
|
|
23
|
+
"@ms-cloudpack/app-server": "^0.1.29",
|
|
24
24
|
"@ms-cloudpack/task-reporter": "^0.11.1",
|
|
25
25
|
"@ms-cloudpack/telemetry": "^0.4.6",
|
|
26
26
|
"@yarnpkg/lockfile": "^1.1.0",
|