@ionic-hotfix/cordova-builders 13.0.1-testing.0 → 13.0.1-testing.1

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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## 13.0.1-testing.0 (2026-02-26)
6
+ ## 13.0.1-testing.1 (2026-02-26)
7
7
 
8
8
 
9
9
  ### Bug Fixes
@@ -44,15 +44,7 @@ update their angular.json to reflect the new package name
44
44
 
45
45
 
46
46
 
47
- ## [12.3.1-testing.1](https://github.com/ionic-team/angular-toolkit/compare/@ionic/cordova-builders@12.3.0...@ionic/cordova-builders@12.3.1-testing.1) (2026-02-26)
48
-
49
- **Note:** Version bump only for package @ionic/cordova-builders
50
-
51
-
52
-
53
-
54
-
55
- ## [12.3.1-testing.0](https://github.com/ionic-team/angular-toolkit/compare/@ionic/cordova-builders@12.3.0...@ionic/cordova-builders@12.3.1-testing.0) (2026-02-26)
47
+ ## [13.0.1-testing.0](https://github.com/ionic-team/angular-toolkit/compare/@ionic/cordova-builders@12.3.0...@ionic/cordova-builders@13.0.1-testing.0) (2026-02-26)
56
48
 
57
49
  **Note:** Version bump only for package @ionic/cordova-builders
58
50
 
@@ -9,56 +9,67 @@ const operators_1 = require("rxjs/operators");
9
9
  const utils_1 = require("../utils");
10
10
  const append_scripts_1 = require("../utils/append-scripts");
11
11
  const log_server_1 = require("./log-server");
12
+ /** Builders that use esbuild — scripts/assets are NOT passed via getTargetOptions for these. */
13
+ const ESBUILD_BUILDERS = new Set([
14
+ '@angular/build:application',
15
+ '@angular-devkit/build-angular:application',
16
+ '@angular-devkit/build-angular:browser-esbuild',
17
+ '@angular-builders/custom-esbuild:application',
18
+ '@angular-builders/custom-esbuild:browser',
19
+ ]);
12
20
  function serveCordova(options, context) {
13
21
  const { devServerTarget, port, host, ssl } = options;
14
22
  const root = context.workspaceRoot;
15
23
  const devServerTargetSpec = (0, architect_1.targetFromTargetString)(devServerTarget);
16
24
  async function setup() {
17
- var _a, _b, _c, _d;
18
- var _e;
19
- // ── Dev-server options (Schema has no scripts/assets) ──────────────────
25
+ var _a, _b, _c;
26
+ // ── Dev-server options ─────────────────────────────────────────────────
20
27
  const devServerTargetOptions = await context.getTargetOptions(devServerTargetSpec);
21
28
  const devServerName = await context.getBuilderNameForTarget(devServerTargetSpec);
22
29
  devServerTargetOptions.port = port;
23
30
  devServerTargetOptions.host = host;
24
31
  devServerTargetOptions.ssl = ssl;
25
32
  const devServerOptions = (await context.validateOptions(devServerTargetOptions, devServerName));
26
- // ── Cordova assets (scripts / file copies) ─────────────────────────────
33
+ // ── Cordova assets ─────────────────────────────────────────────────────
27
34
  const formattedAssets = await (0, utils_1.prepareServerConfig)(options, root);
28
35
  if (options.consolelogs && options.consolelogsPort) {
29
36
  await (0, log_server_1.createConsoleLogServer)(host, options.consolelogsPort);
30
37
  }
31
- // ── Augment the *build* target's options with Cordova scripts/assets ───
32
- // scripts and assets live on the application/browser builder schema, not
33
- // on DevServerBuilderOptions, so we inject them via build-target overrides.
38
+ // ── Inject scripts/assets into the build target (Webpack path only) ────
39
+ // For esbuild-based builders scripts/assets injection is handled via the
40
+ // indexHtml transform below. Patching getTargetOptions for esbuild builders
41
+ // would expose their object-shaped `outputPath` to Webpack internals and
42
+ // cause ERR_INVALID_ARG_TYPE at common.js path.resolve().
34
43
  const buildTargetString = (_a = devServerOptions.buildTarget) !== null && _a !== void 0 ? _a : devServerOptions.browserTarget;
35
44
  if (buildTargetString && formattedAssets.extraScripts.length + formattedAssets.extraAssets.length > 0) {
36
45
  const buildTargetSpec = (0, architect_1.targetFromTargetString)(buildTargetString);
37
- const buildTargetOptions = await context.getTargetOptions(buildTargetSpec);
38
- const existingScripts = (_b = buildTargetOptions.scripts) !== null && _b !== void 0 ? _b : [];
39
- const existingAssets = (_c = buildTargetOptions.assets) !== null && _c !== void 0 ? _c : [];
40
- // Re-register the build target with the extra Cordova entries merged in.
41
- // BuilderContext.addBuilderConfigurationManager is not public API, so we
42
- // use the supported pattern of overriding via scheduleTarget options but
43
- // since we're inside executeDevServerBuilder we instead monkey-patch the
44
- // getTargetOptions call so the builder picks up the augmented options.
45
- (_d = (_e = context)._originalGetTargetOptions) !== null && _d !== void 0 ? _d : (_e._originalGetTargetOptions = context.getTargetOptions.bind(context));
46
- const originalGet = context._originalGetTargetOptions;
47
- context.getTargetOptions = async (target) => {
48
- var _a, _b;
49
- const raw = await originalGet(target);
50
- const isMatchingBuild = target.project === buildTargetSpec.project &&
51
- target.target === buildTargetSpec.target &&
52
- ((_a = target.configuration) !== null && _a !== void 0 ? _a : '') === ((_b = buildTargetSpec.configuration) !== null && _b !== void 0 ? _b : '');
53
- if (isMatchingBuild) {
54
- return {
55
- ...raw,
56
- scripts: [...existingScripts, ...formattedAssets.extraScripts],
57
- assets: [...existingAssets, ...formattedAssets.extraAssets],
58
- };
59
- }
60
- return raw;
61
- };
46
+ const buildBuilderName = await context.getBuilderNameForTarget(buildTargetSpec);
47
+ if (!ESBUILD_BUILDERS.has(buildBuilderName)) {
48
+ // Webpack builder: patch getTargetOptions so the dev-server picks up
49
+ // the extra Cordova scripts and assets when it reads the build target.
50
+ const buildTargetOptions = await context.getTargetOptions(buildTargetSpec);
51
+ const existingScripts = (_b = buildTargetOptions.scripts) !== null && _b !== void 0 ? _b : [];
52
+ const existingAssets = (_c = buildTargetOptions.assets) !== null && _c !== void 0 ? _c : [];
53
+ const originalGet = context.getTargetOptions.bind(context);
54
+ context.getTargetOptions = async (target) => {
55
+ var _a, _b;
56
+ const raw = await originalGet(target);
57
+ const isMatchingBuild = target.project === buildTargetSpec.project &&
58
+ target.target === buildTargetSpec.target &&
59
+ ((_a = target.configuration) !== null && _a !== void 0 ? _a : '') === ((_b = buildTargetSpec.configuration) !== null && _b !== void 0 ? _b : '');
60
+ if (isMatchingBuild) {
61
+ return {
62
+ ...raw,
63
+ scripts: [...existingScripts, ...formattedAssets.extraScripts],
64
+ assets: [...existingAssets, ...formattedAssets.extraAssets],
65
+ };
66
+ }
67
+ return raw;
68
+ };
69
+ }
70
+ // esbuild builders: scripts are injected into index.html via the
71
+ // indexHtml transform; file assets are copied by the builder natively
72
+ // through the assets array which is already set in angular.json.
62
73
  }
63
74
  return { devServerOptions, formattedAssets };
64
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionic-hotfix/cordova-builders",
3
- "version": "13.0.1-testing.0",
3
+ "version": "13.0.1-testing.1",
4
4
  "license": "MIT",
5
5
  "description": "Cordova builders for @ionic/angular apps",
6
6
  "homepage": "https://ionicframework.com/",