@ankhorage/devtools 2.4.3 → 2.4.4

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/devtools
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v2.4.3](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: configured](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v2.4.4](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: configured](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
7
7
 
8
8
  Shared tooling, repository automation, and agent standards for Ankhorage TypeScript projects
9
9
 
@@ -314,6 +314,7 @@ jobs:
314
314
  fi
315
315
  pack_dir="$(mktemp -d "${RUNNER_TEMP}/standalone-pack.XXXXXX")"
316
316
  install_dir="$(mktemp -d "${RUNNER_TEMP}/standalone-install.XXXXXX")"
317
+ optional_install_dir="$(mktemp -d "${RUNNER_TEMP}/standalone-optional-install.XXXXXX")"
317
318
  npm pack --ignore-scripts --pack-destination "$pack_dir" >/dev/null
318
319
  artifact="$(find "$pack_dir" -maxdepth 1 -type f -name '*.tgz' -print -quit)"
319
320
  if [ -z "$artifact" ]; then
@@ -366,16 +367,20 @@ jobs:
366
367
  const isPlatformOnlyRuntimeTarget = (target) =>
367
368
  declaresCondition(target, platformConditions) &&
368
369
  !declaresCondition(target, explicitServerConditions);
369
- const selectLoader = (target) => {
370
- if (isPlatformOnlyRuntimeTarget(target)) return undefined;
371
- if (supportsLoader(target, importConditions)) return 'import';
372
- if (supportsLoader(target, requireConditions)) return 'require';
373
- return undefined;
370
+ const selectLoaders = (target) => {
371
+ if (isPlatformOnlyRuntimeTarget(target)) return [];
372
+ return [
373
+ ['import', importConditions],
374
+ ['require', requireConditions],
375
+ ].flatMap(([loader, conditions]) =>
376
+ supportsLoader(target, conditions) ? [loader] : [],
377
+ );
374
378
  };
375
379
  const records = [];
376
380
  const addEntrypoint = (specifier, target) => {
377
- const loader = selectLoader(target);
378
- if (loader !== undefined) records.push(`${loader}|${specifier}`);
381
+ for (const loader of selectLoaders(target)) {
382
+ records.push(`${loader}|${specifier}`);
383
+ }
379
384
  };
380
385
  const exportsMap = pkg.exports;
381
386
  if (exportsMap === undefined) {
@@ -400,6 +405,29 @@ jobs:
400
405
  process.stdout.write(output.length === 0 ? '' : `${output.join('\n')}\n`);
401
406
  NODE
402
407
 
408
+ root_runtime_entrypoints="$(awk -F '|' -v package_name="$package_name" '$2 == package_name { print }' runtime-entrypoints.txt)"
409
+ if [ -n "$root_runtime_entrypoints" ]; then
410
+ (
411
+ cd "$optional_install_dir"
412
+ printf '{"name":"standalone-optional-consumer","private":true,"version":"0.0.0"}\n' > package.json
413
+ bun add "$artifact" --ignore-scripts --omit optional
414
+ printf '%s\n' "$root_runtime_entrypoints" | while IFS='|' read -r root_runtime_loader root_runtime_specifier; do
415
+ case "$root_runtime_loader" in
416
+ import)
417
+ PACKAGE_SPECIFIER="$root_runtime_specifier" bun -e 'await import(process.env.PACKAGE_SPECIFIER)'
418
+ ;;
419
+ require)
420
+ PACKAGE_SPECIFIER="$root_runtime_specifier" node -e 'require(process.env.PACKAGE_SPECIFIER)'
421
+ ;;
422
+ *)
423
+ echo "::error title=Unsupported packed root loader::Unexpected loader '$root_runtime_loader' for $root_runtime_specifier."
424
+ exit 1
425
+ ;;
426
+ esac
427
+ done
428
+ )
429
+ fi
430
+
403
431
  PACKAGE_NAME="$package_name" CAPABILITY_MODULE_PATH="$capability_module_path" node --input-type=module - <<'NODE'
404
432
  import { readFileSync } from 'node:fs';
405
433
  import { join } from 'node:path';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/devtools",
3
- "version": "2.4.3",
3
+ "version": "2.4.4",
4
4
  "description": "Shared tooling, repository automation, and agent standards for Ankhorage TypeScript projects",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ankhorage/devtools#readme",