craft-native 0.0.348 → 0.0.350
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/dist/binary-resolver.d.ts +1 -1
- package/dist/cli.js +17 -4
- package/dist/index.cjs +18 -5
- package/dist/index.js +18 -5
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* @returns The string to pass to `spawn(...)`. Either `explicit`,
|
|
30
30
|
* `process.env.CRAFT_BIN`, or the bare `'craft'` for PATH lookup.
|
|
31
31
|
*/
|
|
32
|
-
export declare function resolveCraftBinary(explicit?: string): string;
|
|
32
|
+
export declare function resolveCraftBinary(explicit?: string, profile?: 'full' | 'webview'): string;
|
|
33
33
|
/**
|
|
34
34
|
* Set on the child environment whenever the CLI spawns what it believes is
|
|
35
35
|
* the native binary.
|
package/dist/cli.js
CHANGED
|
@@ -242,7 +242,9 @@ async function packageApp(config) {
|
|
|
242
242
|
return results;
|
|
243
243
|
}
|
|
244
244
|
function macOSAppStoreRuntimePath(providerPath) {
|
|
245
|
-
const
|
|
245
|
+
const providerName = basename(providerPath);
|
|
246
|
+
const storeName = providerName.startsWith("craft-webview") ? "craft-webview-app-store" : "craft-app-store";
|
|
247
|
+
const runtime = providerName === storeName ? providerPath : join2(dirname(providerPath), storeName);
|
|
246
248
|
if (!existsSync4(runtime))
|
|
247
249
|
throw new Error("App Store packaging requires Pantry\u2019s craft-app-store runtime. Upgrade Craft with Pantry before building.");
|
|
248
250
|
const bytes = readFileSync2(runtime);
|
|
@@ -299,6 +301,17 @@ async function packageMacOS(config, outDir) {
|
|
|
299
301
|
}
|
|
300
302
|
try {
|
|
301
303
|
const contents = join2(appBundlePath, "Contents");
|
|
304
|
+
if (opts.appStore && opts.appBundlePath && existsSync4(join2(contents, "Resources", "craft.json"))) {
|
|
305
|
+
if (!nativeRuntimePath)
|
|
306
|
+
throw new Error("App Store packaging of a prebuilt Craft bundle requires macos.nativeRuntimePath from Pantry.");
|
|
307
|
+
const plist = join2(contents, "Info.plist");
|
|
308
|
+
const executable = spawnSync("plutil", ["-extract", "CFBundleExecutable", "raw", "-o", "-", plist], { encoding: "utf8" });
|
|
309
|
+
const name = executable.stdout.trim();
|
|
310
|
+
if (executable.status !== 0 || !name || basename(name) !== name || name === "." || name === "..")
|
|
311
|
+
throw new Error("Prebuilt Craft bundle has an invalid CFBundleExecutable");
|
|
312
|
+
copyFileSync(nativeRuntimePath, join2(contents, "MacOS", name));
|
|
313
|
+
chmodSync(join2(contents, "MacOS", name), 493);
|
|
314
|
+
}
|
|
302
315
|
if (opts.provisioningProfile) {
|
|
303
316
|
const profile = join2(contents, "embedded.provisionprofile");
|
|
304
317
|
copyFileSync(opts.provisioningProfile, profile);
|
|
@@ -2947,7 +2960,7 @@ import process6 from "process";
|
|
|
2947
2960
|
|
|
2948
2961
|
// src/binary-resolver.ts
|
|
2949
2962
|
import { existsSync as existsSync2 } from "fs";
|
|
2950
|
-
function resolveCraftBinary(explicit) {
|
|
2963
|
+
function resolveCraftBinary(explicit, profile = "full") {
|
|
2951
2964
|
if (explicit) {
|
|
2952
2965
|
if (!existsSync2(explicit)) {
|
|
2953
2966
|
throw new Error(`Custom Craft binary path not found: ${explicit}`);
|
|
@@ -2961,7 +2974,7 @@ function resolveCraftBinary(explicit) {
|
|
|
2961
2974
|
}
|
|
2962
2975
|
return fromEnv;
|
|
2963
2976
|
}
|
|
2964
|
-
return "craft";
|
|
2977
|
+
return profile === "webview" ? "craft-webview" : "craft";
|
|
2965
2978
|
}
|
|
2966
2979
|
var CRAFT_CLI_SPAWN_MARKER = "CRAFT_CLI_SPAWNED_FROM";
|
|
2967
2980
|
function craftBinaryIsCliShimMessage(spawnedFrom) {
|
|
@@ -3022,7 +3035,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
|
|
|
3022
3035
|
`);
|
|
3023
3036
|
}
|
|
3024
3037
|
// package.json
|
|
3025
|
-
var version = "0.0.
|
|
3038
|
+
var version = "0.0.350";
|
|
3026
3039
|
|
|
3027
3040
|
// bin/cli.ts
|
|
3028
3041
|
var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
|
package/dist/index.cjs
CHANGED
|
@@ -341,7 +341,7 @@ var import_node_util = require("node:util");
|
|
|
341
341
|
|
|
342
342
|
// src/binary-resolver.ts
|
|
343
343
|
var import_node_fs = require("node:fs");
|
|
344
|
-
function resolveCraftBinary(explicit) {
|
|
344
|
+
function resolveCraftBinary(explicit, profile = "full") {
|
|
345
345
|
if (explicit) {
|
|
346
346
|
if (!import_node_fs.existsSync(explicit)) {
|
|
347
347
|
throw new Error(`Custom Craft binary path not found: ${explicit}`);
|
|
@@ -355,7 +355,7 @@ function resolveCraftBinary(explicit) {
|
|
|
355
355
|
}
|
|
356
356
|
return fromEnv;
|
|
357
357
|
}
|
|
358
|
-
return "craft";
|
|
358
|
+
return profile === "webview" ? "craft-webview" : "craft";
|
|
359
359
|
}
|
|
360
360
|
var CRAFT_CLI_SPAWN_MARKER = "CRAFT_CLI_SPAWNED_FROM";
|
|
361
361
|
function craftBinaryNotFoundMessage(triedPath) {
|
|
@@ -375,7 +375,7 @@ function craftBinaryNotFoundMessage(triedPath) {
|
|
|
375
375
|
`);
|
|
376
376
|
}
|
|
377
377
|
// package.json
|
|
378
|
-
var version = "0.0.
|
|
378
|
+
var version = "0.0.350";
|
|
379
379
|
|
|
380
380
|
// src/sdk-version.ts
|
|
381
381
|
var SDK_VERSION = version;
|
|
@@ -608,7 +608,9 @@ async function packageApp(config) {
|
|
|
608
608
|
return results;
|
|
609
609
|
}
|
|
610
610
|
function macOSAppStoreRuntimePath(providerPath) {
|
|
611
|
-
const
|
|
611
|
+
const providerName = import_path.basename(providerPath);
|
|
612
|
+
const storeName = providerName.startsWith("craft-webview") ? "craft-webview-app-store" : "craft-app-store";
|
|
613
|
+
const runtime = providerName === storeName ? providerPath : import_path.join(import_path.dirname(providerPath), storeName);
|
|
612
614
|
if (!import_fs.existsSync(runtime))
|
|
613
615
|
throw new Error("App Store packaging requires Pantry’s craft-app-store runtime. Upgrade Craft with Pantry before building.");
|
|
614
616
|
const bytes = import_fs.readFileSync(runtime);
|
|
@@ -665,6 +667,17 @@ async function packageMacOS(config, outDir) {
|
|
|
665
667
|
}
|
|
666
668
|
try {
|
|
667
669
|
const contents = import_path.join(appBundlePath, "Contents");
|
|
670
|
+
if (opts.appStore && opts.appBundlePath && import_fs.existsSync(import_path.join(contents, "Resources", "craft.json"))) {
|
|
671
|
+
if (!nativeRuntimePath)
|
|
672
|
+
throw new Error("App Store packaging of a prebuilt Craft bundle requires macos.nativeRuntimePath from Pantry.");
|
|
673
|
+
const plist = import_path.join(contents, "Info.plist");
|
|
674
|
+
const executable = import_child_process.spawnSync("plutil", ["-extract", "CFBundleExecutable", "raw", "-o", "-", plist], { encoding: "utf8" });
|
|
675
|
+
const name = executable.stdout.trim();
|
|
676
|
+
if (executable.status !== 0 || !name || import_path.basename(name) !== name || name === "." || name === "..")
|
|
677
|
+
throw new Error("Prebuilt Craft bundle has an invalid CFBundleExecutable");
|
|
678
|
+
import_fs.copyFileSync(nativeRuntimePath, import_path.join(contents, "MacOS", name));
|
|
679
|
+
import_fs.chmodSync(import_path.join(contents, "MacOS", name), 493);
|
|
680
|
+
}
|
|
668
681
|
if (opts.provisioningProfile) {
|
|
669
682
|
const profile = import_path.join(contents, "embedded.provisionprofile");
|
|
670
683
|
import_fs.copyFileSync(opts.provisioningProfile, profile);
|
|
@@ -11785,7 +11798,7 @@ class CraftApp {
|
|
|
11785
11798
|
return args;
|
|
11786
11799
|
}
|
|
11787
11800
|
async findCraftBinary() {
|
|
11788
|
-
return resolveCraftBinary(this.config.craftPath);
|
|
11801
|
+
return resolveCraftBinary(this.config.craftPath, this.config.runtimeProfile);
|
|
11789
11802
|
}
|
|
11790
11803
|
}
|
|
11791
11804
|
function createApp(config) {
|
package/dist/index.js
CHANGED
|
@@ -83,7 +83,7 @@ import { promisify as promisify2 } from "util";
|
|
|
83
83
|
|
|
84
84
|
// src/binary-resolver.ts
|
|
85
85
|
import { existsSync } from "fs";
|
|
86
|
-
function resolveCraftBinary(explicit) {
|
|
86
|
+
function resolveCraftBinary(explicit, profile = "full") {
|
|
87
87
|
if (explicit) {
|
|
88
88
|
if (!existsSync(explicit)) {
|
|
89
89
|
throw new Error(`Custom Craft binary path not found: ${explicit}`);
|
|
@@ -97,7 +97,7 @@ function resolveCraftBinary(explicit) {
|
|
|
97
97
|
}
|
|
98
98
|
return fromEnv;
|
|
99
99
|
}
|
|
100
|
-
return "craft";
|
|
100
|
+
return profile === "webview" ? "craft-webview" : "craft";
|
|
101
101
|
}
|
|
102
102
|
var CRAFT_CLI_SPAWN_MARKER = "CRAFT_CLI_SPAWNED_FROM";
|
|
103
103
|
function craftBinaryNotFoundMessage(triedPath) {
|
|
@@ -117,7 +117,7 @@ function craftBinaryNotFoundMessage(triedPath) {
|
|
|
117
117
|
`);
|
|
118
118
|
}
|
|
119
119
|
// package.json
|
|
120
|
-
var version = "0.0.
|
|
120
|
+
var version = "0.0.350";
|
|
121
121
|
|
|
122
122
|
// src/sdk-version.ts
|
|
123
123
|
var SDK_VERSION = version;
|
|
@@ -364,7 +364,9 @@ async function packageApp(config) {
|
|
|
364
364
|
return results;
|
|
365
365
|
}
|
|
366
366
|
function macOSAppStoreRuntimePath(providerPath) {
|
|
367
|
-
const
|
|
367
|
+
const providerName = basename(providerPath);
|
|
368
|
+
const storeName = providerName.startsWith("craft-webview") ? "craft-webview-app-store" : "craft-app-store";
|
|
369
|
+
const runtime = providerName === storeName ? providerPath : join2(dirname(providerPath), storeName);
|
|
368
370
|
if (!existsSync3(runtime))
|
|
369
371
|
throw new Error("App Store packaging requires Pantry\u2019s craft-app-store runtime. Upgrade Craft with Pantry before building.");
|
|
370
372
|
const bytes = readFileSync(runtime);
|
|
@@ -421,6 +423,17 @@ async function packageMacOS(config, outDir) {
|
|
|
421
423
|
}
|
|
422
424
|
try {
|
|
423
425
|
const contents = join2(appBundlePath, "Contents");
|
|
426
|
+
if (opts.appStore && opts.appBundlePath && existsSync3(join2(contents, "Resources", "craft.json"))) {
|
|
427
|
+
if (!nativeRuntimePath)
|
|
428
|
+
throw new Error("App Store packaging of a prebuilt Craft bundle requires macos.nativeRuntimePath from Pantry.");
|
|
429
|
+
const plist = join2(contents, "Info.plist");
|
|
430
|
+
const executable = spawnSync("plutil", ["-extract", "CFBundleExecutable", "raw", "-o", "-", plist], { encoding: "utf8" });
|
|
431
|
+
const name = executable.stdout.trim();
|
|
432
|
+
if (executable.status !== 0 || !name || basename(name) !== name || name === "." || name === "..")
|
|
433
|
+
throw new Error("Prebuilt Craft bundle has an invalid CFBundleExecutable");
|
|
434
|
+
copyFileSync(nativeRuntimePath, join2(contents, "MacOS", name));
|
|
435
|
+
chmodSync(join2(contents, "MacOS", name), 493);
|
|
436
|
+
}
|
|
424
437
|
if (opts.provisioningProfile) {
|
|
425
438
|
const profile = join2(contents, "embedded.provisionprofile");
|
|
426
439
|
copyFileSync(opts.provisioningProfile, profile);
|
|
@@ -11541,7 +11554,7 @@ class CraftApp {
|
|
|
11541
11554
|
return args;
|
|
11542
11555
|
}
|
|
11543
11556
|
async findCraftBinary() {
|
|
11544
|
-
return resolveCraftBinary(this.config.craftPath);
|
|
11557
|
+
return resolveCraftBinary(this.config.craftPath, this.config.runtimeProfile);
|
|
11545
11558
|
}
|
|
11546
11559
|
}
|
|
11547
11560
|
function createApp(config) {
|
package/dist/types.d.ts
CHANGED
|
@@ -558,6 +558,8 @@ export interface AppConfig {
|
|
|
558
558
|
* Path to Craft binary (auto-detected if not provided)
|
|
559
559
|
*/
|
|
560
560
|
craftPath?: string;
|
|
561
|
+
/** macOS webview apps may omit the separate headless scripting engine. */
|
|
562
|
+
runtimeProfile?: 'full' | 'webview';
|
|
561
563
|
/**
|
|
562
564
|
* Suppress all non-error output from the native binary.
|
|
563
565
|
* When true, the binary runs with --quiet and stdio is piped.
|