pkgbld 1.22.0 → 1.23.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.
Files changed (2) hide show
  1. package/dist/index.js +13 -7
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ function CommaSeparatedStringOrBoolean(value) {
37
37
  if (typeof value === 'boolean') {
38
38
  return value;
39
39
  }
40
+ // TODO check how we get array here
40
41
  if (Array.isArray(value) && value.length === 0) {
41
42
  return true;
42
43
  }
@@ -162,6 +163,7 @@ const packageJsonFieldsOrder = new Set([
162
163
  'imports',
163
164
  'types',
164
165
  'typings',
166
+ 'typesVersions',
165
167
  'files',
166
168
  'packageManager',
167
169
  'sideEffects',
@@ -269,7 +271,7 @@ async function externals (provider, config, inputs) {
269
271
  const allowGenericUmd = config.umdInputs.length === 1 && inputs.length === 1;
270
272
  if (config.formats.length > 0) {
271
273
  const format = (allowGenericUmd ? undefined : config.formats.filter(format => format !== 'umd'));
272
- provider.provide(() => pluginExternals({
274
+ provider.provide(() => pluginExternals(config.includeExternals === false ? {} : {
273
275
  external: (id, external, importer) => includeExternals(importer, external, id, config)
274
276
  }), 2000 /* Priority.externals */, { format });
275
277
  // for eject config
@@ -720,12 +722,13 @@ function processPackage(pkg, config, plugins) {
720
722
  if (typeof pkg.exports[id] !== 'object') {
721
723
  pkg.exports[id] = {};
722
724
  }
725
+ pkg.exports[id].types = `./${config.dir}/${patternToName('[name].d.ts', basename)}`;
726
+ if (allowEsm) {
727
+ pkg.exports[id].import = `./${config.dir}/${patternToName(config.esPattern, basename)}`;
728
+ }
723
729
  if (allowCjs) {
724
730
  pkg.exports[id].require = `./${config.dir}/${patternToName(config.commonjsPattern, basename)}`;
725
731
  }
726
- if (allowEsm) {
727
- pkg.exports[id].default = `./${config.dir}/${patternToName(config.esPattern, basename)}`;
728
- }
729
732
  if (basename !== 'index') {
730
733
  if (!pkg.files.includes(basename)) {
731
734
  pkg.files.push(basename);
@@ -749,13 +752,13 @@ async function writeJson(path, json) {
749
752
  await fs.writeFile(path, toFormattedJson(json));
750
753
  }
751
754
 
752
- var version = "1.22.0";
755
+ var version = "1.23.0";
753
756
  var name = "pkgbld";
754
757
  var license = "MIT";
755
758
  var author = "Konstantin Shutkin";
756
759
  var bin = "./dist/index.js";
757
760
  var main = "./dist/index.js";
758
- var typings = "./dist/index.d.ts";
761
+ var types = "./dist/index.d.ts";
759
762
  var files = [
760
763
  "dist"
761
764
  ];
@@ -816,7 +819,7 @@ var pkgbldPkg = {
816
819
  author: author,
817
820
  bin: bin,
818
821
  main: main,
819
- typings: typings,
822
+ types: types,
820
823
  files: files,
821
824
  engines: engines,
822
825
  repository: repository,
@@ -875,8 +878,11 @@ async function ejectConfig(config, pkgPath, options, inputs, helpers, pkg) {
875
878
  if (options.formats.includes('umd')) {
876
879
  imports.set('path', 'path');
877
880
  imports.set('lodash/camelCase.js', 'camelCase');
881
+ imports.set('url', 'url'); // for __dirname polyfill
878
882
  setup.add(`const pkgName = ${generate(pkgName)}`);
879
883
  setup.add(helpers.getGlobalName.toString());
884
+ // polyfill __dirname
885
+ setup.add('const __dirname = url.fileURLToPath(new URL(\'.\', import.meta.url));');
880
886
  }
881
887
  // imports
882
888
  const importsString = Array.from(imports)
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
- "version": "1.22.0",
2
+ "version": "1.23.0",
3
3
  "name": "pkgbld",
4
4
  "license": "MIT",
5
5
  "author": "Konstantin Shutkin",
6
6
  "bin": "./dist/index.js",
7
7
  "main": "./dist/index.js",
8
- "typings": "./dist/index.d.ts",
8
+ "types": "./dist/index.d.ts",
9
9
  "files": [
10
10
  "dist"
11
11
  ],
@@ -50,7 +50,7 @@
50
50
  "devDependencies": {
51
51
  "@types/lodash": "^4.14.199",
52
52
  "@total-typescript/ts-reset": "^0.5.1",
53
- "options": "0.0.1"
53
+ "options": "0.1.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "typescript": "^5.2.2"