@gjsify/esbuild-plugin-gjsify 0.0.2 → 0.0.3
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/cjs/index.cjs +125 -126
- package/dist/esm/index.mjs +125 -126
- package/dist/types/lib/index.d.ts +1 -2
- package/dist/types/lib/{cjs.d.ts → lib.d.ts} +1 -1
- package/dist/types/types/plugin-options.d.ts +1 -1
- package/dist/types/utils/extension.d.ts +1 -1
- package/esbuild.mjs +1 -1
- package/package.json +8 -20
- package/src/app/browser.ts +1 -1
- package/src/app/deno.ts +5 -2
- package/src/app/gjs.ts +7 -6
- package/src/app/node.ts +3 -5
- package/src/lib/index.ts +1 -2
- package/src/lib/{esm.ts → lib.ts} +9 -6
- package/src/lodash.d.ts +46 -0
- package/src/plugin.ts +2 -3
- package/src/types/plugin-options.ts +1 -1
- package/src/utils/extension.ts +2 -2
- package/tsconfig.json +4 -0
- package/dist/types/debug-plugin.d.ts +0 -2
- package/dist/types/lib/esm.d.ts +0 -3
- package/src/alias-plugin.ts +0 -68
- package/src/lib/cjs.ts +0 -46
package/dist/cjs/index.cjs
CHANGED
|
@@ -3369,7 +3369,7 @@ var require_stream = __commonJS({
|
|
|
3369
3369
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3370
3370
|
exports.merge = void 0;
|
|
3371
3371
|
var merge22 = require_merge2();
|
|
3372
|
-
function
|
|
3372
|
+
function merge6(streams) {
|
|
3373
3373
|
const mergedStream = merge22(streams);
|
|
3374
3374
|
streams.forEach((stream) => {
|
|
3375
3375
|
stream.once("error", (error) => mergedStream.emit("error", error));
|
|
@@ -3378,7 +3378,7 @@ var require_stream = __commonJS({
|
|
|
3378
3378
|
mergedStream.once("end", () => propagateCloseEventToSources(streams));
|
|
3379
3379
|
return mergedStream;
|
|
3380
3380
|
}
|
|
3381
|
-
exports.merge =
|
|
3381
|
+
exports.merge = merge6;
|
|
3382
3382
|
function propagateCloseEventToSources(streams) {
|
|
3383
3383
|
streams.forEach((stream) => stream.emit("close"));
|
|
3384
3384
|
}
|
|
@@ -5453,6 +5453,84 @@ var require_out4 = __commonJS({
|
|
|
5453
5453
|
}
|
|
5454
5454
|
});
|
|
5455
5455
|
|
|
5456
|
+
// ../esbuild-plugin-alias/dist/cjs/index.cjs
|
|
5457
|
+
var require_cjs = __commonJS({
|
|
5458
|
+
"../esbuild-plugin-alias/dist/cjs/index.cjs"(exports, module2) {
|
|
5459
|
+
var __defProp2 = Object.defineProperty;
|
|
5460
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
5461
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
5462
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
5463
|
+
var __export2 = (target, all) => {
|
|
5464
|
+
for (var name in all)
|
|
5465
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
5466
|
+
};
|
|
5467
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
5468
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
5469
|
+
for (let key of __getOwnPropNames2(from))
|
|
5470
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
5471
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
5472
|
+
}
|
|
5473
|
+
return to;
|
|
5474
|
+
};
|
|
5475
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
5476
|
+
var src_exports2 = {};
|
|
5477
|
+
__export2(src_exports2, {
|
|
5478
|
+
aliasPlugin: () => aliasPlugin6
|
|
5479
|
+
});
|
|
5480
|
+
module2.exports = __toCommonJS2(src_exports2);
|
|
5481
|
+
var import_fs = require("fs");
|
|
5482
|
+
var import_promises = require("fs/promises");
|
|
5483
|
+
function escapeRegExp(str) {
|
|
5484
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5485
|
+
}
|
|
5486
|
+
var aliasPlugin6 = (aliasObj) => {
|
|
5487
|
+
const aliases = Object.keys(aliasObj);
|
|
5488
|
+
const re = new RegExp(`^(${aliases.map((x) => escapeRegExp(x)).join("|")})$`);
|
|
5489
|
+
const plugin = {
|
|
5490
|
+
name: "alias",
|
|
5491
|
+
setup(build) {
|
|
5492
|
+
build.onResolve({ filter: re }, async (args) => {
|
|
5493
|
+
let resolvedAliasPath = aliasObj[args.path];
|
|
5494
|
+
let namespace = args.namespace;
|
|
5495
|
+
if (resolvedAliasPath) {
|
|
5496
|
+
if (resolvedAliasPath.startsWith("http://")) {
|
|
5497
|
+
namespace = "http";
|
|
5498
|
+
resolvedAliasPath = resolvedAliasPath.slice(5);
|
|
5499
|
+
} else if (resolvedAliasPath.startsWith("https://")) {
|
|
5500
|
+
namespace = "https";
|
|
5501
|
+
resolvedAliasPath = resolvedAliasPath.slice(6);
|
|
5502
|
+
} else {
|
|
5503
|
+
const resolvedAlias = await build.resolve(resolvedAliasPath, {
|
|
5504
|
+
importer: args.importer,
|
|
5505
|
+
kind: args.kind,
|
|
5506
|
+
namespace,
|
|
5507
|
+
resolveDir: args.resolveDir,
|
|
5508
|
+
pluginData: args.pluginData
|
|
5509
|
+
});
|
|
5510
|
+
if (resolvedAlias.errors) {
|
|
5511
|
+
return resolvedAlias;
|
|
5512
|
+
} else {
|
|
5513
|
+
resolvedAliasPath = resolvedAlias.path;
|
|
5514
|
+
namespace = resolvedAlias.namespace;
|
|
5515
|
+
}
|
|
5516
|
+
}
|
|
5517
|
+
if ((0, import_fs.existsSync)(resolvedAliasPath)) {
|
|
5518
|
+
resolvedAliasPath = await (0, import_promises.realpath)(resolvedAliasPath);
|
|
5519
|
+
}
|
|
5520
|
+
return {
|
|
5521
|
+
path: resolvedAliasPath,
|
|
5522
|
+
namespace
|
|
5523
|
+
};
|
|
5524
|
+
}
|
|
5525
|
+
return null;
|
|
5526
|
+
});
|
|
5527
|
+
}
|
|
5528
|
+
};
|
|
5529
|
+
return plugin;
|
|
5530
|
+
};
|
|
5531
|
+
}
|
|
5532
|
+
});
|
|
5533
|
+
|
|
5456
5534
|
// ../../../node_modules/lodash/lodash.js
|
|
5457
5535
|
var require_lodash = __commonJS({
|
|
5458
5536
|
"../../../node_modules/lodash/lodash.js"(exports, module2) {
|
|
@@ -9819,7 +9897,7 @@ var require_lodash = __commonJS({
|
|
|
9819
9897
|
});
|
|
9820
9898
|
return result2;
|
|
9821
9899
|
}
|
|
9822
|
-
var
|
|
9900
|
+
var merge6 = createAssigner(function(object, source, srcIndex) {
|
|
9823
9901
|
baseMerge(object, source, srcIndex);
|
|
9824
9902
|
});
|
|
9825
9903
|
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
|
@@ -10010,7 +10088,7 @@ var require_lodash = __commonJS({
|
|
|
10010
10088
|
string = toString(string);
|
|
10011
10089
|
return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
|
|
10012
10090
|
}
|
|
10013
|
-
function
|
|
10091
|
+
function escapeRegExp(string) {
|
|
10014
10092
|
string = toString(string);
|
|
10015
10093
|
return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
|
|
10016
10094
|
}
|
|
@@ -10509,7 +10587,7 @@ var require_lodash = __commonJS({
|
|
|
10509
10587
|
lodash.matches = matches;
|
|
10510
10588
|
lodash.matchesProperty = matchesProperty;
|
|
10511
10589
|
lodash.memoize = memoize;
|
|
10512
|
-
lodash.merge =
|
|
10590
|
+
lodash.merge = merge6;
|
|
10513
10591
|
lodash.mergeWith = mergeWith;
|
|
10514
10592
|
lodash.method = method;
|
|
10515
10593
|
lodash.methodOf = methodOf;
|
|
@@ -10613,7 +10691,7 @@ var require_lodash = __commonJS({
|
|
|
10613
10691
|
lodash.endsWith = endsWith;
|
|
10614
10692
|
lodash.eq = eq;
|
|
10615
10693
|
lodash.escape = escape;
|
|
10616
|
-
lodash.escapeRegExp =
|
|
10694
|
+
lodash.escapeRegExp = escapeRegExp;
|
|
10617
10695
|
lodash.every = every;
|
|
10618
10696
|
lodash.find = find;
|
|
10619
10697
|
lodash.findIndex = findIndex;
|
|
@@ -11304,76 +11382,27 @@ var globToEntryPoints = async (_entryPoints, ignore = []) => {
|
|
|
11304
11382
|
// src/utils/extension.ts
|
|
11305
11383
|
var getJsExtensions = (allowExt) => {
|
|
11306
11384
|
const extensions = { ".js": ".js", ".ts": ".js", ".mts": ".js", ".cts": ".js", ".cjs": ".js", ".mjs": ".js" };
|
|
11307
|
-
if (extensions[allowExt]) {
|
|
11385
|
+
if (allowExt && extensions[allowExt]) {
|
|
11308
11386
|
delete extensions[allowExt];
|
|
11309
11387
|
}
|
|
11310
11388
|
return extensions;
|
|
11311
11389
|
};
|
|
11312
11390
|
|
|
11313
|
-
// src/
|
|
11314
|
-
var
|
|
11315
|
-
var import_promises = require("fs/promises");
|
|
11316
|
-
var aliasPlugin = (aliasObj) => {
|
|
11317
|
-
const aliases = Object.keys(aliasObj);
|
|
11318
|
-
const re = new RegExp(`^(${aliases.map((x) => escapeRegExp(x)).join("|")})$`);
|
|
11319
|
-
const plugin = {
|
|
11320
|
-
name: "alias",
|
|
11321
|
-
setup(build) {
|
|
11322
|
-
build.onResolve({ filter: re }, async (args) => {
|
|
11323
|
-
let resolvedAliasPath = aliasObj[args.path];
|
|
11324
|
-
let namespace = args.namespace;
|
|
11325
|
-
if (resolvedAliasPath) {
|
|
11326
|
-
if (resolvedAliasPath.startsWith("http://")) {
|
|
11327
|
-
namespace = "http";
|
|
11328
|
-
resolvedAliasPath = resolvedAliasPath.slice(5);
|
|
11329
|
-
} else if (resolvedAliasPath.startsWith("https://")) {
|
|
11330
|
-
namespace = "https";
|
|
11331
|
-
resolvedAliasPath = resolvedAliasPath.slice(6);
|
|
11332
|
-
} else {
|
|
11333
|
-
const resolvedAlias = await build.resolve(resolvedAliasPath, {
|
|
11334
|
-
importer: args.importer,
|
|
11335
|
-
kind: args.kind,
|
|
11336
|
-
namespace,
|
|
11337
|
-
resolveDir: args.resolveDir,
|
|
11338
|
-
pluginData: args.pluginData
|
|
11339
|
-
});
|
|
11340
|
-
if (resolvedAlias.errors) {
|
|
11341
|
-
return resolvedAlias;
|
|
11342
|
-
} else {
|
|
11343
|
-
resolvedAliasPath = resolvedAlias.path;
|
|
11344
|
-
namespace = resolvedAlias.namespace;
|
|
11345
|
-
}
|
|
11346
|
-
}
|
|
11347
|
-
if ((0, import_fs.existsSync)(resolvedAliasPath)) {
|
|
11348
|
-
resolvedAliasPath = await (0, import_promises.realpath)(resolvedAliasPath);
|
|
11349
|
-
}
|
|
11350
|
-
return {
|
|
11351
|
-
path: resolvedAliasPath,
|
|
11352
|
-
namespace
|
|
11353
|
-
};
|
|
11354
|
-
}
|
|
11355
|
-
return null;
|
|
11356
|
-
});
|
|
11357
|
-
}
|
|
11358
|
-
};
|
|
11359
|
-
return plugin;
|
|
11360
|
-
};
|
|
11361
|
-
function escapeRegExp(str) {
|
|
11362
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
11363
|
-
}
|
|
11364
|
-
|
|
11365
|
-
// src/lib/cjs.ts
|
|
11391
|
+
// src/lib/lib.ts
|
|
11392
|
+
var import_esbuild_plugin_alias = __toESM(require_cjs(), 1);
|
|
11366
11393
|
var import_esbuild_plugin_transform_ext = require("@gjsify/esbuild-plugin-transform-ext");
|
|
11367
11394
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
11368
|
-
var
|
|
11395
|
+
var setupLib = async (build, pluginOptions) => {
|
|
11396
|
+
const format = pluginOptions.format || "esm";
|
|
11369
11397
|
pluginOptions.aliases ||= {};
|
|
11370
11398
|
pluginOptions.exclude ||= [];
|
|
11371
11399
|
const esbuildOptions = {
|
|
11400
|
+
format,
|
|
11372
11401
|
bundle: false,
|
|
11373
|
-
splitting: false,
|
|
11374
|
-
// only works with esm, see https://esbuild.github.io/api/#splitting
|
|
11375
11402
|
minify: false,
|
|
11376
11403
|
sourcemap: false,
|
|
11404
|
+
splitting: format === "esm" ? true : false,
|
|
11405
|
+
// Works only on esm
|
|
11377
11406
|
loader: {
|
|
11378
11407
|
".ts": "ts",
|
|
11379
11408
|
".mts": "ts",
|
|
@@ -11386,58 +11415,22 @@ var setupCjsLib = async (build, pluginOptions) => {
|
|
|
11386
11415
|
".js": "ts"
|
|
11387
11416
|
},
|
|
11388
11417
|
target: ["esnext"],
|
|
11389
|
-
platform: "
|
|
11418
|
+
platform: "neutral",
|
|
11419
|
+
mainFields: format === "esm" ? ["module", "main"] : ["main"],
|
|
11390
11420
|
// https://esbuild.github.io/api/#conditions
|
|
11391
|
-
conditions: ["require"]
|
|
11392
|
-
format: "cjs"
|
|
11421
|
+
conditions: format === "esm" ? ["module", "import"] : ["require"]
|
|
11393
11422
|
};
|
|
11394
11423
|
(0, import_lodash.merge)(build.initialOptions, esbuildOptions);
|
|
11395
11424
|
build.initialOptions.entryPoints = await globToEntryPoints(build.initialOptions.entryPoints, pluginOptions.exclude);
|
|
11396
|
-
|
|
11397
|
-
console.debug("initialOptions", build.initialOptions);
|
|
11398
|
-
await aliasPlugin(pluginOptions.aliases).setup(build);
|
|
11425
|
+
await (0, import_esbuild_plugin_alias.aliasPlugin)(pluginOptions.aliases).setup(build);
|
|
11399
11426
|
await (0, import_esbuild_plugin_transform_ext.transformExtPlugin)({ outExtension: getJsExtensions(pluginOptions.jsExtension) }).setup(build);
|
|
11400
11427
|
};
|
|
11401
11428
|
|
|
11402
|
-
// src/lib/esm.ts
|
|
11403
|
-
var import_esbuild_plugin_transform_ext2 = require("@gjsify/esbuild-plugin-transform-ext");
|
|
11404
|
-
var import_lodash2 = __toESM(require_lodash(), 1);
|
|
11405
|
-
var setupEsmLib = async (build, pluginOptions) => {
|
|
11406
|
-
pluginOptions.aliases ||= {};
|
|
11407
|
-
pluginOptions.exclude ||= [];
|
|
11408
|
-
const esbuildOptions = {
|
|
11409
|
-
bundle: false,
|
|
11410
|
-
minify: false,
|
|
11411
|
-
sourcemap: false,
|
|
11412
|
-
splitting: true,
|
|
11413
|
-
// Works only on esm
|
|
11414
|
-
loader: {
|
|
11415
|
-
".ts": "ts",
|
|
11416
|
-
".mts": "ts",
|
|
11417
|
-
".cts": "ts",
|
|
11418
|
-
".tsx": "ts",
|
|
11419
|
-
".mtsx": "ts",
|
|
11420
|
-
".ctsx": "ts",
|
|
11421
|
-
".mjs": "ts",
|
|
11422
|
-
".cjs": "ts",
|
|
11423
|
-
".js": "ts"
|
|
11424
|
-
},
|
|
11425
|
-
target: ["esnext"],
|
|
11426
|
-
platform: "browser",
|
|
11427
|
-
// https://esbuild.github.io/api/#conditions
|
|
11428
|
-
conditions: ["module", "import"],
|
|
11429
|
-
format: "esm"
|
|
11430
|
-
};
|
|
11431
|
-
(0, import_lodash2.merge)(build.initialOptions, esbuildOptions);
|
|
11432
|
-
build.initialOptions.entryPoints = await globToEntryPoints(build.initialOptions.entryPoints, pluginOptions.exclude);
|
|
11433
|
-
await aliasPlugin(pluginOptions.aliases).setup(build);
|
|
11434
|
-
await (0, import_esbuild_plugin_transform_ext2.transformExtPlugin)({ outExtension: getJsExtensions(pluginOptions.jsExtension) }).setup(build);
|
|
11435
|
-
};
|
|
11436
|
-
|
|
11437
11429
|
// src/app/browser.ts
|
|
11430
|
+
var import_esbuild_plugin_alias2 = __toESM(require_cjs(), 1);
|
|
11438
11431
|
var import_esbuild_plugin_deno_loader = require("@gjsify/esbuild-plugin-deno-loader");
|
|
11439
11432
|
var deepkitPlugin = __toESM(require("@gjsify/esbuild-plugin-deepkit"), 1);
|
|
11440
|
-
var
|
|
11433
|
+
var import_lodash2 = __toESM(require_lodash(), 1);
|
|
11441
11434
|
var setupForBrowser = async (build, pluginOptions) => {
|
|
11442
11435
|
const external = [];
|
|
11443
11436
|
pluginOptions.aliases ||= {};
|
|
@@ -11472,26 +11465,31 @@ var setupForBrowser = async (build, pluginOptions) => {
|
|
|
11472
11465
|
window: "globalThis"
|
|
11473
11466
|
}
|
|
11474
11467
|
};
|
|
11475
|
-
(0,
|
|
11468
|
+
(0, import_lodash2.merge)(build.initialOptions, esbuildOptions);
|
|
11476
11469
|
build.initialOptions.entryPoints = await globToEntryPoints(build.initialOptions.entryPoints, pluginOptions.exclude);
|
|
11477
11470
|
const aliases = { ...pluginOptions.aliases };
|
|
11478
11471
|
if (pluginOptions.debug)
|
|
11479
11472
|
console.debug("initialOptions", build.initialOptions);
|
|
11480
|
-
await aliasPlugin(aliases).setup(build);
|
|
11473
|
+
await (0, import_esbuild_plugin_alias2.aliasPlugin)(aliases).setup(build);
|
|
11481
11474
|
await (0, import_esbuild_plugin_deno_loader.denoPlugin)({ reflection: pluginOptions.reflection }).setup(build);
|
|
11482
11475
|
await deepkitPlugin.deepkitPlugin({ reflection: pluginOptions.reflection }).setup(build);
|
|
11483
11476
|
};
|
|
11484
11477
|
|
|
11485
11478
|
// src/app/deno.ts
|
|
11479
|
+
var import_esbuild_plugin_alias3 = __toESM(require_cjs(), 1);
|
|
11486
11480
|
var import_esbuild_plugin_deno_loader2 = require("@gjsify/esbuild-plugin-deno-loader");
|
|
11487
11481
|
var deepkitPlugin3 = __toESM(require("@gjsify/esbuild-plugin-deepkit"), 1);
|
|
11488
|
-
var
|
|
11482
|
+
var import_lodash3 = __toESM(require_lodash(), 1);
|
|
11489
11483
|
var setupForDeno = async (build, pluginOptions) => {
|
|
11490
11484
|
const external = [];
|
|
11485
|
+
const format = pluginOptions.format || "esm";
|
|
11486
|
+
if (format !== "esm")
|
|
11487
|
+
throw new TypeError("Only ESM format is supported for Deno");
|
|
11491
11488
|
pluginOptions.aliases ||= {};
|
|
11492
11489
|
pluginOptions.exclude ||= [];
|
|
11493
11490
|
const esbuildOptions = {
|
|
11494
|
-
format
|
|
11491
|
+
format,
|
|
11492
|
+
// Only 'esm' is supported for Deno
|
|
11495
11493
|
bundle: true,
|
|
11496
11494
|
minify: false,
|
|
11497
11495
|
sourcemap: false,
|
|
@@ -11520,29 +11518,30 @@ var setupForDeno = async (build, pluginOptions) => {
|
|
|
11520
11518
|
window: "globalThis"
|
|
11521
11519
|
}
|
|
11522
11520
|
};
|
|
11523
|
-
(0,
|
|
11521
|
+
(0, import_lodash3.merge)(build.initialOptions, esbuildOptions);
|
|
11524
11522
|
build.initialOptions.entryPoints = await globToEntryPoints(build.initialOptions.entryPoints, pluginOptions.exclude);
|
|
11525
11523
|
const aliases = { ...getAliasesForDeno({ external }), ...pluginOptions.aliases };
|
|
11526
11524
|
if (pluginOptions.debug)
|
|
11527
11525
|
console.debug("initialOptions", build.initialOptions);
|
|
11528
|
-
await aliasPlugin(aliases).setup(build);
|
|
11526
|
+
await (0, import_esbuild_plugin_alias3.aliasPlugin)(aliases).setup(build);
|
|
11529
11527
|
await (0, import_esbuild_plugin_deno_loader2.denoPlugin)({ reflection: pluginOptions.reflection }).setup(build);
|
|
11530
11528
|
await deepkitPlugin3.deepkitPlugin({ reflection: pluginOptions.reflection }).setup(build);
|
|
11531
11529
|
};
|
|
11532
11530
|
|
|
11533
11531
|
// src/app/gjs.ts
|
|
11532
|
+
var import_esbuild_plugin_alias4 = __toESM(require_cjs(), 1);
|
|
11534
11533
|
var import_esbuild_plugin_deno_loader3 = require("@gjsify/esbuild-plugin-deno-loader");
|
|
11535
11534
|
var deepkitPlugin5 = __toESM(require("@gjsify/esbuild-plugin-deepkit"), 1);
|
|
11536
|
-
var
|
|
11535
|
+
var import_lodash4 = __toESM(require_lodash(), 1);
|
|
11537
11536
|
var setupForGjs = async (build, pluginOptions) => {
|
|
11538
11537
|
const external = ["gi://*", "cairo", "gettext", "system"];
|
|
11538
|
+
const format = pluginOptions.format || "esm";
|
|
11539
11539
|
pluginOptions.aliases ||= {};
|
|
11540
11540
|
pluginOptions.exclude ||= [];
|
|
11541
11541
|
const esbuildOptions = {
|
|
11542
|
-
format
|
|
11543
|
-
// On Gjs we only support esm
|
|
11542
|
+
format,
|
|
11544
11543
|
bundle: true,
|
|
11545
|
-
metafile:
|
|
11544
|
+
metafile: false,
|
|
11546
11545
|
minify: false,
|
|
11547
11546
|
sourcemap: false,
|
|
11548
11547
|
treeShaking: true,
|
|
@@ -11555,9 +11554,9 @@ var setupForGjs = async (build, pluginOptions) => {
|
|
|
11555
11554
|
// firefox102 // Since GJS 1.73.2
|
|
11556
11555
|
target: ["firefox102"],
|
|
11557
11556
|
platform: "neutral",
|
|
11558
|
-
mainFields: ["module", "main"],
|
|
11557
|
+
mainFields: format === "esm" ? ["module", "main"] : ["main", "module"],
|
|
11559
11558
|
// https://esbuild.github.io/api/#conditions
|
|
11560
|
-
conditions: ["
|
|
11559
|
+
conditions: format === "esm" ? ["import", "require"] : ["require", "import"],
|
|
11561
11560
|
external,
|
|
11562
11561
|
loader: {
|
|
11563
11562
|
".ts": "ts",
|
|
@@ -11575,25 +11574,26 @@ var setupForGjs = async (build, pluginOptions) => {
|
|
|
11575
11574
|
window: "globalThis"
|
|
11576
11575
|
}
|
|
11577
11576
|
};
|
|
11578
|
-
(0,
|
|
11577
|
+
(0, import_lodash4.merge)(build.initialOptions, esbuildOptions);
|
|
11579
11578
|
build.initialOptions.entryPoints = await globToEntryPoints(build.initialOptions.entryPoints, pluginOptions.exclude);
|
|
11580
11579
|
const aliases = { ...getAliasesForGjs({ external }), ...pluginOptions.aliases };
|
|
11581
11580
|
if (pluginOptions.debug)
|
|
11582
11581
|
console.debug("initialOptions", build.initialOptions);
|
|
11583
|
-
await aliasPlugin(aliases).setup(build);
|
|
11582
|
+
await (0, import_esbuild_plugin_alias4.aliasPlugin)(aliases).setup(build);
|
|
11584
11583
|
await (0, import_esbuild_plugin_deno_loader3.denoPlugin)({ reflection: pluginOptions.reflection }).setup(build);
|
|
11585
11584
|
await deepkitPlugin5.deepkitPlugin({ reflection: pluginOptions.reflection }).setup(build);
|
|
11586
11585
|
};
|
|
11587
11586
|
|
|
11588
11587
|
// src/app/node.ts
|
|
11588
|
+
var import_esbuild_plugin_alias5 = __toESM(require_cjs(), 1);
|
|
11589
11589
|
var import_esbuild_plugin_deno_loader4 = require("@gjsify/esbuild-plugin-deno-loader");
|
|
11590
11590
|
var deepkitPlugin7 = __toESM(require("@gjsify/esbuild-plugin-deepkit"), 1);
|
|
11591
|
-
var
|
|
11591
|
+
var import_lodash5 = __toESM(require_lodash(), 1);
|
|
11592
11592
|
var setupForNode = async (build, pluginOptions) => {
|
|
11593
11593
|
const external = [...EXTERNALS_NODE, "gi://*"];
|
|
11594
|
+
const format = pluginOptions.format || "esm";
|
|
11594
11595
|
pluginOptions.aliases ||= {};
|
|
11595
11596
|
pluginOptions.exclude ||= [];
|
|
11596
|
-
const format = pluginOptions.format || "esm";
|
|
11597
11597
|
const esbuildOptions = {
|
|
11598
11598
|
format,
|
|
11599
11599
|
bundle: true,
|
|
@@ -11604,7 +11604,7 @@ var setupForNode = async (build, pluginOptions) => {
|
|
|
11604
11604
|
// false means follow symlinks
|
|
11605
11605
|
target: ["node18"],
|
|
11606
11606
|
platform: "node",
|
|
11607
|
-
mainFields: format === "esm" ? ["module", "main"] : ["main", "module", "browser"],
|
|
11607
|
+
mainFields: format === "esm" ? ["module", "main", "browser"] : ["main", "module", "browser"],
|
|
11608
11608
|
conditions: format === "esm" ? ["module", "import"] : ["require"],
|
|
11609
11609
|
external,
|
|
11610
11610
|
loader: {
|
|
@@ -11623,12 +11623,12 @@ var setupForNode = async (build, pluginOptions) => {
|
|
|
11623
11623
|
window: "globalThis"
|
|
11624
11624
|
}
|
|
11625
11625
|
};
|
|
11626
|
-
(0,
|
|
11626
|
+
(0, import_lodash5.merge)(build.initialOptions, esbuildOptions);
|
|
11627
11627
|
build.initialOptions.entryPoints = await globToEntryPoints(build.initialOptions.entryPoints, pluginOptions.exclude);
|
|
11628
11628
|
const aliases = { ...getAliasesForNode({ external }), ...pluginOptions.aliases };
|
|
11629
11629
|
if (pluginOptions.debug)
|
|
11630
11630
|
console.debug("initialOptions", build.initialOptions);
|
|
11631
|
-
await aliasPlugin(aliases).setup(build);
|
|
11631
|
+
await (0, import_esbuild_plugin_alias5.aliasPlugin)(aliases).setup(build);
|
|
11632
11632
|
await (0, import_esbuild_plugin_deno_loader4.denoPlugin)({ reflection: pluginOptions.reflection }).setup(build);
|
|
11633
11633
|
await deepkitPlugin7.deepkitPlugin({ reflection: pluginOptions.reflection }).setup(build);
|
|
11634
11634
|
};
|
|
@@ -11641,9 +11641,8 @@ var gjsifyPlugin = (pluginOptions = {}) => {
|
|
|
11641
11641
|
if (pluginOptions.library) {
|
|
11642
11642
|
switch (pluginOptions.library) {
|
|
11643
11643
|
case "esm":
|
|
11644
|
-
return setupEsmLib(build, pluginOptions);
|
|
11645
11644
|
case "cjs":
|
|
11646
|
-
return
|
|
11645
|
+
return setupLib(build, pluginOptions);
|
|
11647
11646
|
default:
|
|
11648
11647
|
throw new TypeError("Unknown library type: " + pluginOptions.library);
|
|
11649
11648
|
}
|