adnbn 0.0.25 → 0.0.26

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.
@@ -4,11 +4,11 @@ var cac = require('cac');
4
4
  var webpack = require('webpack');
5
5
  var fs = require('fs');
6
6
  var c12 = require('c12');
7
- var _2 = require('lodash');
7
+ var _ = require('lodash');
8
8
  var ts2 = require('typescript');
9
9
  var path = require('path');
10
- var zod = require('zod');
11
10
  var VirtualModulesPlugin = require('webpack-virtual-modules');
11
+ var zod = require('zod');
12
12
  var TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
13
13
  var MiniCssExtractPlugin = require('mini-css-extract-plugin');
14
14
  var cleanWebpackPlugin = require('clean-webpack-plugin');
@@ -18,7 +18,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
18
18
  var cac__default = /*#__PURE__*/_interopDefault(cac);
19
19
  var webpack__default = /*#__PURE__*/_interopDefault(webpack);
20
20
  var fs__default = /*#__PURE__*/_interopDefault(fs);
21
- var _2__default = /*#__PURE__*/_interopDefault(_2);
21
+ var ___default = /*#__PURE__*/_interopDefault(_);
22
22
  var ts2__default = /*#__PURE__*/_interopDefault(ts2);
23
23
  var path__default = /*#__PURE__*/_interopDefault(path);
24
24
  var VirtualModulesPlugin__default = /*#__PURE__*/_interopDefault(VirtualModulesPlugin);
@@ -3516,97 +3516,8 @@ var resolveImport_default = (importPath, options = {}) => {
3516
3516
  throw new Error(`Cannot resolve "${importPath}" as a local path, alias, or npm package from "${baseDir}"`);
3517
3517
  }
3518
3518
  };
3519
- var ManifestVersionSchema = zod.z.union([zod.z.literal(2), zod.z.literal(3)]);
3520
- var ManifestBuilderSchema = zod.z.custom((value) => {
3521
- return _2__default.default.isObject(value) && !_2__default.default.isPlainObject(value) && !_2__default.default.isArray(value) && !_2__default.default.isNull(value) && !_2__default.default.isUndefined(value);
3522
- });
3523
- zod.z.object({
3524
- /**
3525
- * List of target browsers to include this entrypoint in. Defaults to being included in all
3526
- * builds. Cannot be used with `exclude`. You must choose one of the two options.
3527
- *
3528
- * @default undefined
3529
- */
3530
- includeBrowser: zod.z.array(zod.z.nativeEnum(Browser)).optional(),
3531
- /**
3532
- * List of target browsers to exclude this entrypoint from. Cannot be used with `include`. You
3533
- * must choose one of the two options.
3534
- *
3535
- * @default undefined
3536
- */
3537
- excludeBrowser: zod.z.array(zod.z.nativeEnum(Browser)).optional(),
3538
- /**
3539
- * List of target apps to include this entrypoint in. Defaults to being included in all builds.
3540
- * Cannot be used with `excludeApp`. You must choose one of the two options.
3541
- *
3542
- * @default undefined
3543
- */
3544
- includeApp: zod.z.array(zod.z.string()).optional(),
3545
- /**
3546
- * List of target apps to exclude this entrypoint from. Cannot be used with `includeApp`. You
3547
- * must choose one of the two options.
3548
- *
3549
- * @default undefined
3550
- */
3551
- excludeApp: zod.z.array(zod.z.string()).optional()
3552
- });
3553
- var EntrypointFileSchema = zod.z.object({
3554
- file: zod.z.string(),
3555
- import: zod.z.string(),
3556
- external: zod.z.boolean().optional()
3557
- });
3558
- var WebpackConfigSchema = zod.z.object({}).passthrough();
3559
- var OptionalWebpackConfigSchema = WebpackConfigSchema.optional();
3560
3519
 
3561
- // src/types/plugin.ts
3562
- var createPluginHandlerCallbackSchema = (optionsSchema, returnSchema) => {
3563
- return zod.z.function().args(optionsSchema).returns(zod.z.union([returnSchema, zod.z.promise(returnSchema)]));
3564
- };
3565
- var createPluginHandlerSchema = (optionsSchema, returnSchema) => {
3566
- return zod.z.union([
3567
- zod.z.undefined(),
3568
- returnSchema,
3569
- createPluginHandlerCallbackSchema(optionsSchema, returnSchema)
3570
- ]);
3571
- };
3572
- var PluginEntrypointResultSchema = zod.z.union([
3573
- zod.z.literal(true),
3574
- zod.z.string(),
3575
- zod.z.array(zod.z.string()),
3576
- EntrypointFileSchema,
3577
- zod.z.array(EntrypointFileSchema),
3578
- zod.z.set(EntrypointFileSchema)
3579
- ]);
3580
- var PluginOptionsSchema = zod.z.object({
3581
- config: zod.z.lazy(() => ReadonlyConfigSchema)
3582
- });
3583
- var PluginManifestOptionsSchema = PluginOptionsSchema.extend({
3584
- manifest: ManifestBuilderSchema
3585
- });
3586
- var PluginWebpackOptionsSchema = PluginOptionsSchema.extend({
3587
- webpack: OptionalWebpackConfigSchema
3588
- });
3589
- var PluginNameSchema = zod.z.object({
3590
- name: zod.z.string()
3591
- });
3592
- var PluginSchema = PluginNameSchema.extend({
3593
- content: createPluginHandlerSchema(PluginOptionsSchema, PluginEntrypointResultSchema),
3594
- background: createPluginHandlerSchema(PluginOptionsSchema, PluginEntrypointResultSchema),
3595
- command: createPluginHandlerSchema(PluginOptionsSchema, PluginEntrypointResultSchema),
3596
- webpack: createPluginHandlerSchema(PluginWebpackOptionsSchema, OptionalWebpackConfigSchema),
3597
- manifest: createPluginHandlerSchema(PluginManifestOptionsSchema, zod.z.void())
3598
- });
3599
-
3600
- // src/types/config.ts
3601
- var Browser = /* @__PURE__ */ ((Browser2) => {
3602
- Browser2["Chrome"] = "chrome";
3603
- Browser2["Chromium"] = "chromium";
3604
- Browser2["Edge"] = "edge";
3605
- Browser2["Firefox"] = "firefox";
3606
- Browser2["Opera"] = "opera";
3607
- Browser2["Safari"] = "safari";
3608
- return Browser2;
3609
- })(Browser || {});
3520
+ // src/types/app.ts
3610
3521
  var Mode = /* @__PURE__ */ ((Mode2) => {
3611
3522
  Mode2["None"] = "none";
3612
3523
  Mode2["Development"] = "development";
@@ -3618,41 +3529,17 @@ var Command = /* @__PURE__ */ ((Command2) => {
3618
3529
  Command2["Watch"] = "watch";
3619
3530
  return Command2;
3620
3531
  })(Command || {});
3621
- var ConfigSchema = zod.z.object({
3622
- debug: zod.z.boolean(),
3623
- command: zod.z.nativeEnum(Command),
3624
- mode: zod.z.nativeEnum(Mode),
3625
- app: zod.z.string(),
3626
- browser: zod.z.nativeEnum(Browser),
3627
- manifestVersion: ManifestVersionSchema,
3628
- inputDir: zod.z.string(),
3629
- outputDir: zod.z.string(),
3630
- srcDir: zod.z.string(),
3631
- sharedDir: zod.z.string(),
3632
- appsDir: zod.z.string(),
3633
- jsDir: zod.z.string(),
3634
- cssDir: zod.z.string(),
3635
- assetsDir: zod.z.string(),
3636
- htmlDir: zod.z.string(),
3637
- plugins: zod.z.array(zod.z.lazy(() => PluginSchema)),
3638
- analyze: zod.z.boolean(),
3639
- configFile: zod.z.string(),
3640
- mergeBackground: zod.z.boolean(),
3641
- mergeCommands: zod.z.boolean(),
3642
- mergeContentScripts: zod.z.boolean(),
3643
- concatContentScripts: zod.z.boolean()
3644
- });
3645
- var ReadonlyConfigSchema = ConfigSchema.readonly();
3646
- var OptionalConfigSchema = ConfigSchema.partial();
3647
- var UserConfigSchema = OptionalConfigSchema.omit({
3648
- configFile: true,
3649
- command: true
3650
- });
3651
- var UserConfigCallbackSchema = zod.z.function().args(zod.z.object({ config: ReadonlyConfigSchema })).returns(UserConfigSchema);
3652
- zod.z.union([
3653
- UserConfigCallbackSchema,
3654
- UserConfigSchema
3655
- ]);
3532
+
3533
+ // src/types/browser.ts
3534
+ var Browser = /* @__PURE__ */ ((Browser2) => {
3535
+ Browser2["Chrome"] = "chrome";
3536
+ Browser2["Chromium"] = "chromium";
3537
+ Browser2["Edge"] = "edge";
3538
+ Browser2["Firefox"] = "firefox";
3539
+ Browser2["Opera"] = "opera";
3540
+ Browser2["Safari"] = "safari";
3541
+ return Browser2;
3542
+ })(Browser || {});
3656
3543
 
3657
3544
  // src/cli/parsers/entrypoint/resolvers/core.ts
3658
3545
  var name = "adnbn";
@@ -3951,7 +3838,7 @@ var getCommandOptions = (file) => {
3951
3838
  ]).getOptions();
3952
3839
  };
3953
3840
  var resolvePluginHandler = async (handler, options) => {
3954
- if (_2__default.default.isFunction(handler)) {
3841
+ if (___default.default.isFunction(handler)) {
3955
3842
  const result = handler(options);
3956
3843
  if (result instanceof Promise) {
3957
3844
  return await result;
@@ -3977,18 +3864,18 @@ var getPluginEntrypointFiles = async (config, key2) => {
3977
3864
  if (pluginResult.length > 0) {
3978
3865
  const pluginFiles = pluginResult.reduce((files, { name: name3, result }) => {
3979
3866
  let endpoints = [];
3980
- if (_2__default.default.isBoolean(result)) {
3867
+ if (___default.default.isBoolean(result)) {
3981
3868
  endpoints = [key2];
3982
- } else if (_2__default.default.isString(result) || _2__default.default.isPlainObject(result)) {
3869
+ } else if (___default.default.isString(result) || ___default.default.isPlainObject(result)) {
3983
3870
  endpoints = [result];
3984
- } else if (_2__default.default.isArray(result)) {
3871
+ } else if (___default.default.isArray(result)) {
3985
3872
  endpoints = result;
3986
3873
  } else if (result instanceof Set) {
3987
3874
  endpoints = Array.from(result);
3988
3875
  }
3989
3876
  const endpointFiles = [];
3990
3877
  for (const endpoint of endpoints) {
3991
- if (_2__default.default.isString(endpoint)) {
3878
+ if (___default.default.isString(endpoint)) {
3992
3879
  const resolved = path__default.default.join(name3, endpoint);
3993
3880
  endpointFiles.push({
3994
3881
  file: __require.resolve(resolved, { paths: [process.cwd()] }),
@@ -4235,7 +4122,7 @@ var EntrypointPlugin = class _EntrypointPlugin {
4235
4122
  }
4236
4123
  }
4237
4124
  hookEntryOption(entry) {
4238
- if (_2__default.default.isPlainObject(entry)) {
4125
+ if (___default.default.isPlainObject(entry)) {
4239
4126
  this.modules.entries().forEach(([name3, modules]) => {
4240
4127
  let currentFiles = structuredClone(entry[name3] ?? []);
4241
4128
  if ("import" in currentFiles) {
@@ -4243,7 +4130,7 @@ var EntrypointPlugin = class _EntrypointPlugin {
4243
4130
  }
4244
4131
  currentFiles.push(...Array.from(modules.values(), ({ name: name4 }) => name4));
4245
4132
  entry[name3] = {
4246
- import: _2__default.default.uniq(currentFiles)
4133
+ import: ___default.default.uniq(currentFiles)
4247
4134
  };
4248
4135
  });
4249
4136
  } else {
@@ -4286,16 +4173,16 @@ var EntrypointPlugin = class _EntrypointPlugin {
4286
4173
  }
4287
4174
  entry = entry.filter((file) => !removedContents.has(file));
4288
4175
  entry.push(...Array.from(modules.values(), ({ name: name4 }) => name4));
4289
- compiler.options.entry[name3] = _2__default.default.uniq(entry);
4176
+ compiler.options.entry[name3] = ___default.default.uniq(entry);
4290
4177
  });
4291
4178
  }
4292
4179
  this._modules = updatedModules;
4293
4180
  }
4294
4181
  createModules(entries) {
4295
4182
  const entryModules = /* @__PURE__ */ new Map();
4296
- _2__default.default.forEach(entries, (files, name3) => {
4183
+ ___default.default.forEach(entries, (files, name3) => {
4297
4184
  const modules = /* @__PURE__ */ new Map();
4298
- _2__default.default.forEach(files, (file) => {
4185
+ ___default.default.forEach(files, (file) => {
4299
4186
  modules.set(file, {
4300
4187
  name: _EntrypointPlugin.filename(file),
4301
4188
  module: this.template ? this.template(file) : ""
@@ -4471,7 +4358,7 @@ var background_default3 = definePlugin(() => {
4471
4358
  chunks(chunk) {
4472
4359
  var _a;
4473
4360
  const { chunks } = ((_a = webpack4.optimization) == null ? void 0 : _a.splitChunks) || {};
4474
- if (_2__default.default.isFunction(chunks) && !chunks(chunk)) {
4361
+ if (___default.default.isFunction(chunks) && !chunks(chunk)) {
4475
4362
  return false;
4476
4363
  }
4477
4364
  return chunk.name !== name2;
@@ -4489,6 +4376,117 @@ var background_default3 = definePlugin(() => {
4489
4376
  }
4490
4377
  };
4491
4378
  });
4379
+ var WebpackConfigSchema = zod.z.object({}).passthrough();
4380
+ var OptionalWebpackConfigSchema = WebpackConfigSchema.optional();
4381
+ var ManifestBuilderSchema = zod.z.custom((value) => {
4382
+ return ___default.default.isObject(value) && !___default.default.isPlainObject(value) && !___default.default.isArray(value) && !___default.default.isNull(value) && !___default.default.isUndefined(value);
4383
+ });
4384
+ var ManifestVersionSchema = zod.z.union([zod.z.literal(2), zod.z.literal(3)]);
4385
+ zod.z.object({
4386
+ /**
4387
+ * List of target browsers to include this entrypoint in. Defaults to being included in all
4388
+ * builds. Cannot be used with `exclude`. You must choose one of the two options.
4389
+ *
4390
+ * @default undefined
4391
+ */
4392
+ includeBrowser: zod.z.array(zod.z.nativeEnum(Browser)).optional(),
4393
+ /**
4394
+ * List of target browsers to exclude this entrypoint from. Cannot be used with `include`. You
4395
+ * must choose one of the two options.
4396
+ *
4397
+ * @default undefined
4398
+ */
4399
+ excludeBrowser: zod.z.array(zod.z.nativeEnum(Browser)).optional(),
4400
+ /**
4401
+ * List of target apps to include this entrypoint in. Defaults to being included in all builds.
4402
+ * Cannot be used with `excludeApp`. You must choose one of the two options.
4403
+ *
4404
+ * @default undefined
4405
+ */
4406
+ includeApp: zod.z.array(zod.z.string()).optional(),
4407
+ /**
4408
+ * List of target apps to exclude this entrypoint from. Cannot be used with `includeApp`. You
4409
+ * must choose one of the two options.
4410
+ *
4411
+ * @default undefined
4412
+ */
4413
+ excludeApp: zod.z.array(zod.z.string()).optional()
4414
+ });
4415
+ var EntrypointFileSchema = zod.z.object({
4416
+ file: zod.z.string(),
4417
+ import: zod.z.string(),
4418
+ external: zod.z.boolean().optional()
4419
+ });
4420
+ var createPluginHandlerCallbackSchema = (optionsSchema, returnSchema) => {
4421
+ return zod.z.function().args(optionsSchema).returns(zod.z.union([returnSchema, zod.z.promise(returnSchema)]));
4422
+ };
4423
+ var createPluginHandlerSchema = (optionsSchema, returnSchema) => {
4424
+ return zod.z.union([
4425
+ zod.z.undefined(),
4426
+ returnSchema,
4427
+ createPluginHandlerCallbackSchema(optionsSchema, returnSchema)
4428
+ ]);
4429
+ };
4430
+ var PluginEntrypointResultSchema = zod.z.union([
4431
+ zod.z.literal(true),
4432
+ zod.z.string(),
4433
+ zod.z.array(zod.z.string()),
4434
+ EntrypointFileSchema,
4435
+ zod.z.array(EntrypointFileSchema),
4436
+ zod.z.set(EntrypointFileSchema)
4437
+ ]);
4438
+ var PluginOptionsSchema = zod.z.object({
4439
+ config: zod.z.lazy(() => ReadonlyConfigSchema)
4440
+ });
4441
+ var PluginManifestOptionsSchema = PluginOptionsSchema.extend({
4442
+ manifest: ManifestBuilderSchema
4443
+ });
4444
+ var PluginWebpackOptionsSchema = PluginOptionsSchema.extend({
4445
+ webpack: OptionalWebpackConfigSchema
4446
+ });
4447
+ var PluginSchema = zod.z.object({
4448
+ name: zod.z.string(),
4449
+ content: createPluginHandlerSchema(PluginOptionsSchema, PluginEntrypointResultSchema),
4450
+ background: createPluginHandlerSchema(PluginOptionsSchema, PluginEntrypointResultSchema),
4451
+ command: createPluginHandlerSchema(PluginOptionsSchema, PluginEntrypointResultSchema),
4452
+ webpack: createPluginHandlerSchema(PluginWebpackOptionsSchema, OptionalWebpackConfigSchema),
4453
+ manifest: createPluginHandlerSchema(PluginManifestOptionsSchema, zod.z.void())
4454
+ });
4455
+ var ConfigSchema = zod.z.object({
4456
+ debug: zod.z.boolean(),
4457
+ command: zod.z.nativeEnum(Command),
4458
+ mode: zod.z.nativeEnum(Mode),
4459
+ app: zod.z.string(),
4460
+ browser: zod.z.nativeEnum(Browser),
4461
+ manifestVersion: ManifestVersionSchema,
4462
+ inputDir: zod.z.string(),
4463
+ outputDir: zod.z.string(),
4464
+ srcDir: zod.z.string(),
4465
+ sharedDir: zod.z.string(),
4466
+ appsDir: zod.z.string(),
4467
+ jsDir: zod.z.string(),
4468
+ cssDir: zod.z.string(),
4469
+ assetsDir: zod.z.string(),
4470
+ htmlDir: zod.z.string(),
4471
+ plugins: zod.z.array(PluginSchema),
4472
+ analyze: zod.z.boolean(),
4473
+ configFile: zod.z.string(),
4474
+ mergeBackground: zod.z.boolean(),
4475
+ mergeCommands: zod.z.boolean(),
4476
+ mergeContentScripts: zod.z.boolean(),
4477
+ concatContentScripts: zod.z.boolean()
4478
+ });
4479
+ var ReadonlyConfigSchema = ConfigSchema.readonly();
4480
+ var OptionalConfigSchema = ConfigSchema.partial();
4481
+ var UserConfigSchema = OptionalConfigSchema.omit({
4482
+ configFile: true,
4483
+ command: true
4484
+ });
4485
+ var UserConfigCallbackSchema = zod.z.function().args(zod.z.object({ config: ReadonlyConfigSchema })).returns(UserConfigSchema);
4486
+ zod.z.union([
4487
+ UserConfigCallbackSchema,
4488
+ UserConfigSchema
4489
+ ]);
4492
4490
 
4493
4491
  // src/cli/resolvers/config.ts
4494
4492
  var getUserConfig = async (config) => {
@@ -5021,7 +5019,7 @@ var app_default = async (config) => {
5021
5019
  };
5022
5020
 
5023
5021
  // package.json
5024
- var version = "0.0.24";
5022
+ var version = "0.0.25";
5025
5023
 
5026
5024
  // src/cli/index.ts
5027
5025
  var cli = cac__default.default("adnbn");