@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 +2 -10
- package/cordova-serve/index.js +43 -32
- package/package.json +1 -1
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.
|
|
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
|
-
## [
|
|
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
|
|
package/cordova-serve/index.js
CHANGED
|
@@ -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
|
|
18
|
-
|
|
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
|
|
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
|
-
// ──
|
|
32
|
-
//
|
|
33
|
-
//
|
|
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
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
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
|
}
|