@yao-pkg/pkg 5.9.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 +433 -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 +3 -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/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/bin.js +19 -0
- package/lib-es5/chmod.js +15 -0
- package/lib-es5/common.js +235 -0
- package/lib-es5/compress_type.js +10 -0
- package/lib-es5/detector.js +420 -0
- package/lib-es5/fabricator.js +141 -0
- package/lib-es5/follow.js +91 -0
- package/lib-es5/help.js +53 -0
- package/lib-es5/index.d.ts +2 -0
- package/lib-es5/index.js +541 -0
- package/lib-es5/log.js +7 -0
- package/lib-es5/mach-o.js +61 -0
- package/lib-es5/packer.js +131 -0
- package/lib-es5/producer.js +343 -0
- package/lib-es5/refiner.js +87 -0
- package/lib-es5/types.js +9 -0
- package/lib-es5/walker.js +853 -0
- package/package.json +143 -0
- package/prelude/bootstrap.js +2256 -0
- package/prelude/diagnostic.js +136 -0
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.detect = exports.parse = exports.visitorUseSCWD = exports.visitorMalformed = exports.visitorNonLiteral = exports.visitorSuccessful = void 0;
|
|
30
|
+
const babelTypes = __importStar(require("@babel/types"));
|
|
31
|
+
const babel = __importStar(require("@babel/parser"));
|
|
32
|
+
const generator_1 = __importDefault(require("@babel/generator"));
|
|
33
|
+
const log_1 = require("./log");
|
|
34
|
+
const common_1 = require("./common");
|
|
35
|
+
function isLiteral(node) {
|
|
36
|
+
if (node == null) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (!node.type.endsWith('Literal')) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (node.type === 'TemplateLiteral' && node.expressions.length !== 0) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
function getLiteralValue(node) {
|
|
48
|
+
if (node.type === 'TemplateLiteral') {
|
|
49
|
+
return node.quasis[0].value.raw;
|
|
50
|
+
}
|
|
51
|
+
if (node.type === 'NullLiteral') {
|
|
52
|
+
throw new Error('Unexpected null in require expression');
|
|
53
|
+
}
|
|
54
|
+
if (node.type === 'RegExpLiteral') {
|
|
55
|
+
throw new Error('Unexpected regexp in require expression');
|
|
56
|
+
}
|
|
57
|
+
return node.value;
|
|
58
|
+
}
|
|
59
|
+
function reconstructSpecifiers(specs) {
|
|
60
|
+
if (!specs || !specs.length) {
|
|
61
|
+
return '';
|
|
62
|
+
}
|
|
63
|
+
const defaults = [];
|
|
64
|
+
for (const spec of specs) {
|
|
65
|
+
if (babelTypes.isImportDefaultSpecifier(spec)) {
|
|
66
|
+
defaults.push(spec.local.name);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const nonDefaults = [];
|
|
70
|
+
for (const spec of specs) {
|
|
71
|
+
if (babelTypes.isImportSpecifier(spec)) {
|
|
72
|
+
const importedName = babelTypes.isIdentifier(spec.imported)
|
|
73
|
+
? spec.imported.name
|
|
74
|
+
: spec.imported.value;
|
|
75
|
+
if (spec.local.name === importedName) {
|
|
76
|
+
nonDefaults.push(spec.local.name);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
nonDefaults.push(`${importedName} as ${spec.local.name}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (nonDefaults.length) {
|
|
84
|
+
defaults.push(`{ ${nonDefaults.join(', ')} }`);
|
|
85
|
+
}
|
|
86
|
+
return defaults.join(', ');
|
|
87
|
+
}
|
|
88
|
+
function reconstruct(node) {
|
|
89
|
+
let v = (0, generator_1.default)(node, { comments: false }).code.replace(/\n/g, '');
|
|
90
|
+
let v2;
|
|
91
|
+
while (true) {
|
|
92
|
+
v2 = v.replace(/\[ /g, '[').replace(/ \]/g, ']').replace(/ {2}/g, ' ');
|
|
93
|
+
if (v2 === v) {
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
v = v2;
|
|
97
|
+
}
|
|
98
|
+
return v2;
|
|
99
|
+
}
|
|
100
|
+
function forge(pattern, was) {
|
|
101
|
+
return pattern
|
|
102
|
+
.replace('{c1}', ', ')
|
|
103
|
+
.replace('{v1}', `"${was.v1}"`)
|
|
104
|
+
.replace('{c2}', was.v2 ? ', ' : '')
|
|
105
|
+
.replace('{v2}', was.v2 ? `"${was.v2}"` : '')
|
|
106
|
+
.replace('{c3}', was.v3 ? ' from ' : '')
|
|
107
|
+
.replace('{v3}', was.v3 ? was.v3 : '');
|
|
108
|
+
}
|
|
109
|
+
function valid2(v2) {
|
|
110
|
+
return (v2 === undefined ||
|
|
111
|
+
v2 === null ||
|
|
112
|
+
v2 === 'must-exclude' ||
|
|
113
|
+
v2 === 'may-exclude');
|
|
114
|
+
}
|
|
115
|
+
function visitorRequireResolve(n) {
|
|
116
|
+
if (!babelTypes.isCallExpression(n)) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
if (!babelTypes.isMemberExpression(n.callee)) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
const ci = n.callee.object.type === 'Identifier' &&
|
|
123
|
+
n.callee.object.name === 'require' &&
|
|
124
|
+
n.callee.property.type === 'Identifier' &&
|
|
125
|
+
n.callee.property.name === 'resolve';
|
|
126
|
+
if (!ci) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
if (!n.arguments || !isLiteral(n.arguments[0])) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
v1: getLiteralValue(n.arguments[0]),
|
|
134
|
+
v2: isLiteral(n.arguments[1]) ? getLiteralValue(n.arguments[1]) : null,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function visitorRequire(n) {
|
|
138
|
+
if (!babelTypes.isCallExpression(n)) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
if (!babelTypes.isIdentifier(n.callee)) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
if (n.callee.name !== 'require') {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
if (!n.arguments || !isLiteral(n.arguments[0])) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
v1: getLiteralValue(n.arguments[0]),
|
|
152
|
+
v2: isLiteral(n.arguments[1]) ? getLiteralValue(n.arguments[1]) : null,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function visitorImport(n) {
|
|
156
|
+
if (!babelTypes.isImportDeclaration(n)) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
return { v1: n.source.value, v3: reconstructSpecifiers(n.specifiers) };
|
|
160
|
+
}
|
|
161
|
+
function visitorPathJoin(n) {
|
|
162
|
+
if (!babelTypes.isCallExpression(n)) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
if (!babelTypes.isMemberExpression(n.callee)) {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
const ci = n.callee.object &&
|
|
169
|
+
n.callee.object.type === 'Identifier' &&
|
|
170
|
+
n.callee.object.name === 'path' &&
|
|
171
|
+
n.callee.property &&
|
|
172
|
+
n.callee.property.type === 'Identifier' &&
|
|
173
|
+
n.callee.property.name === 'join';
|
|
174
|
+
if (!ci) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
const dn = n.arguments[0] &&
|
|
178
|
+
n.arguments[0].type === 'Identifier' &&
|
|
179
|
+
n.arguments[0].name === '__dirname';
|
|
180
|
+
if (!dn) {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
const f = n.arguments && isLiteral(n.arguments[1]) && n.arguments.length === 2; // TODO concat them
|
|
184
|
+
if (!f) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
return { v1: getLiteralValue(n.arguments[1]) };
|
|
188
|
+
}
|
|
189
|
+
function visitorSuccessful(node, test = false) {
|
|
190
|
+
let was = visitorRequireResolve(node);
|
|
191
|
+
if (was) {
|
|
192
|
+
if (test) {
|
|
193
|
+
return forge('require.resolve({v1}{c2}{v2})', was);
|
|
194
|
+
}
|
|
195
|
+
if (!valid2(was.v2)) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
alias: was.v1,
|
|
200
|
+
aliasType: common_1.ALIAS_AS_RESOLVABLE,
|
|
201
|
+
mustExclude: was.v2 === 'must-exclude',
|
|
202
|
+
mayExclude: was.v2 === 'may-exclude',
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
was = visitorRequire(node);
|
|
206
|
+
if (was) {
|
|
207
|
+
if (test) {
|
|
208
|
+
return forge('require({v1}{c2}{v2})', was);
|
|
209
|
+
}
|
|
210
|
+
if (!valid2(was.v2)) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
alias: was.v1,
|
|
215
|
+
aliasType: common_1.ALIAS_AS_RESOLVABLE,
|
|
216
|
+
mustExclude: was.v2 === 'must-exclude',
|
|
217
|
+
mayExclude: was.v2 === 'may-exclude',
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
was = visitorImport(node);
|
|
221
|
+
if (was) {
|
|
222
|
+
if (test) {
|
|
223
|
+
return forge('import {v3}{c3}{v1}', was);
|
|
224
|
+
}
|
|
225
|
+
return { alias: was.v1, aliasType: common_1.ALIAS_AS_RESOLVABLE };
|
|
226
|
+
}
|
|
227
|
+
was = visitorPathJoin(node);
|
|
228
|
+
if (was) {
|
|
229
|
+
if (test) {
|
|
230
|
+
return forge('path.join(__dirname{c1}{v1})', was);
|
|
231
|
+
}
|
|
232
|
+
return { alias: was.v1, aliasType: common_1.ALIAS_AS_RELATIVE, mayExclude: false };
|
|
233
|
+
}
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
exports.visitorSuccessful = visitorSuccessful;
|
|
237
|
+
function nonLiteralRequireResolve(n) {
|
|
238
|
+
if (!babelTypes.isCallExpression(n)) {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
if (!babelTypes.isMemberExpression(n.callee)) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
const ci = n.callee.object.type === 'Identifier' &&
|
|
245
|
+
n.callee.object.name === 'require' &&
|
|
246
|
+
n.callee.property.type === 'Identifier' &&
|
|
247
|
+
n.callee.property.name === 'resolve';
|
|
248
|
+
if (!ci) {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
if (isLiteral(n.arguments[0])) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
const m = n.arguments[1];
|
|
255
|
+
if (!m) {
|
|
256
|
+
return { v1: reconstruct(n.arguments[0]) };
|
|
257
|
+
}
|
|
258
|
+
if (!isLiteral(n.arguments[1])) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
v1: reconstruct(n.arguments[0]),
|
|
263
|
+
v2: getLiteralValue(n.arguments[1]),
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function nonLiteralRequire(n) {
|
|
267
|
+
if (!babelTypes.isCallExpression(n)) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
if (!babelTypes.isIdentifier(n.callee)) {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
if (n.callee.name !== 'require') {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
if (isLiteral(n.arguments[0])) {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
const m = n.arguments[1];
|
|
280
|
+
if (!m) {
|
|
281
|
+
return { v1: reconstruct(n.arguments[0]) };
|
|
282
|
+
}
|
|
283
|
+
if (!isLiteral(n.arguments[1])) {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
v1: reconstruct(n.arguments[0]),
|
|
288
|
+
v2: getLiteralValue(n.arguments[1]),
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
function visitorNonLiteral(n) {
|
|
292
|
+
const was = nonLiteralRequireResolve(n) || nonLiteralRequire(n);
|
|
293
|
+
if (was) {
|
|
294
|
+
if (!valid2(was.v2)) {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
alias: was.v1,
|
|
299
|
+
mustExclude: was.v2 === 'must-exclude',
|
|
300
|
+
mayExclude: was.v2 === 'may-exclude',
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
exports.visitorNonLiteral = visitorNonLiteral;
|
|
306
|
+
function isRequire(n) {
|
|
307
|
+
if (!babelTypes.isCallExpression(n)) {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
if (!babelTypes.isIdentifier(n.callee)) {
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
if (n.callee.name !== 'require') {
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
const f = n.arguments && n.arguments[0];
|
|
317
|
+
if (!f) {
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
return { v1: reconstruct(n.arguments[0]) };
|
|
321
|
+
}
|
|
322
|
+
function isRequireResolve(n) {
|
|
323
|
+
if (!babelTypes.isCallExpression(n)) {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
if (!babelTypes.isMemberExpression(n.callee)) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
const ci = n.callee.object.type === 'Identifier' &&
|
|
330
|
+
n.callee.object.name === 'require' &&
|
|
331
|
+
n.callee.property.type === 'Identifier' &&
|
|
332
|
+
n.callee.property.name === 'resolve';
|
|
333
|
+
if (!ci) {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
const f = n.type === 'CallExpression' && n.arguments && n.arguments[0];
|
|
337
|
+
if (!f) {
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
return { v1: reconstruct(n.arguments[0]) };
|
|
341
|
+
}
|
|
342
|
+
function visitorMalformed(n) {
|
|
343
|
+
const was = isRequireResolve(n) || isRequire(n);
|
|
344
|
+
if (was) {
|
|
345
|
+
return { alias: was.v1 };
|
|
346
|
+
}
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
exports.visitorMalformed = visitorMalformed;
|
|
350
|
+
function visitorUseSCWD(n) {
|
|
351
|
+
if (!babelTypes.isCallExpression(n)) {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
if (!babelTypes.isMemberExpression(n.callee)) {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
const ci = n.callee.object.type === 'Identifier' &&
|
|
358
|
+
n.callee.object.name === 'path' &&
|
|
359
|
+
n.callee.property.type === 'Identifier' &&
|
|
360
|
+
n.callee.property.name === 'resolve';
|
|
361
|
+
if (!ci) {
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
const was = { v1: n.arguments.map(reconstruct).join(', ') };
|
|
365
|
+
if (was) {
|
|
366
|
+
return { alias: was.v1 };
|
|
367
|
+
}
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
exports.visitorUseSCWD = visitorUseSCWD;
|
|
371
|
+
function traverse(ast, visitor) {
|
|
372
|
+
// modified esprima-walk to support
|
|
373
|
+
// visitor return value and "trying" flag
|
|
374
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
375
|
+
const stack = [[ast, false]];
|
|
376
|
+
for (let i = 0; i < stack.length; i += 1) {
|
|
377
|
+
const item = stack[i];
|
|
378
|
+
const [node] = item;
|
|
379
|
+
if (node) {
|
|
380
|
+
const trying = item[1] || babelTypes.isTryStatement(node);
|
|
381
|
+
if (visitor(node, trying)) {
|
|
382
|
+
for (const key in node) {
|
|
383
|
+
if (node[key]) {
|
|
384
|
+
const child = node[key];
|
|
385
|
+
if (child instanceof Array) {
|
|
386
|
+
for (let j = 0; j < child.length; j += 1) {
|
|
387
|
+
stack.push([child[j], trying]);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
else if (child && typeof child.type === 'string') {
|
|
391
|
+
stack.push([child, trying]);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function parse(body) {
|
|
400
|
+
return babel.parse(body, {
|
|
401
|
+
allowImportExportEverywhere: true,
|
|
402
|
+
allowReturnOutsideFunction: true,
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
exports.parse = parse;
|
|
406
|
+
function detect(body, visitor) {
|
|
407
|
+
let json;
|
|
408
|
+
try {
|
|
409
|
+
json = parse(body);
|
|
410
|
+
}
|
|
411
|
+
catch (error) {
|
|
412
|
+
log_1.log.warn(`Babel parse has failed: ${error.message}`);
|
|
413
|
+
}
|
|
414
|
+
if (!json) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
traverse(json, visitor);
|
|
418
|
+
}
|
|
419
|
+
exports.detect = detect;
|
|
420
|
+
//# sourceMappingURL=detector.js.map
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shutdown = exports.fabricateTwice = exports.fabricate = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const log_1 = require("./log");
|
|
6
|
+
const script = `
|
|
7
|
+
var vm = require('vm');
|
|
8
|
+
var module = require('module');
|
|
9
|
+
var stdin = Buffer.alloc(0);
|
|
10
|
+
process.stdin.on('data', function (data) {
|
|
11
|
+
stdin = Buffer.concat([ stdin, data ]);
|
|
12
|
+
if (stdin.length >= 4) {
|
|
13
|
+
var sizeOfSnap = stdin.readInt32LE(0);
|
|
14
|
+
if (stdin.length >= 4 + sizeOfSnap + 4) {
|
|
15
|
+
var sizeOfBody = stdin.readInt32LE(4 + sizeOfSnap);
|
|
16
|
+
if (stdin.length >= 4 + sizeOfSnap + 4 + sizeOfBody) {
|
|
17
|
+
var snap = stdin.toString('utf8', 4, 4 + sizeOfSnap);
|
|
18
|
+
var body = Buffer.alloc(sizeOfBody);
|
|
19
|
+
var startOfBody = 4 + sizeOfSnap + 4;
|
|
20
|
+
stdin.copy(body, 0, startOfBody, startOfBody + sizeOfBody);
|
|
21
|
+
stdin = Buffer.alloc(0);
|
|
22
|
+
var code = module.wrap(body);
|
|
23
|
+
var s = new vm.Script(code, {
|
|
24
|
+
filename: snap,
|
|
25
|
+
produceCachedData: true,
|
|
26
|
+
sourceless: true
|
|
27
|
+
});
|
|
28
|
+
if (!s.cachedDataProduced) {
|
|
29
|
+
console.error('Pkg: Cached data not produced.');
|
|
30
|
+
process.exit(2);
|
|
31
|
+
}
|
|
32
|
+
var h = Buffer.alloc(4);
|
|
33
|
+
var b = s.cachedData;
|
|
34
|
+
h.writeInt32LE(b.length, 0);
|
|
35
|
+
process.stdout.write(h);
|
|
36
|
+
process.stdout.write(b);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
process.stdin.resume();
|
|
42
|
+
`;
|
|
43
|
+
const children = {};
|
|
44
|
+
function fabricate(bakes, fabricator, snap, body, cb) {
|
|
45
|
+
const activeBakes = bakes.filter((bake) => {
|
|
46
|
+
// list of bakes that don't influence the bytecode
|
|
47
|
+
const bake2 = bake.replace(/_/g, '-');
|
|
48
|
+
return !['--prof', '--v8-options', '--trace-opt', '--trace-deopt'].includes(bake2);
|
|
49
|
+
});
|
|
50
|
+
const cmd = fabricator.binaryPath;
|
|
51
|
+
const key = JSON.stringify([cmd, activeBakes]);
|
|
52
|
+
let child = children[key];
|
|
53
|
+
if (!child) {
|
|
54
|
+
const stderr = log_1.log.debugMode ? process.stdout : 'ignore';
|
|
55
|
+
children[key] = (0, child_process_1.spawn)(cmd, activeBakes.concat('-e', script), {
|
|
56
|
+
stdio: ['pipe', 'pipe', stderr],
|
|
57
|
+
env: { PKG_EXECPATH: 'PKG_INVOKE_NODEJS' },
|
|
58
|
+
});
|
|
59
|
+
child = children[key];
|
|
60
|
+
}
|
|
61
|
+
function kill() {
|
|
62
|
+
delete children[key];
|
|
63
|
+
child.kill();
|
|
64
|
+
}
|
|
65
|
+
let stdout = Buffer.alloc(0);
|
|
66
|
+
function onError(error) {
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
68
|
+
removeListeners();
|
|
69
|
+
kill();
|
|
70
|
+
cb(new Error(`Failed to make bytecode ${fabricator.nodeRange}-${fabricator.arch} for file ${snap} error (${error.message})`));
|
|
71
|
+
}
|
|
72
|
+
function onClose(code) {
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
74
|
+
removeListeners();
|
|
75
|
+
kill();
|
|
76
|
+
if (code !== 0) {
|
|
77
|
+
return cb(new Error(`Failed to make bytecode ${fabricator.nodeRange}-${fabricator.arch} for file ${snap}`));
|
|
78
|
+
}
|
|
79
|
+
// eslint-disable-next-line no-console
|
|
80
|
+
console.log(stdout.toString());
|
|
81
|
+
return cb(new Error(`${cmd} closed unexpectedly`));
|
|
82
|
+
}
|
|
83
|
+
function onData(data) {
|
|
84
|
+
stdout = Buffer.concat([stdout, data]);
|
|
85
|
+
if (stdout.length >= 4) {
|
|
86
|
+
const sizeOfBlob = stdout.readInt32LE(0);
|
|
87
|
+
if (stdout.length >= 4 + sizeOfBlob) {
|
|
88
|
+
const blob = Buffer.alloc(sizeOfBlob);
|
|
89
|
+
stdout.copy(blob, 0, 4, 4 + sizeOfBlob);
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
91
|
+
removeListeners();
|
|
92
|
+
return cb(undefined, blob);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function removeListeners() {
|
|
97
|
+
child.removeListener('error', onError);
|
|
98
|
+
child.removeListener('close', onClose);
|
|
99
|
+
child.stdin.removeListener('error', onError);
|
|
100
|
+
child.stdout.removeListener('error', onError);
|
|
101
|
+
child.stdout.removeListener('data', onData);
|
|
102
|
+
}
|
|
103
|
+
child.on('error', onError);
|
|
104
|
+
child.on('close', onClose);
|
|
105
|
+
child.stdin.on('error', onError);
|
|
106
|
+
child.stdout.on('error', onError);
|
|
107
|
+
child.stdout.on('data', onData);
|
|
108
|
+
const h = Buffer.alloc(4);
|
|
109
|
+
let b = Buffer.from(snap);
|
|
110
|
+
h.writeInt32LE(b.length, 0);
|
|
111
|
+
child.stdin.write(h);
|
|
112
|
+
child.stdin.write(b);
|
|
113
|
+
b = body;
|
|
114
|
+
h.writeInt32LE(b.length, 0);
|
|
115
|
+
child.stdin.write(h);
|
|
116
|
+
child.stdin.write(b);
|
|
117
|
+
}
|
|
118
|
+
exports.fabricate = fabricate;
|
|
119
|
+
function fabricateTwice(bakes, fabricator, snap, body, cb) {
|
|
120
|
+
fabricate(bakes, fabricator, snap, body, (error, buffer) => {
|
|
121
|
+
// node0 can not produce second time, even if first time produced fine,
|
|
122
|
+
// probably because of 'filename' cache. also, there are weird cases
|
|
123
|
+
// when node4 can not compile as well, for example file 'lib/js-yaml/dumper.js'
|
|
124
|
+
// of package js-yaml@3.9.0 does not get bytecode second time on node4-win-x64
|
|
125
|
+
if (error)
|
|
126
|
+
return fabricate(bakes, fabricator, snap, body, cb);
|
|
127
|
+
cb(undefined, buffer);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
exports.fabricateTwice = fabricateTwice;
|
|
131
|
+
function shutdown() {
|
|
132
|
+
for (const key in children) {
|
|
133
|
+
if (children[key]) {
|
|
134
|
+
const child = children[key];
|
|
135
|
+
delete children[key];
|
|
136
|
+
child.kill();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.shutdown = shutdown;
|
|
141
|
+
//# sourceMappingURL=fabricator.js.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.follow = void 0;
|
|
7
|
+
const resolve_1 = require("resolve");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const common_1 = require("./common");
|
|
11
|
+
const PROOF = 'a-proof-that-main-is-captured.js';
|
|
12
|
+
function parentDirectoriesContain(parent, directory) {
|
|
13
|
+
let currentParent = parent;
|
|
14
|
+
while (true) {
|
|
15
|
+
if (currentParent === directory) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
const newParent = path_1.default.dirname(currentParent);
|
|
19
|
+
if (newParent === currentParent) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
currentParent = newParent;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function follow(x, opts) {
|
|
26
|
+
// TODO async version
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
resolve((0, resolve_1.sync)(x, {
|
|
29
|
+
basedir: opts.basedir,
|
|
30
|
+
extensions: opts.extensions,
|
|
31
|
+
isFile: (file) => {
|
|
32
|
+
if (opts.ignoreFile &&
|
|
33
|
+
path_1.default.join(path_1.default.dirname(opts.ignoreFile), PROOF) === file) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
let stat;
|
|
37
|
+
try {
|
|
38
|
+
stat = fs_1.default.statSync(file);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
const ex = e;
|
|
42
|
+
if (ex && (ex.code === 'ENOENT' || ex.code === 'ENOTDIR'))
|
|
43
|
+
return false;
|
|
44
|
+
throw ex;
|
|
45
|
+
}
|
|
46
|
+
return stat.isFile() || stat.isFIFO();
|
|
47
|
+
},
|
|
48
|
+
isDirectory: (directory) => {
|
|
49
|
+
if (opts.ignoreFile &&
|
|
50
|
+
parentDirectoriesContain(opts.ignoreFile, directory)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
let stat;
|
|
54
|
+
try {
|
|
55
|
+
stat = fs_1.default.statSync(directory);
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
const ex = e;
|
|
59
|
+
if (ex && (ex.code === 'ENOENT' || ex.code === 'ENOTDIR')) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
throw ex;
|
|
63
|
+
}
|
|
64
|
+
return stat.isDirectory();
|
|
65
|
+
},
|
|
66
|
+
readFileSync: (file) => {
|
|
67
|
+
if (opts.ignoreFile && opts.ignoreFile === file) {
|
|
68
|
+
return Buffer.from(`{"main":"${PROOF}"}`);
|
|
69
|
+
}
|
|
70
|
+
if (opts.catchReadFile) {
|
|
71
|
+
opts.catchReadFile(file);
|
|
72
|
+
}
|
|
73
|
+
return fs_1.default.readFileSync(file);
|
|
74
|
+
},
|
|
75
|
+
packageFilter: (config, base, dir) => {
|
|
76
|
+
if (opts.catchPackageFilter) {
|
|
77
|
+
opts.catchPackageFilter(config, base, dir);
|
|
78
|
+
}
|
|
79
|
+
return config;
|
|
80
|
+
},
|
|
81
|
+
/** function to synchronously resolve a potential symlink to its real path */
|
|
82
|
+
// realpathSync?: (file: string) => string;
|
|
83
|
+
realpathSync: (file) => {
|
|
84
|
+
const file2 = (0, common_1.toNormalizedRealPath)(file);
|
|
85
|
+
return file2;
|
|
86
|
+
},
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
exports.follow = follow;
|
|
91
|
+
//# sourceMappingURL=follow.js.map
|
package/lib-es5/help.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
7
|
+
function help() {
|
|
8
|
+
// eslint-disable-next-line no-console
|
|
9
|
+
console.log(`
|
|
10
|
+
${chalk_1.default.bold('pkg')} [options] <input>
|
|
11
|
+
|
|
12
|
+
${chalk_1.default.dim('Options:')}
|
|
13
|
+
|
|
14
|
+
-h, --help output usage information
|
|
15
|
+
-v, --version output pkg version
|
|
16
|
+
-t, --targets comma-separated list of targets (see examples)
|
|
17
|
+
-c, --config package.json or any json file with top-level config
|
|
18
|
+
--options bake v8 options into executable to run with them on
|
|
19
|
+
-o, --output output file name or template for several files
|
|
20
|
+
--out-path path to save output one or more executables
|
|
21
|
+
-d, --debug show more information during packaging process [off]
|
|
22
|
+
-b, --build don't download prebuilt base binaries, build them
|
|
23
|
+
--public speed up and disclose the sources of top-level project
|
|
24
|
+
--public-packages force specified packages to be considered public
|
|
25
|
+
--no-bytecode skip bytecode generation and include source files as plain js
|
|
26
|
+
--no-native-build skip native addons build
|
|
27
|
+
--no-dict comma-separated list of packages names to ignore dictionaries. Use --no-dict * to disable all dictionaries
|
|
28
|
+
-C, --compress [default=None] compression algorithm = Brotli or GZip
|
|
29
|
+
|
|
30
|
+
${chalk_1.default.dim('Examples:')}
|
|
31
|
+
|
|
32
|
+
${chalk_1.default.gray('–')} Makes executables for Linux, macOS and Windows
|
|
33
|
+
${chalk_1.default.cyan('$ pkg index.js')}
|
|
34
|
+
${chalk_1.default.gray('–')} Takes package.json from cwd and follows 'bin' entry
|
|
35
|
+
${chalk_1.default.cyan('$ pkg .')}
|
|
36
|
+
${chalk_1.default.gray('–')} Makes executable for particular target machine
|
|
37
|
+
${chalk_1.default.cyan('$ pkg -t node14-win-arm64 index.js')}
|
|
38
|
+
${chalk_1.default.gray('–')} Makes executables for target machines of your choice
|
|
39
|
+
${chalk_1.default.cyan('$ pkg -t node16-linux,node18-linux,node18-win index.js')}
|
|
40
|
+
${chalk_1.default.gray('–')} Bakes '--expose-gc' and '--max-heap-size=34' into executable
|
|
41
|
+
${chalk_1.default.cyan('$ pkg --options "expose-gc,max-heap-size=34" index.js')}
|
|
42
|
+
${chalk_1.default.gray('–')} Consider packageA and packageB to be public
|
|
43
|
+
${chalk_1.default.cyan('$ pkg --public-packages "packageA,packageB" index.js')}
|
|
44
|
+
${chalk_1.default.gray('–')} Consider all packages to be public
|
|
45
|
+
${chalk_1.default.cyan('$ pkg --public-packages "*" index.js')}
|
|
46
|
+
${chalk_1.default.gray('–')} Bakes '--expose-gc' into executable
|
|
47
|
+
${chalk_1.default.cyan('$ pkg --options expose-gc index.js')}
|
|
48
|
+
${chalk_1.default.gray('–')} reduce size of the data packed inside the executable with GZip
|
|
49
|
+
${chalk_1.default.cyan('$ pkg --compress GZip index.js')}
|
|
50
|
+
`);
|
|
51
|
+
}
|
|
52
|
+
exports.default = help;
|
|
53
|
+
//# sourceMappingURL=help.js.map
|