@ms-cloudpack/cli 0.31.0 → 0.31.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.
Files changed (72) hide show
  1. package/lib/cloudpack.js.map +1 -1
  2. package/lib/commands/bundle/bundle.js.map +1 -1
  3. package/lib/commands/bundle/index.js.map +1 -1
  4. package/lib/commands/bundle/types.js.map +1 -1
  5. package/lib/commands/dashboard/index.js.map +1 -1
  6. package/lib/commands/init/evaluateImportsForOverrides.js.map +1 -1
  7. package/lib/commands/init/findImports.js.map +1 -1
  8. package/lib/commands/init/findImports.test.js.map +1 -1
  9. package/lib/commands/init/getImportsFromBundle.js.map +1 -1
  10. package/lib/commands/init/index.js.map +1 -1
  11. package/lib/commands/init/init.js.map +1 -1
  12. package/lib/commands/init/init.test.js.map +1 -1
  13. package/lib/commands/init/patchAllInternalPackageExports.js.map +1 -1
  14. package/lib/commands/init/patchPackageExports.js.map +1 -1
  15. package/lib/commands/init/preparePackageOverride.js.map +1 -1
  16. package/lib/commands/init/types.js.map +1 -1
  17. package/lib/commands/start/TaskRunner.js.map +1 -1
  18. package/lib/commands/start/addOverride.js.map +1 -1
  19. package/lib/commands/start/addOverride.test.js.map +1 -1
  20. package/lib/commands/start/appServer/createRoutes.js +2 -1
  21. package/lib/commands/start/appServer/createRoutes.js.map +1 -1
  22. package/lib/commands/start/appServer/error.js.map +1 -1
  23. package/lib/commands/start/appServer/exitIfPortUnavailable.js.map +1 -1
  24. package/lib/commands/start/appServer/getDefaultHtmlResponse.js.map +1 -1
  25. package/lib/commands/start/appServer/getHtmlResponse.js +1 -3
  26. package/lib/commands/start/appServer/getHtmlResponse.js.map +1 -1
  27. package/lib/commands/start/appServer/handleSessionVersion.js.map +1 -1
  28. package/lib/commands/start/appServer/inlineScripts/errorHandler.inline.d.ts +10 -0
  29. package/lib/commands/start/appServer/inlineScripts/errorHandler.inline.js +18 -0
  30. package/lib/commands/start/appServer/inlineScripts/errorHandler.inline.js.map +1 -0
  31. package/lib/commands/start/appServer/inlineScripts/getInlineScripts.d.ts +1 -0
  32. package/lib/commands/start/appServer/inlineScripts/getInlineScripts.js +15 -0
  33. package/lib/commands/start/appServer/inlineScripts/getInlineScripts.js.map +1 -0
  34. package/lib/commands/start/appServer/log.js.map +1 -1
  35. package/lib/commands/start/appServer/setHeaders.js.map +1 -1
  36. package/lib/commands/start/appServer/startAppServer.js.map +1 -1
  37. package/lib/commands/start/createBundleTask.js.map +1 -1
  38. package/lib/commands/start/createSession.js.map +1 -1
  39. package/lib/commands/start/createSession.test.js.map +1 -1
  40. package/lib/commands/start/index.js.map +1 -1
  41. package/lib/commands/start/openBrowser.js.map +1 -1
  42. package/lib/commands/start/parseRequestInfo.js.map +1 -1
  43. package/lib/commands/start/parseRequestInfo.test.js.map +1 -1
  44. package/lib/commands/start/start.js.map +1 -1
  45. package/lib/commands/start/startApiServer.js.map +1 -1
  46. package/lib/commands/start/startBundleServer.js.map +1 -1
  47. package/lib/commands/start/startWatcher.js.map +1 -1
  48. package/lib/commands/start/taskRunner.test.js.map +1 -1
  49. package/lib/commands/start/types.js.map +1 -1
  50. package/lib/commands/start/validateOverride.js.map +1 -1
  51. package/lib/commands/start/validateOverride.test.js.map +1 -1
  52. package/lib/common/config.js.map +1 -1
  53. package/lib/common/configTemplate.js.map +1 -1
  54. package/lib/common/createPackageOverrideTransform.js.map +1 -1
  55. package/lib/common/findPackageOverride.js.map +1 -1
  56. package/lib/common/getBundleDetails.js.map +1 -1
  57. package/lib/common/getCachePath.js.map +1 -1
  58. package/lib/common/prepareOutputPath.js.map +1 -1
  59. package/lib/getVersion.js.map +1 -1
  60. package/lib/index.js.map +1 -1
  61. package/lib/initTelemetry.js.map +1 -1
  62. package/lib/performance/markers.js.map +1 -1
  63. package/lib/performance/registerPerformanceObservers.js.map +1 -1
  64. package/lib/reporter.js.map +1 -1
  65. package/lib/tasks/bundleTask.js.map +1 -1
  66. package/lib/tasks/formatBundleErrors.js.map +1 -1
  67. package/lib/tasks/resolveDependenciesTask.js.map +1 -1
  68. package/lib/types.js.map +1 -1
  69. package/package.json +4 -4
  70. package/lib/commands/start/appServer/inlineScripts.d.ts +0 -1
  71. package/lib/commands/start/appServer/inlineScripts.js +0 -12
  72. package/lib/commands/start/appServer/inlineScripts.js.map +0 -1
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ImportMap, ResolveMap } from '@ms-cloudpack/package-utilities';\nimport type { BundleResult, PackageJson, PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { HttpsConfig } from '@ms-cloudpack/create-express-app';\n\nexport interface Session {\n /**\n * The session id, used for identifying\n */\n id: string;\n\n /**\n * The primary application path to monitor.\n */\n appPath: string;\n\n /**\n * The type of session controls how the code is served via start.\n * Web apps require app server and asset hosting, while libraries\n * only need a bundle service.\n */\n type: 'web-app' | 'library';\n\n /**\n * The mode of the session controls how the code is bundled. Library\n * mode bundles each package in isolation, while development and\n * production modes bundle the full app graph together. Library\n * mode is fastest but packages must be complaint for loading in\n * the browser.\n */\n mode: 'library' | 'development' | 'production';\n\n /**\n * Used to resolve packages in the dependency graph.\n */\n resolveMap: ResolveMap;\n\n /**\n * Reload sequence to ensure that the client is always\n * up to date with the latest changes.\n */\n sequence: number;\n\n /**\n * Get session version.\n * Used to force a hard refresh on the client.\n */\n getSessionVersion: () => number;\n\n /**\n * Used to increment the session version.\n * If version is undefined, the version will be incremented by 1.\n * If version is greater than the current version, the version will be set to the new value.\n */\n incrementSessionVersion: (version?: number) => void;\n\n /**\n * The name of the project folder.\n * Used to differentiate between multiple projects.\n */\n projectName: string;\n\n /**\n * The version of each target.\n * Used to force a client cache refresh on a single target.\n */\n targetVersions: Record<string, number>;\n\n /**\n * Increments the version for the given target.\n */\n incrementTargetVersion: (inputPath: string) => void;\n\n /**\n * The import map for the session.\n */\n getImportMap: () => ImportMap | undefined;\n\n setImportMap: (newImportMap: ImportMap) => ImportMap;\n}\n\n/**\n * Tracks a given bundle request and its result.\n */\nexport interface BundleRequest {\n id: string;\n packageName: string;\n version: string;\n packagePath: string;\n outputPath: string;\n isExternal: boolean;\n bundlerType?: string;\n result?: BundleResult;\n resultFromCache?: boolean;\n isRebuildRequired?: boolean;\n packages?: PackageDefinitionsCache;\n}\n\nexport interface BundleTaskOptions {\n force?: boolean;\n}\n\nexport interface BundleServer {\n url: string;\n port: number;\n close: () => Promise<void>;\n}\n\nexport interface SessionStats {\n status: 'idle' | 'pending';\n\n remainingTasks: number;\n totalTasks: number;\n\n totalErrors: number;\n totalWarnings: number;\n}\n\nexport interface ApiServer {\n url: string;\n port: number;\n\n notifyReload: () => void;\n\n addTask: <TReturn>(task: Task<TReturn>, options?: TaskOptions) => Promise<TReturn>;\n\n close: () => Promise<void>;\n}\n\nexport interface Watcher {\n watch: (bundleRequest: BundleRequest) => void;\n}\n\nexport interface TaskError {\n message: string;\n pluginName: string;\n stack: string;\n fileLocation: string;\n lineNumber: number;\n columnNumber: number;\n}\n\nexport interface TaskStartDescription {\n id: string;\n name?: string;\n inputPath?: string;\n outputPath?: string;\n}\n\nexport interface TaskEndDescription {\n id: string;\n errors?: TaskError[];\n warnings?: TaskError[];\n}\n\nexport interface TaskDescription extends TaskStartDescription, TaskEndDescription {\n status: 'pending' | 'complete';\n startTime: number;\n durationMilliseconds?: number;\n lastUpdated?: number;\n}\n\nexport interface Task<TReturn> {\n name: string;\n id: string;\n dir?: string;\n execute: () => Promise<TReturn | undefined>;\n clear?: () => void;\n watch?: boolean;\n dispose?: () => Promise<void>;\n onDispose?: () => void;\n getErrors?: () => TaskError[] | undefined;\n getStartDescription?: () => TaskStartDescription;\n getEndDescription?: (result: TReturn | undefined) => TaskEndDescription;\n}\n\nexport interface TaskOptions {\n rerun?: boolean;\n watch?: () => void;\n}\n\nexport interface PackageOverride {\n name: string;\n versionRequirement: string;\n isInternal?: boolean;\n overrides: PackageJson;\n}\n\nexport interface Route {\n /**\n * The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also\n * use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n */\n match: string;\n\n /**\n * The path relative to the app root to static assets. If this is provided, renderScript/exportEntry\n * will be ignored.\n */\n staticPath?: string;\n\n /**\n * Path to a .js or .html file used for rendering the route. If a script is provided, it must\n * export a default function implementing `CreateHtmlFunction` defined in `@ms-cloudpack/cli`.\n */\n renderScript?: string;\n\n /**\n * The key in the exports map which represents the entry point app script for this route.\n * Default is '.', meaning the main package export key.\n */\n exportEntry?: string;\n}\n\nexport interface DevServer {\n /**\n * The domain name of the server.\n */\n domain?: string;\n\n /**\n * The ports to be used by the server.\n * It can be a number or an array of numbers.\n * If ports are provided, an error will be thrown if none are available.\n * If no ports are provided, the server will attempt to find an available port.\n */\n port?: number | number[];\n\n /**\n * The config settings for the https server.\n * Paths to files are accepted for 'ca', 'cert', 'key', and 'pfx' settings.\n * Everything else is passed directly to the https.createServer() method.\n * If not provided, the server will use http.\n */\n https?: HttpsConfig;\n\n /**\n * If provided, will override where the publicDir is located, relative to the app package folder.\n * Defaults to `./public`. The same thing can be achieved with `routes`, using route: '*' and\n * staticPath: './public', so the `publicPath` setting may be removed in the future.\n */\n publicPath?: string;\n\n /**\n * If provided, will register routes with the dev server to host various pages.\n */\n routes?: Route[];\n}\n\nexport interface TelemetryConfig {\n /**\n * Application Insights instrumentation key.\n */\n instrumentationKey: string;\n}\n\n/**\n * Per-application configuration for Cloudpack.\n */\nexport interface CloudpackConfig {\n /**\n * An array of PackageOverride objects, used to provide overrides for packages without modifying their\n * definitions directly. This is primarily used for providing exports maps for packages that don't have them.\n */\n packageOverrides?: PackageOverride[];\n\n /**\n * A set of options for configuring how the dev server works.\n */\n devServer?: DevServer;\n\n /**\n * A set of options for configuring telemetry\n */\n telemetry?: TelemetryConfig;\n}\n\n/**\n * The input options for a createHtml custom server render function.\n */\nexport type CreateHtmlOptions = {\n session: Session;\n route: Route;\n baseUrl: string;\n definition: PackageJson;\n importMap: ImportMap;\n overlayScript: string | undefined;\n entryScript: string | undefined;\n inlineScripts: string[];\n};\n\n/**\n * The expected result of the createHtml custom server render function.\n */\nexport type CreateHtmlResult =\n | string\n | {\n html: string;\n statusCode: number;\n };\n\n/**\n * A custom server render function that can be used to override the default HTML response.\n */\nexport type CreateHtmlFunction = (options: CreateHtmlOptions) => Promise<CreateHtmlResult> | CreateHtmlResult;\n\n/**\n * The expected shape of the createHtml custom server render function script.\n */\nexport type CreateHtmlScript = { default: CreateHtmlFunction };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.31.0",
3
+ "version": "0.31.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",
@@ -16,15 +16,15 @@
16
16
  "cloudpack": "./bin/cloudpack.js"
17
17
  },
18
18
  "dependencies": {
19
- "@ms-cloudpack/bundler": "^0.11.10",
19
+ "@ms-cloudpack/bundler": "^0.11.12",
20
20
  "@ms-cloudpack/create-express-app": "^1.3.0",
21
21
  "@ms-cloudpack/data-bus": "^0.1.1",
22
22
  "@ms-cloudpack/json-utilities": "^0.0.5",
23
- "@ms-cloudpack/overlay": "^0.12.0",
23
+ "@ms-cloudpack/overlay": "^0.12.1",
24
24
  "@ms-cloudpack/package-utilities": "^2.3.10",
25
25
  "@ms-cloudpack/path-utilities": "^2.1.1",
26
26
  "@ms-cloudpack/path-string-parsing": "^1.0.1",
27
- "@ms-cloudpack/task-reporter": "^0.2.2",
27
+ "@ms-cloudpack/task-reporter": "^0.3.0",
28
28
  "@ms-cloudpack/telemetry": "^0.2.0",
29
29
  "chokidar": "^3.5.3",
30
30
  "commander": "^10.0.0",
@@ -1 +0,0 @@
1
- export declare const inlineScripts: string[];
@@ -1,12 +0,0 @@
1
- /* Scipts to be inlined into all the html files */
2
- export const inlineScripts = [
3
- `window.uncaughtErrors = { errors: [] };
4
- const handleError = (event) => { window.uncaughtErrors.errors.push(event); };
5
- window.addEventListener('error', handleError);
6
- window.uncaughtErrors.unregister = () => window.removeEventListener('error', handleError);`,
7
- `window.uncaughtRejections = { errors: [] };
8
- const handleRejection = (event) => { window.uncaughtRejections.errors.push(event); };
9
- window.addEventListener('unhandledrejection', handleRejection);
10
- window.uncaughtRejections.unregister = () => window.removeEventListener('unhandledrejection', handleRejection);`,
11
- ];
12
- //# sourceMappingURL=inlineScripts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inlineScripts.js","sourceRoot":"","sources":["../../../../src/commands/start/appServer/inlineScripts.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;;;6FAG2F;IAC3F;;;kHAGgH;CACjH,CAAC"}