@hakobu/hakobu 1.0.0
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/LICENSE +21 -0
- package/README.md +673 -0
- package/dictionary/angular-bridge.js +3 -0
- package/dictionary/any-promise.js +3 -0
- package/dictionary/async.js +3 -0
- package/dictionary/aws-sdk.js +7 -0
- package/dictionary/babel-core.js +3 -0
- package/dictionary/batch.js +3 -0
- package/dictionary/bcrypt.js +3 -0
- package/dictionary/better-sqlite3.js +3 -0
- package/dictionary/bignum.js +3 -0
- package/dictionary/bindings.js +3 -0
- package/dictionary/blessed.js +8 -0
- package/dictionary/body-parser.js +9 -0
- package/dictionary/browserify.js +7 -0
- package/dictionary/bson.js +3 -0
- package/dictionary/buffermaker.js +7 -0
- package/dictionary/bunyan.js +9 -0
- package/dictionary/busboy.js +7 -0
- package/dictionary/bytes.js +3 -0
- package/dictionary/callsites.js +3 -0
- package/dictionary/chokidar.js +3 -0
- package/dictionary/coffee-script.js +7 -0
- package/dictionary/colors.js +3 -0
- package/dictionary/compression.js +3 -0
- package/dictionary/compressjs.js +7 -0
- package/dictionary/connect-mongo.js +3 -0
- package/dictionary/connect-mongodb.js +3 -0
- package/dictionary/connect-redis.js +3 -0
- package/dictionary/connect.js +10 -0
- package/dictionary/consolidate.js +3 -0
- package/dictionary/cookie-parser.js +3 -0
- package/dictionary/cookie.js +3 -0
- package/dictionary/cors.js +3 -0
- package/dictionary/cron.js +3 -0
- package/dictionary/cross-env.js +11 -0
- package/dictionary/cross-spawn-async.js +3 -0
- package/dictionary/curve25519.js +3 -0
- package/dictionary/data-preflight.js +7 -0
- package/dictionary/debug.js +3 -0
- package/dictionary/denymount.js +3 -0
- package/dictionary/diff.js +3 -0
- package/dictionary/drivelist.js +22 -0
- package/dictionary/ed25519.js +3 -0
- package/dictionary/ejs.js +3 -0
- package/dictionary/elasticsearch.js +3 -0
- package/dictionary/electron.js +17 -0
- package/dictionary/emailjs.js +3 -0
- package/dictionary/engine.io.js +3 -0
- package/dictionary/epoll.js +3 -0
- package/dictionary/errorhandler.js +7 -0
- package/dictionary/errors.js +7 -0
- package/dictionary/eslint.js +7 -0
- package/dictionary/etcher-image-write.js +3 -0
- package/dictionary/exceljs.js +21 -0
- package/dictionary/exiftool.exe.js +13 -0
- package/dictionary/exiftool.pl.js +13 -0
- package/dictionary/express-load.js +12 -0
- package/dictionary/express-session.js +3 -0
- package/dictionary/express.js +14 -0
- package/dictionary/extender.js +11 -0
- package/dictionary/extsprintf.js +3 -0
- package/dictionary/faye-websocket.js +3 -0
- package/dictionary/feathers.js +3 -0
- package/dictionary/findup-sync.js +3 -0
- package/dictionary/floordate.js +3 -0
- package/dictionary/fmt.js +3 -0
- package/dictionary/formidable.js +3 -0
- package/dictionary/fs-extra.js +3 -0
- package/dictionary/fsevents.js +3 -0
- package/dictionary/geoip-lite.js +7 -0
- package/dictionary/github.js +7 -0
- package/dictionary/gm.js +3 -0
- package/dictionary/google-closure-compiler-java.js +13 -0
- package/dictionary/google-closure-compiler.js +13 -0
- package/dictionary/googleapis.js +7 -0
- package/dictionary/got.js +3 -0
- package/dictionary/graceful-fs.js +19 -0
- package/dictionary/grpc.js +11 -0
- package/dictionary/gulp.js +3 -0
- package/dictionary/hap-nodejs.js +3 -0
- package/dictionary/heapdump.js +3 -0
- package/dictionary/hoek.js +3 -0
- package/dictionary/homebridge.js +3 -0
- package/dictionary/http-proxy.js +3 -0
- package/dictionary/http-server.js +3 -0
- package/dictionary/image-size.js +3 -0
- package/dictionary/indexof.js +3 -0
- package/dictionary/inquirer.js +3 -0
- package/dictionary/j.js +16 -0
- package/dictionary/jade.js +3 -0
- package/dictionary/jsdom.js +3 -0
- package/dictionary/json-stringify-date.js +3 -0
- package/dictionary/json-stringify-safe.js +3 -0
- package/dictionary/jsonwebtoken.js +3 -0
- package/dictionary/kerberos.js +3 -0
- package/dictionary/knex.js +7 -0
- package/dictionary/later.js +7 -0
- package/dictionary/level.js +3 -0
- package/dictionary/leveldown.js +10 -0
- package/dictionary/levelup.js +3 -0
- package/dictionary/liftoff.js +12 -0
- package/dictionary/lodash.js +3 -0
- package/dictionary/log4js.js +7 -0
- package/dictionary/logform.js +7 -0
- package/dictionary/machinepack-urls.js +7 -0
- package/dictionary/markdown.js +3 -0
- package/dictionary/mdns.js +6 -0
- package/dictionary/method-override.js +3 -0
- package/dictionary/microjob.js +16 -0
- package/dictionary/mime-types.js +3 -0
- package/dictionary/mime.js +3 -0
- package/dictionary/minimatch.js +3 -0
- package/dictionary/minstache.js +3 -0
- package/dictionary/module-deps.js +3 -0
- package/dictionary/moment-timezone.js +3 -0
- package/dictionary/moment.js +7 -0
- package/dictionary/mongodb-core.js +22 -0
- package/dictionary/mongodb.js +7 -0
- package/dictionary/mongoose.js +7 -0
- package/dictionary/mongoskin.js +7 -0
- package/dictionary/ms.js +3 -0
- package/dictionary/msgpack.js +3 -0
- package/dictionary/multer.js +3 -0
- package/dictionary/muri.js +3 -0
- package/dictionary/native-or-bluebird.js +3 -0
- package/dictionary/natives.js +3 -0
- package/dictionary/nconf.js +7 -0
- package/dictionary/nedb.js +3 -0
- package/dictionary/negotiator.js +7 -0
- package/dictionary/newrelic.js +3 -0
- package/dictionary/nib.js +3 -0
- package/dictionary/nightmare.js +18 -0
- package/dictionary/node-forge.js +7 -0
- package/dictionary/node-libcurl.js +3 -0
- package/dictionary/node-notifier.js +30 -0
- package/dictionary/node-pre-gyp.js +7 -0
- package/dictionary/node-redis-pubsub.js +3 -0
- package/dictionary/node-sass.js +3 -0
- package/dictionary/node-uuid.js +3 -0
- package/dictionary/node-xlsx.js +3 -0
- package/dictionary/node-zookeeper-client.js +7 -0
- package/dictionary/nodegit.js +7 -0
- package/dictionary/nodemailer-sendmail-transport.js +3 -0
- package/dictionary/nodemailer.js +3 -0
- package/dictionary/npm-registry-client.js +7 -0
- package/dictionary/npm.js +7 -0
- package/dictionary/nssocket.js +3 -0
- package/dictionary/oauth2orize.js +7 -0
- package/dictionary/octobat.js +3 -0
- package/dictionary/open.js +13 -0
- package/dictionary/opn.js +4 -0
- package/dictionary/optimist.js +3 -0
- package/dictionary/passport-local.js +3 -0
- package/dictionary/passport.js +3 -0
- package/dictionary/pg-cursor.js +3 -0
- package/dictionary/pg-query-stream.js +3 -0
- package/dictionary/pg-types.js +7 -0
- package/dictionary/pg.js +7 -0
- package/dictionary/pg.js.js +7 -0
- package/dictionary/pgpass.js +7 -0
- package/dictionary/phantom.js +19 -0
- package/dictionary/phantomjs-prebuilt.js +16 -0
- package/dictionary/pkginfo.js +3 -0
- package/dictionary/pm2.js +7 -0
- package/dictionary/pmx.js +3 -0
- package/dictionary/pouchdb.js +3 -0
- package/dictionary/primus-emitter.js +3 -0
- package/dictionary/primus-spark-latency.js +3 -0
- package/dictionary/primus.js +3 -0
- package/dictionary/publicsuffixlist.js +15 -0
- package/dictionary/pug.js +3 -0
- package/dictionary/punt.js +3 -0
- package/dictionary/puppeteer.js +13 -0
- package/dictionary/pwd.js +3 -0
- package/dictionary/q.js +3 -0
- package/dictionary/raven.js +3 -0
- package/dictionary/rc.js +12 -0
- package/dictionary/readable-stream.js +3 -0
- package/dictionary/rechoir.js +3 -0
- package/dictionary/redis-parser.js +3 -0
- package/dictionary/redis.js +3 -0
- package/dictionary/regression.js +3 -0
- package/dictionary/reload.js +7 -0
- package/dictionary/request.js +3 -0
- package/dictionary/require-uncached.js +3 -0
- package/dictionary/require_optional.js +3 -0
- package/dictionary/s3.js +3 -0
- package/dictionary/safe_datejs.js +3 -0
- package/dictionary/sails.js +33 -0
- package/dictionary/sax.js +3 -0
- package/dictionary/scrypt.js +3 -0
- package/dictionary/semver.js +3 -0
- package/dictionary/sequelize.js +7 -0
- package/dictionary/serialport.js +3 -0
- package/dictionary/sha3.js +3 -0
- package/dictionary/sharp.js +11 -0
- package/dictionary/shelljs.js +7 -0
- package/dictionary/sinon.js +3 -0
- package/dictionary/socket.io-client.js +13 -0
- package/dictionary/socket.io.js +12 -0
- package/dictionary/sqip.js +7 -0
- package/dictionary/sqlite3.js +7 -0
- package/dictionary/steam-crypto.js +7 -0
- package/dictionary/steam-resources.js +19 -0
- package/dictionary/steam.js +3 -0
- package/dictionary/stripe-webhook-middleware.js +3 -0
- package/dictionary/stripe.js +3 -0
- package/dictionary/strong-globalize.js +3 -0
- package/dictionary/stylus.js +14 -0
- package/dictionary/supervisor.js +3 -0
- package/dictionary/svgo.js +8 -0
- package/dictionary/tabtab.js +3 -0
- package/dictionary/tesseract.js.js +7 -0
- package/dictionary/thread-stream.js +7 -0
- package/dictionary/throng.js +3 -0
- package/dictionary/time.js +3 -0
- package/dictionary/tinify.js +7 -0
- package/dictionary/tiny-worker.js +7 -0
- package/dictionary/tmp.js +3 -0
- package/dictionary/transformers.js +3 -0
- package/dictionary/uglify-js.js +9 -0
- package/dictionary/umd.js +19 -0
- package/dictionary/underscore.js +3 -0
- package/dictionary/union.js +3 -0
- package/dictionary/update-notifier.js +3 -0
- package/dictionary/usage.js +7 -0
- package/dictionary/v8flags.js +13 -0
- package/dictionary/verror.js +3 -0
- package/dictionary/voc.js +3 -0
- package/dictionary/webdriverio.js +7 -0
- package/dictionary/winston-uber.js +7 -0
- package/dictionary/winston.js +7 -0
- package/dictionary/ws.js +3 -0
- package/dictionary/xlsx.js +16 -0
- package/dictionary/xml2js.js +3 -0
- package/dictionary/yargs.js +3 -0
- package/dictionary/zeromq.js +13 -0
- package/lib-es5/addon-extract.js +164 -0
- package/lib-es5/analyzer.js +687 -0
- package/lib-es5/app-bundle.js +133 -0
- package/lib-es5/appdir.js +265 -0
- package/lib-es5/bin.js +304 -0
- package/lib-es5/bootstrap.js +179 -0
- package/lib-es5/bundler.js +496 -0
- package/lib-es5/chmod.js +15 -0
- package/lib-es5/colors.js +12 -0
- package/lib-es5/commands.js +376 -0
- package/lib-es5/common.js +328 -0
- package/lib-es5/compress_type.js +10 -0
- package/lib-es5/config.js +291 -0
- package/lib-es5/detector.js +421 -0
- package/lib-es5/esm-hooks.js +366 -0
- package/lib-es5/esm-resolver.js +292 -0
- package/lib-es5/esm-transformer.js +378 -0
- package/lib-es5/exports-resolver.js +184 -0
- package/lib-es5/external-artifacts.js +170 -0
- package/lib-es5/fabricator.js +137 -0
- package/lib-es5/follow.js +190 -0
- package/lib-es5/help.js +52 -0
- package/lib-es5/index.d.ts +2 -0
- package/lib-es5/index.js +552 -0
- package/lib-es5/log.js +7 -0
- package/lib-es5/mach-o.js +262 -0
- package/lib-es5/manifest.js +21 -0
- package/lib-es5/options.js +19 -0
- package/lib-es5/packager.js +1036 -0
- package/lib-es5/packer.js +137 -0
- package/lib-es5/pe-metadata.js +130 -0
- package/lib-es5/producer.js +378 -0
- package/lib-es5/refiner.js +87 -0
- package/lib-es5/resolver.js +142 -0
- package/lib-es5/runtime-diagnostics.js +172 -0
- package/lib-es5/sea.js +307 -0
- package/lib-es5/snapshot-fs-patch.js +396 -0
- package/lib-es5/snapshot-fs.js +255 -0
- package/lib-es5/snapshot-index.js +135 -0
- package/lib-es5/snapshot-path.js +168 -0
- package/lib-es5/types.js +9 -0
- package/lib-es5/walker.js +1019 -0
- package/lib-es5/windows-sign.js +139 -0
- package/package.json +99 -0
- package/prelude/bootstrap.js +2263 -0
- package/prelude/diagnostic.js +147 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notarizeAppBundle = exports.signAppBundle = exports.notarizeMachOExecutable = exports.signMachOExecutable = exports.removeMachOExecutableSignature = exports.patchMachOExecutable = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const log_1 = require("./log");
|
|
7
|
+
const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
8
|
+
function parseCStr(buf) {
|
|
9
|
+
for (let i = 0; i < buf.length; i += 1) {
|
|
10
|
+
if (buf[i] === 0) {
|
|
11
|
+
return buf.slice(0, i).toString();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function patchCommand(type, buf, file) {
|
|
16
|
+
// segment_64
|
|
17
|
+
if (type === 0x19) {
|
|
18
|
+
const name = parseCStr(buf.slice(0, 16));
|
|
19
|
+
if (name === '__LINKEDIT') {
|
|
20
|
+
const fileoff = buf.readBigUInt64LE(32);
|
|
21
|
+
const vmsizePatched = BigInt(file.length) - fileoff;
|
|
22
|
+
const filesizePatched = vmsizePatched;
|
|
23
|
+
buf.writeBigUInt64LE(vmsizePatched, 24);
|
|
24
|
+
buf.writeBigUInt64LE(filesizePatched, 40);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// symtab
|
|
28
|
+
if (type === 0x2) {
|
|
29
|
+
const stroff = buf.readUInt32LE(8);
|
|
30
|
+
const strsizePatched = file.length - stroff;
|
|
31
|
+
buf.writeUInt32LE(strsizePatched, 12);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* It would be nice to explain the purpose of this patching function
|
|
36
|
+
* @param file
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
function patchMachOExecutable(file) {
|
|
40
|
+
const align = 8;
|
|
41
|
+
const hsize = 32;
|
|
42
|
+
const ncmds = file.readUInt32LE(16);
|
|
43
|
+
const buf = file.slice(hsize);
|
|
44
|
+
for (let offset = 0, i = 0; i < ncmds; i += 1) {
|
|
45
|
+
const type = buf.readUInt32LE(offset);
|
|
46
|
+
offset += 4;
|
|
47
|
+
const size = buf.readUInt32LE(offset) - 8;
|
|
48
|
+
offset += 4;
|
|
49
|
+
patchCommand(type, buf.slice(offset, offset + size), file);
|
|
50
|
+
offset += size;
|
|
51
|
+
if (offset & align) {
|
|
52
|
+
offset += align - (offset & align);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return file;
|
|
56
|
+
}
|
|
57
|
+
exports.patchMachOExecutable = patchMachOExecutable;
|
|
58
|
+
/**
|
|
59
|
+
* Sign a Mach-O executable.
|
|
60
|
+
*
|
|
61
|
+
* @param executable - Path to the executable
|
|
62
|
+
* @param identity - Signing identity. Default: '-' (ad-hoc).
|
|
63
|
+
* For distribution, use a Developer ID identity:
|
|
64
|
+
* 'Developer ID Application: Your Name (TEAMID)'
|
|
65
|
+
*
|
|
66
|
+
* Identity resolution order:
|
|
67
|
+
* 1. Explicit `identity` argument
|
|
68
|
+
* 2. HAKOBU_SIGN_IDENTITY env var
|
|
69
|
+
* 3. Ad-hoc signing ('-')
|
|
70
|
+
*/
|
|
71
|
+
function signMachOExecutable(executable, identity) {
|
|
72
|
+
const id = identity || process.env.HAKOBU_SIGN_IDENTITY || '-';
|
|
73
|
+
const args = [
|
|
74
|
+
'--force',
|
|
75
|
+
'--sign', id,
|
|
76
|
+
'--options', 'runtime',
|
|
77
|
+
'--timestamp',
|
|
78
|
+
executable,
|
|
79
|
+
];
|
|
80
|
+
// Ad-hoc signing doesn't support --timestamp and doesn't need --options runtime
|
|
81
|
+
if (id === '-') {
|
|
82
|
+
try {
|
|
83
|
+
(0, child_process_1.execFileSync)('codesign', ['-f', '--sign', '-', executable], {
|
|
84
|
+
stdio: 'inherit',
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
(0, child_process_1.execFileSync)('ldid', ['-Cadhoc', '-S', executable], { stdio: 'inherit' });
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
(0, child_process_1.execFileSync)('codesign', args, { stdio: 'inherit' });
|
|
93
|
+
}
|
|
94
|
+
exports.signMachOExecutable = signMachOExecutable;
|
|
95
|
+
function removeMachOExecutableSignature(executable) {
|
|
96
|
+
(0, child_process_1.execFileSync)('codesign', ['--remove-signature', executable], {
|
|
97
|
+
stdio: 'inherit',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
exports.removeMachOExecutableSignature = removeMachOExecutableSignature;
|
|
101
|
+
/**
|
|
102
|
+
* Submit a signed macOS executable for Apple notarization, then staple
|
|
103
|
+
* the notarization ticket to the binary.
|
|
104
|
+
*
|
|
105
|
+
* Prerequisites:
|
|
106
|
+
* - The executable must be signed with a Developer ID identity (not ad-hoc)
|
|
107
|
+
* with hardened runtime (--options runtime) and a secure timestamp (--timestamp)
|
|
108
|
+
* - Apple ID, app-specific password, and team ID must be provided
|
|
109
|
+
* - Xcode command-line tools must be installed (provides xcrun)
|
|
110
|
+
*
|
|
111
|
+
* The function:
|
|
112
|
+
* 1. Zips the executable (notarytool requires a zip, dmg, or pkg)
|
|
113
|
+
* 2. Submits to Apple via `xcrun notarytool submit --wait`
|
|
114
|
+
* 3. Staples the ticket via `xcrun stapler staple`
|
|
115
|
+
* 4. Cleans up the temp zip
|
|
116
|
+
*
|
|
117
|
+
* @throws If any step fails (missing credentials, submission rejected, etc.)
|
|
118
|
+
*/
|
|
119
|
+
async function notarizeMachOExecutable(opts) {
|
|
120
|
+
const { executable, appleId = process.env.HAKOBU_APPLE_ID, applePassword = process.env.HAKOBU_APPLE_PASSWORD, teamId = process.env.HAKOBU_APPLE_TEAM_ID, } = opts;
|
|
121
|
+
if (!appleId || !applePassword || !teamId) {
|
|
122
|
+
const missing = [];
|
|
123
|
+
if (!appleId)
|
|
124
|
+
missing.push('HAKOBU_APPLE_ID');
|
|
125
|
+
if (!applePassword)
|
|
126
|
+
missing.push('HAKOBU_APPLE_PASSWORD');
|
|
127
|
+
if (!teamId)
|
|
128
|
+
missing.push('HAKOBU_APPLE_TEAM_ID');
|
|
129
|
+
throw new Error(`Cannot notarize: missing ${missing.join(', ')}. ` +
|
|
130
|
+
`Set these env vars or pass them as options. See docs/macos-notarization.md.`);
|
|
131
|
+
}
|
|
132
|
+
// 1. Create a zip for submission (notarytool requires zip/dmg/pkg)
|
|
133
|
+
const zipPath = executable + '.zip';
|
|
134
|
+
log_1.log.info('Creating zip for notarization submission...');
|
|
135
|
+
(0, child_process_1.execFileSync)('ditto', ['-c', '-k', '--keepParent', executable, zipPath], {
|
|
136
|
+
stdio: 'pipe',
|
|
137
|
+
});
|
|
138
|
+
try {
|
|
139
|
+
// 2. Submit and wait for notarization result
|
|
140
|
+
log_1.log.info('Submitting to Apple notary service (this may take a few minutes)...');
|
|
141
|
+
const { stdout } = await execFileAsync('xcrun', [
|
|
142
|
+
'notarytool', 'submit', zipPath,
|
|
143
|
+
'--apple-id', appleId,
|
|
144
|
+
'--password', applePassword,
|
|
145
|
+
'--team-id', teamId,
|
|
146
|
+
'--wait',
|
|
147
|
+
], { timeout: 600000 }); // 10 minute timeout
|
|
148
|
+
log_1.log.info(`Notarization result:\n${stdout}`);
|
|
149
|
+
if (stdout.includes('status: Invalid') || stdout.includes('status: Rejected')) {
|
|
150
|
+
throw new Error('Apple notarization was rejected. Run:\n' +
|
|
151
|
+
' xcrun notarytool log <submission-id> --apple-id ... --password ... --team-id ...\n' +
|
|
152
|
+
'to see the full rejection reason.');
|
|
153
|
+
}
|
|
154
|
+
// 3. Staple the notarization ticket to the executable
|
|
155
|
+
log_1.log.info('Stapling notarization ticket...');
|
|
156
|
+
(0, child_process_1.execFileSync)('xcrun', ['stapler', 'staple', executable], {
|
|
157
|
+
stdio: 'inherit',
|
|
158
|
+
});
|
|
159
|
+
log_1.log.info('Notarization complete — executable is notarized and stapled.');
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
// 4. Clean up temp zip
|
|
163
|
+
try {
|
|
164
|
+
const fs = require('fs');
|
|
165
|
+
fs.unlinkSync(zipPath);
|
|
166
|
+
}
|
|
167
|
+
catch { }
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.notarizeMachOExecutable = notarizeMachOExecutable;
|
|
171
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
172
|
+
// App bundle signing
|
|
173
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
174
|
+
/**
|
|
175
|
+
* Sign a macOS .app bundle.
|
|
176
|
+
*
|
|
177
|
+
* Uses `codesign --deep` to recursively sign all code in the bundle.
|
|
178
|
+
* This replaces any ad-hoc signature on the inner executable with a
|
|
179
|
+
* proper bundle signature.
|
|
180
|
+
*
|
|
181
|
+
* Identity resolution is the same as signMachOExecutable.
|
|
182
|
+
*/
|
|
183
|
+
function signAppBundle(bundlePath, identity) {
|
|
184
|
+
const id = identity || process.env.HAKOBU_SIGN_IDENTITY || '-';
|
|
185
|
+
if (id === '-') {
|
|
186
|
+
// Ad-hoc: sign the bundle without timestamp/hardened runtime
|
|
187
|
+
try {
|
|
188
|
+
(0, child_process_1.execFileSync)('codesign', ['--deep', '--force', '--sign', '-', bundlePath], {
|
|
189
|
+
stdio: 'inherit',
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
// Non-fatal for ad-hoc — bundle may still work
|
|
194
|
+
}
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
(0, child_process_1.execFileSync)('codesign', [
|
|
198
|
+
'--deep', '--force',
|
|
199
|
+
'--sign', id,
|
|
200
|
+
'--options', 'runtime',
|
|
201
|
+
'--timestamp',
|
|
202
|
+
bundlePath,
|
|
203
|
+
], { stdio: 'inherit' });
|
|
204
|
+
}
|
|
205
|
+
exports.signAppBundle = signAppBundle;
|
|
206
|
+
/**
|
|
207
|
+
* Submit a signed macOS .app bundle for Apple notarization.
|
|
208
|
+
*
|
|
209
|
+
* Similar to notarizeMachOExecutable but targets a .app directory:
|
|
210
|
+
* 1. Zips the .app bundle (ditto preserves bundle structure)
|
|
211
|
+
* 2. Submits to Apple via notarytool
|
|
212
|
+
* 3. Staples the ticket to the .app bundle
|
|
213
|
+
*/
|
|
214
|
+
async function notarizeAppBundle(opts) {
|
|
215
|
+
const { executable: bundlePath, appleId = process.env.HAKOBU_APPLE_ID, applePassword = process.env.HAKOBU_APPLE_PASSWORD, teamId = process.env.HAKOBU_APPLE_TEAM_ID, } = opts;
|
|
216
|
+
if (!appleId || !applePassword || !teamId) {
|
|
217
|
+
const missing = [];
|
|
218
|
+
if (!appleId)
|
|
219
|
+
missing.push('HAKOBU_APPLE_ID');
|
|
220
|
+
if (!applePassword)
|
|
221
|
+
missing.push('HAKOBU_APPLE_PASSWORD');
|
|
222
|
+
if (!teamId)
|
|
223
|
+
missing.push('HAKOBU_APPLE_TEAM_ID');
|
|
224
|
+
throw new Error(`Cannot notarize: missing ${missing.join(', ')}. ` +
|
|
225
|
+
`Set these env vars or pass them as options. See docs/macos-notarization.md.`);
|
|
226
|
+
}
|
|
227
|
+
const zipPath = bundlePath + '.zip';
|
|
228
|
+
log_1.log.info('Creating zip of .app bundle for notarization...');
|
|
229
|
+
(0, child_process_1.execFileSync)('ditto', ['-c', '-k', '--keepParent', bundlePath, zipPath], {
|
|
230
|
+
stdio: 'pipe',
|
|
231
|
+
});
|
|
232
|
+
try {
|
|
233
|
+
log_1.log.info('Submitting .app bundle to Apple notary service...');
|
|
234
|
+
const { stdout } = await execFileAsync('xcrun', [
|
|
235
|
+
'notarytool', 'submit', zipPath,
|
|
236
|
+
'--apple-id', appleId,
|
|
237
|
+
'--password', applePassword,
|
|
238
|
+
'--team-id', teamId,
|
|
239
|
+
'--wait',
|
|
240
|
+
], { timeout: 600000 });
|
|
241
|
+
log_1.log.info(`Notarization result:\n${stdout}`);
|
|
242
|
+
if (stdout.includes('status: Invalid') || stdout.includes('status: Rejected')) {
|
|
243
|
+
throw new Error('Apple notarization was rejected. Run:\n' +
|
|
244
|
+
' xcrun notarytool log <submission-id> --apple-id ... --password ... --team-id ...\n' +
|
|
245
|
+
'to see the full rejection reason.');
|
|
246
|
+
}
|
|
247
|
+
log_1.log.info('Stapling notarization ticket to .app bundle...');
|
|
248
|
+
(0, child_process_1.execFileSync)('xcrun', ['stapler', 'staple', bundlePath], {
|
|
249
|
+
stdio: 'inherit',
|
|
250
|
+
});
|
|
251
|
+
log_1.log.info('Notarization complete — .app bundle is notarized and stapled.');
|
|
252
|
+
}
|
|
253
|
+
finally {
|
|
254
|
+
try {
|
|
255
|
+
const fs = require('fs');
|
|
256
|
+
fs.unlinkSync(zipPath);
|
|
257
|
+
}
|
|
258
|
+
catch { }
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
exports.notarizeAppBundle = notarizeAppBundle;
|
|
262
|
+
//# sourceMappingURL=mach-o.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hakobu Normalized Packaging Manifest
|
|
4
|
+
*
|
|
5
|
+
* This is the canonical internal representation of "what goes into the
|
|
6
|
+
* executable". It sits between analysis (Task 4.2) and snapshot assembly
|
|
7
|
+
* (Task 5), and is the single source of truth for the packaging pipeline.
|
|
8
|
+
*
|
|
9
|
+
* Lifecycle:
|
|
10
|
+
* 1. User config (CLI / package.json / config file)
|
|
11
|
+
* 2. Analysis (walker + resolver scan the project)
|
|
12
|
+
* 3. → NORMALIZED MANIFEST (this file's types) ←
|
|
13
|
+
* 4. Bundle mode (optional — rewrites the script graph)
|
|
14
|
+
* 5. Snapshot assembly (reads manifest → builds snapshot blob)
|
|
15
|
+
* 6. Executable assembly (base binary + snapshot + bootstrap)
|
|
16
|
+
*
|
|
17
|
+
* The manifest is internal-first. It is NOT the user-facing config schema.
|
|
18
|
+
* User config is parsed and normalized into this shape by the analyzer.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Options {
|
|
4
|
+
options;
|
|
5
|
+
constructor() {
|
|
6
|
+
this.options = {
|
|
7
|
+
dictionary: {},
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
set(options) {
|
|
11
|
+
this.options = options ?? this.options;
|
|
12
|
+
}
|
|
13
|
+
get() {
|
|
14
|
+
return this.options;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const options = new Options();
|
|
18
|
+
exports.default = options;
|
|
19
|
+
//# sourceMappingURL=options.js.map
|