@ms-cloudpack/app-server 0.20.58 → 0.20.60

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.
@@ -1 +1 @@
1
- {"version":3,"file":"bundleServerEntry.d.ts","sourceRoot":"","sources":["../../../src/renderRoute/ssr/bundleServerEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,2BAA2B,EAAwB,MAAM,0BAA0B,CAAC;AAClG,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAM/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElF;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GAAG;IAChD,oEAAoE;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,wBAAwB,CAAC;CACnD,EACD,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,MAAM,GAAG,4BAA4B,CAAC,CAiEhD"}
1
+ {"version":3,"file":"bundleServerEntry.d.ts","sourceRoot":"","sources":["../../../src/renderRoute/ssr/bundleServerEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,2BAA2B,EAAwB,MAAM,0BAA0B,CAAC;AAClG,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAM/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAElF;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GAAG;IAChD,oEAAoE;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,wBAAwB,CAAC;CACnD,EACD,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,MAAM,GAAG,4BAA4B,CAAC,CAkEhD"}
@@ -27,6 +27,7 @@ export async function bundleServerEntry(options, context) {
27
27
  // In library mode, wait to bundle dependencies until they're requested, since the resolve map
28
28
  // is very likely to include extra deps that are irrelevant for the serverEntry.
29
29
  enqueueDependencies: false,
30
+ shouldGetBundleInfo: config.logBundleInfo,
30
31
  }, context);
31
32
  const { errors, outputPath = '', outputFiles = [] } = response.result;
32
33
  if (errors?.length) {
@@ -1 +1 @@
1
- {"version":3,"file":"bundleServerEntry.js","sourceRoot":"","sources":["../../../src/renderRoute/ssr/bundleServerEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAElG,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAIC,EACD,OAAoC;IAEpC,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,uBAAuB,EAAE,GAAG,OAAO,CAAC;IACzE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IACrC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAEnC,8FAA8F;IAC9F,8FAA8F;IAC9F,iGAAiG;IACjG,kEAAkE;IAClE,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC5F,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CACzC;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C;YAC7B,OAAO,EACL,mFAAmF;gBACnF,iDAAiD;YACnD,QAAQ,EACN,yCAAyC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,IAAI;gBAC1F,gBAAgB,UAAU,IAAI;gBAC9B,iBAAiB;gBACjB,CAAC,WAAW,CAAC,MAAM;oBACjB,CAAC,CAAC,IAAI,GAAG,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,YAAY,CAAC,CAAC,UAAU,IAAI,SAAS,GAAG,CAAC,CAAC;oBACtG,CAAC,CAAC,MAAM,CAAC;SACd,CAAC,CAAC;IACL,CAAC;IAED,2DAA2D;IAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import { type EnsurePackageBundledContext, ensurePackageBundled } from '@ms-cloudpack/api-server';\nimport type { ExpandedRenderFunctionResult } from '@ms-cloudpack/common-types';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport { slash } from '@ms-cloudpack/path-string-parsing';\nimport { sourceToIntermediatePath } from '@ms-cloudpack/path-utilities';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport type { RenderRouteOptions } from '../../types/RenderRouteOptions.js';\nimport type { CustomRenderErrorHandler } from '../getCustomRenderErrorHandler.js';\n\n/**\n * Bundle the `serverEntry` script.\n * @returns Absolute path to the bundled file, or an error response if bundling failed.\n */\nexport async function bundleServerEntry(\n options: Pick<RenderRouteOptions, 'definition'> & {\n /** Absolute path to the original serverEntry file from the route */\n serverEntryPath: string;\n handleCustomRenderError: CustomRenderErrorHandler;\n },\n context: EnsurePackageBundledContext,\n): Promise<string | ExpandedRenderFunctionResult> {\n const { definition, serverEntryPath, handleCustomRenderError } = options;\n const { name, version } = definition;\n const { config } = context.session;\n\n // targetEnvironment: node currently bundles all node or agnostic entries, and implicitly does\n // production bundling. This seems like it could get expensive, but it's probably okay because\n // createPackageSettingsTransform overwrites the package's actual exports with the ones generated\n // from routes, and those will always have environment conditions.\n const isEffectivelyProduction = config.mode === 'production' || !config.features?.enableSSR;\n const response = await ensurePackageBundled(\n {\n name,\n version,\n targetEnvironment: 'node',\n // TODO: This will only watch for changes in the given package, not dependencies.\n // File watching is disabled in production mode for performance.\n shouldWatch: !environmentInfo.isJest && !isEffectivelyProduction,\n // In library mode, wait to bundle dependencies until they're requested, since the resolve map\n // is very likely to include extra deps that are irrelevant for the serverEntry.\n enqueueDependencies: false,\n },\n context,\n );\n const { errors, outputPath = '', outputFiles = [] } = response.result;\n\n if (errors?.length) {\n // The bundle errors will have been logged to the console on bundle task failure,\n // so don't log them again and skip trying to format them for the UI.\n return handleCustomRenderError({\n message: `failed to bundle (see the console for details)`,\n });\n }\n\n // TODO: Issues have been reported with this. Needs investigation and a test...\n let serverEntryOutput = outputFiles.find(\n (f) => f.entryPoint && slash(serverEntryPath) === slash(path.resolve(config.appPath, f.entryPoint)),\n )?.outputPath;\n if (!serverEntryOutput) {\n // No literal match, so try the intermediate path without extension.\n const intermediateServerEntryPath = sourceToIntermediatePath(\n path.relative(config.appPath, serverEntryPath),\n ).replace(/\\.\\w+$/, '');\n serverEntryOutput = outputFiles.find((f) =>\n intermediateServerEntryPath.endsWith(f.outputPath.replace(/\\.\\w+$/, '')),\n )?.outputPath;\n }\n\n if (!serverEntryOutput) {\n return handleCustomRenderError({\n message:\n `- tried to bundle the serverEntry script, but couldn't find a corresponding file ` +\n `in the bundle output (see console for details).`,\n extraLog:\n `Entries (output file to source file): ${JSON.stringify(response.result.entries || {})}\\n` +\n `Output path: ${outputPath}\\n` +\n 'Bundled files: ' +\n (outputFiles.length\n ? '\\n' + bulletedList(outputFiles.map((f) => `${f.outputPath} (entry: ${f.entryPoint || 'unknown'})`))\n : 'none'),\n });\n }\n\n // Translate relative-to-output path into an absolute path.\n return path.resolve(outputPath, server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CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,YAAY,CAAC,CAAC,UAAU,IAAI,SAAS,GAAG,CAAC,CAAC;oBACtG,CAAC,CAAC,MAAM,CAAC;SACd,CAAC,CAAC;IACL,CAAC;IAED,2DAA2D;IAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import { type EnsurePackageBundledContext, ensurePackageBundled } from '@ms-cloudpack/api-server';\nimport type { ExpandedRenderFunctionResult } from '@ms-cloudpack/common-types';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport { slash } from '@ms-cloudpack/path-string-parsing';\nimport { sourceToIntermediatePath } from '@ms-cloudpack/path-utilities';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport type { RenderRouteOptions } from '../../types/RenderRouteOptions.js';\nimport type { CustomRenderErrorHandler } from '../getCustomRenderErrorHandler.js';\n\n/**\n * Bundle the `serverEntry` script.\n * @returns Absolute path to the bundled file, or an error response if bundling failed.\n */\nexport async function bundleServerEntry(\n options: Pick<RenderRouteOptions, 'definition'> & {\n /** Absolute path to the original serverEntry file from the route */\n serverEntryPath: string;\n handleCustomRenderError: CustomRenderErrorHandler;\n },\n context: EnsurePackageBundledContext,\n): Promise<string | ExpandedRenderFunctionResult> {\n const { definition, serverEntryPath, handleCustomRenderError } = options;\n const { name, version } = definition;\n const { config } = context.session;\n\n // targetEnvironment: node currently bundles all node or agnostic entries, and implicitly does\n // production bundling. This seems like it could get expensive, but it's probably okay because\n // createPackageSettingsTransform overwrites the package's actual exports with the ones generated\n // from routes, and those will always have environment conditions.\n const isEffectivelyProduction = config.mode === 'production' || !config.features?.enableSSR;\n const response = await ensurePackageBundled(\n {\n name,\n version,\n targetEnvironment: 'node',\n // TODO: This will only watch for changes in the given package, not dependencies.\n // File watching is disabled in production mode for performance.\n shouldWatch: !environmentInfo.isJest && !isEffectivelyProduction,\n // In library mode, wait to bundle dependencies until they're requested, since the resolve map\n // is very likely to include extra deps that are irrelevant for the serverEntry.\n enqueueDependencies: false,\n shouldGetBundleInfo: config.logBundleInfo,\n },\n context,\n );\n const { errors, outputPath = '', outputFiles = [] } = response.result;\n\n if (errors?.length) {\n // The bundle errors will have been logged to the console on bundle task failure,\n // so don't log them again and skip trying to format them for the UI.\n return handleCustomRenderError({\n message: `failed to bundle (see the console for details)`,\n });\n }\n\n // TODO: Issues have been reported with this. Needs investigation and a test...\n let serverEntryOutput = outputFiles.find(\n (f) => f.entryPoint && slash(serverEntryPath) === slash(path.resolve(config.appPath, f.entryPoint)),\n )?.outputPath;\n if (!serverEntryOutput) {\n // No literal match, so try the intermediate path without extension.\n const intermediateServerEntryPath = sourceToIntermediatePath(\n path.relative(config.appPath, serverEntryPath),\n ).replace(/\\.\\w+$/, '');\n serverEntryOutput = outputFiles.find((f) =>\n intermediateServerEntryPath.endsWith(f.outputPath.replace(/\\.\\w+$/, '')),\n )?.outputPath;\n }\n\n if (!serverEntryOutput) {\n return handleCustomRenderError({\n message:\n `- tried to bundle the serverEntry script, but couldn't find a corresponding file ` +\n `in the bundle output (see console for details).`,\n extraLog:\n `Entries (output file to source file): ${JSON.stringify(response.result.entries || {})}\\n` +\n `Output path: ${outputPath}\\n` +\n 'Bundled files: ' +\n (outputFiles.length\n ? '\\n' + bulletedList(outputFiles.map((f) => `${f.outputPath} (entry: ${f.entryPoint || 'unknown'})`))\n : 'none'),\n });\n }\n\n // Translate relative-to-output path into an absolute path.\n return path.resolve(outputPath, serverEntryOutput);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/app-server",
3
- "version": "0.20.58",
3
+ "version": "0.20.60",
4
4
  "description": "Internal app server for Cloudpack",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,13 +24,13 @@
24
24
  "test": "cloudpack-scripts test"
25
25
  },
26
26
  "dependencies": {
27
- "@ms-cloudpack/api-server": "^0.66.19",
28
- "@ms-cloudpack/bundle-server": "^0.9.0",
27
+ "@ms-cloudpack/api-server": "^0.66.21",
28
+ "@ms-cloudpack/bundle-server": "^0.9.2",
29
29
  "@ms-cloudpack/common-types": "^0.33.3",
30
30
  "@ms-cloudpack/create-express-app": "^1.10.72",
31
31
  "@ms-cloudpack/environment": "^0.1.1",
32
32
  "@ms-cloudpack/import-map": "^0.12.5",
33
- "@ms-cloudpack/inline-scripts": "^0.2.80",
33
+ "@ms-cloudpack/inline-scripts": "^0.2.82",
34
34
  "@ms-cloudpack/path-string-parsing": "^1.3.0",
35
35
  "@ms-cloudpack/path-utilities": "^3.2.8",
36
36
  "@ms-cloudpack/task-reporter": "^0.19.0",