@yarn-tool/pkg-entry-util 1.0.2 → 1.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.3](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/pkg-entry-util@1.0.2...@yarn-tool/pkg-entry-util@1.0.3) (2021-12-31)
7
+
8
+
9
+ ### 📦 Code Refactoring
10
+
11
+ * code splitting ([3236306](https://github.com/bluelovers/ws-yarn-workspaces/commit/323630687dcfaa851cd65176d446d55f74a1dd3b))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [1.0.2](https://github.com/bluelovers/ws-yarn-workspaces/compare/@yarn-tool/pkg-entry-util@1.0.1...@yarn-tool/pkg-entry-util@1.0.2) (2021-12-26)
7
18
 
8
19
  **Note:** Version bump only for package @yarn-tool/pkg-entry-util
@@ -0,0 +1,3 @@
1
+ import { IPackageJson } from '@ts-type/package-dts/package-json';
2
+ export declare function fixBinPath(bin: string, root: string): string;
3
+ export declare function fixPkgBinField<T extends IPackageJson>(pkg: T, root: string): T;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fixPkgBinField = exports.fixBinPath = void 0;
4
+ const fs_extra_1 = require("fs-extra");
5
+ const upath2_1 = require("upath2");
6
+ function fixBinPath(bin, root) {
7
+ if (!(0, fs_extra_1.existsSync)((0, upath2_1.join)(root, bin))
8
+ && (0, fs_extra_1.existsSync)((0, upath2_1.join)(root, 'bin', bin))) {
9
+ return (0, upath2_1.join)('.', 'bin', bin);
10
+ }
11
+ return null;
12
+ }
13
+ exports.fixBinPath = fixBinPath;
14
+ function fixPkgBinField(pkg, root) {
15
+ if (pkg.bin) {
16
+ if (typeof pkg.bin === 'string') {
17
+ let bin_new = fixBinPath(pkg.bin, root);
18
+ if (bin_new) {
19
+ // @ts-ignore
20
+ pkg.bin = bin_new;
21
+ }
22
+ }
23
+ else if (typeof pkg.bin === 'object' && !Array.isArray(pkg.bin)) {
24
+ Object.keys(pkg.bin)
25
+ .forEach(function (key) {
26
+ if (typeof pkg.bin[key] === 'string') {
27
+ let bin_new = fixBinPath(pkg.bin[key], root);
28
+ if (bin_new) {
29
+ pkg.bin[key] = bin_new;
30
+ }
31
+ }
32
+ });
33
+ }
34
+ }
35
+ return pkg;
36
+ }
37
+ exports.fixPkgBinField = fixPkgBinField;
38
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["bin.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AACtC,mCAAqC;AAErC,SAAgB,UAAU,CAAC,GAAW,EAAE,IAAY;IAEnD,IACC,CAAC,IAAA,qBAAU,EAAC,IAAA,aAAI,EAAC,IAAI,EAAE,GAAG,CAAC,CAAC;WACzB,IAAA,qBAAU,EAAC,IAAA,aAAI,EAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,EAEtC;QACC,OAAO,IAAA,aAAI,EAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;KAC7B;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAXD,gCAWC;AAED,SAAgB,cAAc,CAAyB,GAAM,EAAE,IAAY;IAE1E,IAAI,GAAG,CAAC,GAAG,EACX;QACC,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ,EAC/B;YACC,IAAI,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAExC,IAAI,OAAO,EACX;gBACC,aAAa;gBACb,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC;aAClB;SACD;aACI,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAC/D;YACC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;iBAClB,OAAO,CAAC,UAAU,GAAG;gBAErB,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,EACpC;oBACC,IAAI,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;oBAE7C,IAAI,OAAO,EACX;wBACC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;qBACvB;iBACD;YACF,CAAC,CAAC,CACF;SACD;KACD;IAED,OAAO,GAAG,CAAA;AACX,CAAC;AAlCD,wCAkCC","sourcesContent":["import { IPackageJson } from '@ts-type/package-dts/package-json';\nimport { existsSync } from 'fs-extra';\nimport { join, posix } from 'upath2';\n\nexport function fixBinPath(bin: string, root: string)\n{\n\tif (\n\t\t!existsSync(join(root, bin))\n\t\t&& existsSync(join(root, 'bin', bin))\n\t)\n\t{\n\t\treturn join('.', 'bin', bin);\n\t}\n\n\treturn null;\n}\n\nexport function fixPkgBinField<T extends IPackageJson>(pkg: T, root: string)\n{\n\tif (pkg.bin)\n\t{\n\t\tif (typeof pkg.bin === 'string')\n\t\t{\n\t\t\tlet bin_new = fixBinPath(pkg.bin, root);\n\n\t\t\tif (bin_new)\n\t\t\t{\n\t\t\t\t// @ts-ignore\n\t\t\t\tpkg.bin = bin_new;\n\t\t\t}\n\t\t}\n\t\telse if (typeof pkg.bin === 'object' && !Array.isArray(pkg.bin))\n\t\t{\n\t\t\tObject.keys(pkg.bin)\n\t\t\t\t.forEach(function (key)\n\t\t\t\t{\n\t\t\t\t\tif (typeof pkg.bin[key] === 'string')\n\t\t\t\t\t{\n\t\t\t\t\t\tlet bin_new = fixBinPath(pkg.bin[key], root);\n\n\t\t\t\t\t\tif (bin_new)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpkg.bin[key] = bin_new;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t;\n\t\t}\n\t}\n\n\treturn pkg\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { IPackageJson } from '@ts-type/package-dts/package-json';
2
+ import { IPackageJsonPublishConfig } from '@ts-type/package-dts/lib/package-json/types';
3
+ export declare function fixPublishConfig<T extends IPackageJson>(pkg: T): T & {
4
+ publishConfig: IPackageJsonPublishConfig;
5
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fixPublishConfig = void 0;
4
+ function fixPublishConfig(pkg) {
5
+ if (!pkg.publishConfig
6
+ && !pkg.private
7
+ && pkg.name
8
+ && /\//.test(pkg.name)) {
9
+ pkg.publishConfig = {
10
+ access: "public",
11
+ };
12
+ }
13
+ return pkg;
14
+ }
15
+ exports.fixPublishConfig = fixPublishConfig;
16
+ //# sourceMappingURL=publishConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publishConfig.js","sourceRoot":"","sources":["publishConfig.ts"],"names":[],"mappings":";;;AAGA,SAAgB,gBAAgB,CAAyB,GAAM;IAE9D,IAAI,CAAC,GAAG,CAAC,aAAa;WAClB,CAAC,GAAG,CAAC,OAAO;WACZ,GAAG,CAAC,IAAI;WACR,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAEvB;QACC,GAAG,CAAC,aAAa,GAAG;YACnB,MAAM,EAAE,QAAQ;SAChB,CAAC;KACF;IACD,OAAO,GAEN,CAAA;AACF,CAAC;AAfD,4CAeC","sourcesContent":["import { IPackageJson } from '@ts-type/package-dts/package-json';\nimport { IPackageJsonPublishConfig } from '@ts-type/package-dts/lib/package-json/types';\n\nexport function fixPublishConfig<T extends IPackageJson>(pkg: T)\n{\n\tif (!pkg.publishConfig\n\t\t&& !pkg.private\n\t\t&& pkg.name\n\t\t&& /\\//.test(pkg.name)\n\t)\n\t{\n\t\tpkg.publishConfig = {\n\t\t\taccess: \"public\",\n\t\t};\n\t}\n\treturn pkg as T & {\n\t\tpublishConfig: IPackageJsonPublishConfig\n\t}\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1 +1,3 @@
1
+ export { fixPkgBinField } from './field/bin';
2
+ export { fixPublishConfig } from './field/publishConfig';
1
3
  export { pkgExportsAddPJsonEntry, pkgExportsVerify } from './field/exports';
package/lib/index.js CHANGED
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pkgExportsVerify = exports.pkgExportsAddPJsonEntry = void 0;
3
+ exports.pkgExportsVerify = exports.pkgExportsAddPJsonEntry = exports.fixPublishConfig = exports.fixPkgBinField = void 0;
4
+ var bin_1 = require("./field/bin");
5
+ Object.defineProperty(exports, "fixPkgBinField", { enumerable: true, get: function () { return bin_1.fixPkgBinField; } });
6
+ var publishConfig_1 = require("./field/publishConfig");
7
+ Object.defineProperty(exports, "fixPublishConfig", { enumerable: true, get: function () { return publishConfig_1.fixPublishConfig; } });
4
8
  var exports_1 = require("./field/exports");
5
9
  Object.defineProperty(exports, "pkgExportsAddPJsonEntry", { enumerable: true, get: function () { return exports_1.pkgExportsAddPJsonEntry; } });
6
10
  Object.defineProperty(exports, "pkgExportsVerify", { enumerable: true, get: function () { return exports_1.pkgExportsVerify; } });
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AACA,2CAA4E;AAAnE,kHAAA,uBAAuB,OAAA;AAAE,2GAAA,gBAAgB,OAAA","sourcesContent":["\nexport { pkgExportsAddPJsonEntry, pkgExportsVerify } from './field/exports';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,mCAA6C;AAApC,qGAAA,cAAc,OAAA;AAEvB,uDAAyD;AAAhD,iHAAA,gBAAgB,OAAA;AAEzB,2CAA4E;AAAnE,kHAAA,uBAAuB,OAAA;AAAE,2GAAA,gBAAgB,OAAA","sourcesContent":["export { fixPkgBinField } from './field/bin';\n\nexport { fixPublishConfig } from './field/publishConfig';\n\nexport { pkgExportsAddPJsonEntry, pkgExportsVerify } from './field/exports';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarn-tool/pkg-entry-util",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "yarn",
@@ -52,13 +52,14 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@ts-type/package-dts": "^1.0.56",
55
- "@yarn-tool/find-root": "^1.0.59",
55
+ "@yarn-tool/find-root": "^1.0.60",
56
56
  "fs-extra": "^10.0.0",
57
- "tslib": "^2.3.1"
57
+ "tslib": "^2.3.1",
58
+ "upath2": "^3.1.12"
58
59
  },
59
60
  "publishConfig": {
60
61
  "access": "public"
61
62
  },
62
63
  "packageManager": "yarn@^1.22.11",
63
- "gitHead": "94c353980d59a7cebfd89d3d6d62bef692d95f69"
64
+ "gitHead": "7035d85a64ab9f80024d65e19b8137e8d4dfdd77"
64
65
  }