binary-collections 2.0.5 → 2.0.7

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 (126) hide show
  1. package/bin/bash-dummy +7 -2
  2. package/bin/clean-nodemodule +7 -2
  3. package/bin/clean-nodemodules +7 -2
  4. package/bin/dev +7 -2
  5. package/bin/empty +7 -2
  6. package/bin/git-diff.cmd +4 -0
  7. package/bin/git-fix-encoding +7 -2
  8. package/bin/git-fix-encoding.cmd +0 -0
  9. package/bin/git-reduce-size +7 -2
  10. package/bin/kill-process +7 -2
  11. package/bin/nodekill +7 -2
  12. package/bin/nodekill.cmd +0 -0
  13. package/bin/nodekill.ps1 +0 -0
  14. package/bin/prod +7 -2
  15. package/bin/rmfind +7 -2
  16. package/bin/rmpath +7 -2
  17. package/bin/rmx +9 -3
  18. package/bin/submodule +13 -2
  19. package/bin/submodule-install +7 -2
  20. package/bin/submodule-remove +7 -2
  21. package/lib/chunk-3LOB2P54.mjs +202 -0
  22. package/lib/chunk-4LEXWIIF.mjs +173 -0
  23. package/lib/chunk-BSD5CIRU.mjs +52 -0
  24. package/lib/chunk-FB6YIQYR.mjs +42 -0
  25. package/lib/chunk-JL32QDSH.mjs +20 -0
  26. package/lib/chunk-OKYLF2MU.mjs +53 -0
  27. package/lib/chunk-VXZQNLPU.mjs +23 -0
  28. package/lib/del-gradle.cjs +72 -0
  29. package/lib/del-gradle.d.mts +2 -0
  30. package/lib/del-gradle.d.ts +1 -0
  31. package/lib/del-gradle.js +15 -0
  32. package/lib/del-gradle.mjs +28 -0
  33. package/lib/del-node-modules.cjs +72 -0
  34. package/lib/del-node-modules.d.mts +2 -0
  35. package/lib/del-node-modules.d.ts +1 -0
  36. package/lib/del-node-modules.js +11 -15
  37. package/lib/del-node-modules.mjs +28 -0
  38. package/lib/del-ps.cjs +93 -0
  39. package/lib/del-ps.d.mts +2 -0
  40. package/lib/del-ps.d.ts +1 -0
  41. package/lib/del-ps.js +31 -0
  42. package/lib/del-ps.mjs +43 -0
  43. package/lib/del-yarn-caches.cjs +65 -0
  44. package/lib/del-yarn-caches.d.mts +2 -0
  45. package/lib/del-yarn-caches.d.ts +1 -0
  46. package/lib/del-yarn-caches.js +6 -9
  47. package/lib/del-yarn-caches.mjs +21 -0
  48. package/lib/find-node-modules-cli.cjs +59 -0
  49. package/lib/find-node-modules-cli.d.mts +1 -0
  50. package/lib/find-node-modules-cli.d.ts +2 -0
  51. package/lib/find-node-modules-cli.js +3 -0
  52. package/lib/find-node-modules-cli.mjs +14 -0
  53. package/lib/find-node-modules.cjs +34 -0
  54. package/lib/find-node-modules.d.mts +10 -0
  55. package/lib/find-node-modules.d.ts +9 -0
  56. package/lib/find-node-modules.js +41 -13
  57. package/lib/find-node-modules.mjs +7 -0
  58. package/lib/git-diff.cjs +74 -0
  59. package/lib/git-diff.d.cts +2 -0
  60. package/lib/git-diff.d.mts +87 -0
  61. package/lib/git-diff.d.ts +87 -0
  62. package/lib/git-diff.mjs +83 -0
  63. package/lib/git-purge.cjs +91 -0
  64. package/lib/git-purge.d.mts +2 -0
  65. package/lib/git-purge.d.ts +1 -0
  66. package/lib/git-purge.js +59 -0
  67. package/lib/git-purge.mjs +47 -0
  68. package/lib/index.cjs +92 -0
  69. package/lib/index.d.mts +1 -0
  70. package/lib/index.d.ts +2 -0
  71. package/lib/index.js +8 -0
  72. package/lib/index.mjs +18 -0
  73. package/lib/npm-run-series.cjs +61 -0
  74. package/lib/npm-run-series.d.mts +1 -0
  75. package/lib/npm-run-series.d.ts +2 -0
  76. package/lib/npm-run-series.js +80 -39
  77. package/lib/npm-run-series.mjs +47 -0
  78. package/lib/package-resolutions.cjs +28 -0
  79. package/lib/package-resolutions.d.mts +25 -0
  80. package/lib/package-resolutions.d.ts +25 -0
  81. package/lib/package-resolutions.mjs +31 -0
  82. package/lib/ps/connected-domain.cjs +156 -0
  83. package/lib/ps/connected-domain.d.mts +3 -0
  84. package/lib/ps/connected-domain.d.ts +2 -0
  85. package/lib/ps/connected-domain.js +202 -0
  86. package/lib/ps/connected-domain.mjs +7 -0
  87. package/lib/ps/index.cjs +555 -0
  88. package/lib/ps/index.d.cjs +17 -0
  89. package/lib/ps/index.d.d.mts +26 -0
  90. package/lib/ps/index.d.d.ts +26 -0
  91. package/lib/ps/index.d.mjs +8 -0
  92. package/lib/ps/index.d.mts +26 -0
  93. package/lib/ps/index.d.ts +2 -0
  94. package/lib/ps/index.js +250 -0
  95. package/lib/ps/index.mjs +203 -0
  96. package/lib/ps/isWin.cjs +3 -0
  97. package/lib/ps/isWin.d.mts +3 -0
  98. package/lib/ps/isWin.d.ts +2 -0
  99. package/lib/ps/isWin.js +2 -0
  100. package/lib/ps/isWin.mjs +7 -0
  101. package/lib/ps/table-parser.cjs +359 -0
  102. package/lib/ps/table-parser.d.mts +3 -0
  103. package/lib/ps/table-parser.d.ts +1 -0
  104. package/lib/ps/table-parser.js +268 -0
  105. package/lib/ps/table-parser.mjs +8 -0
  106. package/lib/submodule-install.cjs +118 -0
  107. package/lib/submodule-install.d.cts +2 -0
  108. package/lib/submodule-install.d.mts +141 -0
  109. package/lib/submodule-install.d.ts +141 -0
  110. package/lib/submodule-install.mjs +116 -0
  111. package/lib/utils.cjs +35 -0
  112. package/lib/utils.d.mts +20 -0
  113. package/lib/utils.d.ts +16 -0
  114. package/lib/utils.js +42 -28
  115. package/lib/utils.mjs +7 -0
  116. package/lib/yarn-reinstall.cjs +42 -0
  117. package/lib/yarn-reinstall.d.cts +1 -0
  118. package/lib/yarn-reinstall.d.mts +45 -0
  119. package/lib/yarn-reinstall.d.ts +45 -0
  120. package/lib/yarn-reinstall.mjs +50 -0
  121. package/package.json +80 -38
  122. package/readme.md +188 -40
  123. package/src/ps/index.js +285 -0
  124. package/test/package.json +19 -0
  125. package/index.js +0 -1
  126. package/lib/package-resolutions.json +0 -22
@@ -1,44 +1,85 @@
1
1
  #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const { Minimatch } = require('minimatch');
6
-
7
- const args = require('minimist')(process.argv.slice(2));
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ const fs = require("fs");
45
+ const path = require("path");
46
+ const { Minimatch } = require("minimatch");
47
+ const args = require("minimist")(process.argv.slice(2));
8
48
  const cwd = process.cwd();
9
- const packagejson = path.join(cwd, 'package.json');
10
- const verbose = args['v'] || args['verbose'];
11
- const usingYarn = args['yarn'];
12
-
13
- (async function npmRunSeries() {
14
- const { execa } = await import('execa');
15
- if (fs.existsSync(packagejson)) {
16
- /**
17
- * @type {import('../package.json')}
18
- */
19
- const parse = JSON.parse(fs.readFileSync(packagejson, 'utf-8'));
20
-
21
- if (parse !== null && typeof parse === 'object') {
22
- if ('scripts' in parse) {
23
- const patterns = args._;
24
- const scripts = parse.scripts;
25
- const scriptNames = Object.keys(scripts);
26
- for (let i = 0; i < patterns.length; i++) {
27
- const pattern = patterns[i];
28
- const matcher = new Minimatch(pattern, { nonegate: true });
29
- for (let ii = 0; ii < scriptNames.length; ii++) {
30
- const scriptName = scriptNames[ii];
31
- const match = matcher.match(scriptName);
32
- if (verbose) console.log({ pattern, scriptName, match });
33
- if (match === true) {
34
- await execa(usingYarn ? 'yarn' : 'npm', ['run', scriptName], {
35
- cwd,
36
- stdio: 'inherit'
37
- });
49
+ const packagejson = path.join(cwd, "package.json");
50
+ const verbose = args["v"] || args["verbose"];
51
+ const usingYarn = args["yarn"];
52
+ (function npmRunSeries() {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const { execa } = yield Promise.resolve().then(() => __importStar(require("execa")));
55
+ if (fs.existsSync(packagejson)) {
56
+ /**
57
+ * @type {import('../package.json')}
58
+ */
59
+ const parse = JSON.parse(fs.readFileSync(packagejson, "utf-8"));
60
+ if (parse !== null && typeof parse === "object") {
61
+ if ("scripts" in parse) {
62
+ const patterns = args._;
63
+ const scripts = parse.scripts;
64
+ const scriptNames = Object.keys(scripts);
65
+ for (let i = 0; i < patterns.length; i++) {
66
+ const pattern = patterns[i];
67
+ const matcher = new Minimatch(pattern, { nonegate: true });
68
+ for (let ii = 0; ii < scriptNames.length; ii++) {
69
+ const scriptName = scriptNames[ii];
70
+ const match = matcher.match(scriptName);
71
+ if (verbose)
72
+ console.log({ pattern, scriptName, match });
73
+ if (match === true) {
74
+ yield execa(usingYarn ? "yarn" : "npm", ["run", scriptName], {
75
+ cwd,
76
+ stdio: "inherit"
77
+ });
78
+ }
79
+ }
80
+ }
81
+ }
38
82
  }
39
- }
40
83
  }
41
- }
42
- }
43
- }
84
+ });
44
85
  })();
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
3
+ import {
4
+ init_esm_shims
5
+ } from "./chunk-VXZQNLPU.mjs";
6
+ import {
7
+ __require
8
+ } from "./chunk-FB6YIQYR.mjs";
9
+
10
+ // src/npm-run-series.js
11
+ init_esm_shims();
12
+ var fs = __require("fs");
13
+ var path = __require("path");
14
+ var { Minimatch } = __require("minimatch");
15
+ var args = __require("minimist")(process.argv.slice(2));
16
+ var cwd = process.cwd();
17
+ var packagejson = path.join(cwd, "package.json");
18
+ var verbose = args["v"] || args["verbose"];
19
+ var usingYarn = args["yarn"];
20
+ (async function npmRunSeries() {
21
+ const { execa } = await import("execa");
22
+ if (fs.existsSync(packagejson)) {
23
+ const parse = JSON.parse(fs.readFileSync(packagejson, "utf-8"));
24
+ if (parse !== null && typeof parse === "object") {
25
+ if ("scripts" in parse) {
26
+ const patterns = args._;
27
+ const scripts = parse.scripts;
28
+ const scriptNames = Object.keys(scripts);
29
+ for (let i = 0; i < patterns.length; i++) {
30
+ const pattern = patterns[i];
31
+ const matcher = new Minimatch(pattern, { nonegate: true });
32
+ for (let ii = 0; ii < scriptNames.length; ii++) {
33
+ const scriptName = scriptNames[ii];
34
+ const match = matcher.match(scriptName);
35
+ if (verbose) console.log({ pattern, scriptName, match });
36
+ if (match === true) {
37
+ await execa(usingYarn ? "yarn" : "npm", ["run", scriptName], {
38
+ cwd,
39
+ stdio: "inherit"
40
+ });
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ })();
@@ -0,0 +1,28 @@
1
+ // src/package-resolutions.json
2
+ var resolutions = {
3
+ "cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/private/release/cross-spawn.tgz",
4
+ safelinkify: "https://github.com/dimaslanjaka/safelink/raw/monorepo/release/safelinkify.tgz",
5
+ "sbg-api": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-api/release/sbg-api.tgz",
6
+ "sbg-cli": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-cli/release/sbg-cli.tgz",
7
+ "sbg-server": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-server/release/sbg-server.tgz",
8
+ "sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-utility/release/sbg-utility.tgz",
9
+ "sitemap-crawler": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sitemap-crawler/release/sitemap-crawler.tgz",
10
+ "static-blog-generator": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/static-blog-generator/release/static-blog-generator.tgz",
11
+ "hexo-blogger-xml": "https://github.com/dimaslanjaka/hexo-blogger-xml/raw/monorepo/release/hexo-blogger-xml.tgz",
12
+ "hexo-post-parser": "https://github.com/dimaslanjaka/hexo-post-parser/raw/monorepo/release/hexo-post-parser.tgz",
13
+ "hexo-asset-link": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-asset-link.tgz",
14
+ "hexo-front-matter": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-front-matter.tgz",
15
+ hexo: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo.tgz",
16
+ "hexo-log": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-log.tgz",
17
+ "hexo-util": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-util.tgz",
18
+ warehouse: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/warehouse.tgz",
19
+ "git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/monorepo/release/git-command-helper.tgz",
20
+ "instant-indexing": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/instant-indexing/release/instant-indexing.tgz"
21
+ };
22
+ var package_resolutions_default = {
23
+ resolutions
24
+ };
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ resolutions
28
+ });
@@ -0,0 +1,25 @@
1
+ var resolutions = {
2
+ "cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/private/release/cross-spawn.tgz",
3
+ safelinkify: "https://github.com/dimaslanjaka/safelink/raw/monorepo/release/safelinkify.tgz",
4
+ "sbg-api": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-api/release/sbg-api.tgz",
5
+ "sbg-cli": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-cli/release/sbg-cli.tgz",
6
+ "sbg-server": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-server/release/sbg-server.tgz",
7
+ "sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-utility/release/sbg-utility.tgz",
8
+ "sitemap-crawler": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sitemap-crawler/release/sitemap-crawler.tgz",
9
+ "static-blog-generator": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/static-blog-generator/release/static-blog-generator.tgz",
10
+ "hexo-blogger-xml": "https://github.com/dimaslanjaka/hexo-blogger-xml/raw/monorepo/release/hexo-blogger-xml.tgz",
11
+ "hexo-post-parser": "https://github.com/dimaslanjaka/hexo-post-parser/raw/monorepo/release/hexo-post-parser.tgz",
12
+ "hexo-asset-link": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-asset-link.tgz",
13
+ "hexo-front-matter": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-front-matter.tgz",
14
+ hexo: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo.tgz",
15
+ "hexo-log": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-log.tgz",
16
+ "hexo-util": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-util.tgz",
17
+ warehouse: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/warehouse.tgz",
18
+ "git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/monorepo/release/git-command-helper.tgz",
19
+ "instant-indexing": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/instant-indexing/release/instant-indexing.tgz"
20
+ };
21
+ var packageResolutions = {
22
+ resolutions: resolutions
23
+ };
24
+
25
+ export { packageResolutions as default, resolutions };
@@ -0,0 +1,25 @@
1
+ var resolutions = {
2
+ "cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/private/release/cross-spawn.tgz",
3
+ safelinkify: "https://github.com/dimaslanjaka/safelink/raw/monorepo/release/safelinkify.tgz",
4
+ "sbg-api": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-api/release/sbg-api.tgz",
5
+ "sbg-cli": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-cli/release/sbg-cli.tgz",
6
+ "sbg-server": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-server/release/sbg-server.tgz",
7
+ "sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-utility/release/sbg-utility.tgz",
8
+ "sitemap-crawler": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sitemap-crawler/release/sitemap-crawler.tgz",
9
+ "static-blog-generator": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/static-blog-generator/release/static-blog-generator.tgz",
10
+ "hexo-blogger-xml": "https://github.com/dimaslanjaka/hexo-blogger-xml/raw/monorepo/release/hexo-blogger-xml.tgz",
11
+ "hexo-post-parser": "https://github.com/dimaslanjaka/hexo-post-parser/raw/monorepo/release/hexo-post-parser.tgz",
12
+ "hexo-asset-link": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-asset-link.tgz",
13
+ "hexo-front-matter": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-front-matter.tgz",
14
+ hexo: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo.tgz",
15
+ "hexo-log": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-log.tgz",
16
+ "hexo-util": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-util.tgz",
17
+ warehouse: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/warehouse.tgz",
18
+ "git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/monorepo/release/git-command-helper.tgz",
19
+ "instant-indexing": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/instant-indexing/release/instant-indexing.tgz"
20
+ };
21
+ var packageResolutions = {
22
+ resolutions: resolutions
23
+ };
24
+
25
+ export { packageResolutions as default, resolutions };
@@ -0,0 +1,31 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import "./chunk-FB6YIQYR.mjs";
3
+
4
+ // src/package-resolutions.json
5
+ var resolutions = {
6
+ "cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/private/release/cross-spawn.tgz",
7
+ safelinkify: "https://github.com/dimaslanjaka/safelink/raw/monorepo/release/safelinkify.tgz",
8
+ "sbg-api": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-api/release/sbg-api.tgz",
9
+ "sbg-cli": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-cli/release/sbg-cli.tgz",
10
+ "sbg-server": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-server/release/sbg-server.tgz",
11
+ "sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-utility/release/sbg-utility.tgz",
12
+ "sitemap-crawler": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sitemap-crawler/release/sitemap-crawler.tgz",
13
+ "static-blog-generator": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/static-blog-generator/release/static-blog-generator.tgz",
14
+ "hexo-blogger-xml": "https://github.com/dimaslanjaka/hexo-blogger-xml/raw/monorepo/release/hexo-blogger-xml.tgz",
15
+ "hexo-post-parser": "https://github.com/dimaslanjaka/hexo-post-parser/raw/monorepo/release/hexo-post-parser.tgz",
16
+ "hexo-asset-link": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-asset-link.tgz",
17
+ "hexo-front-matter": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-front-matter.tgz",
18
+ hexo: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo.tgz",
19
+ "hexo-log": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-log.tgz",
20
+ "hexo-util": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-util.tgz",
21
+ warehouse: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/warehouse.tgz",
22
+ "git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/monorepo/release/git-command-helper.tgz",
23
+ "instant-indexing": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/instant-indexing/release/instant-indexing.tgz"
24
+ };
25
+ var package_resolutions_default = {
26
+ resolutions
27
+ };
28
+ export {
29
+ package_resolutions_default as default,
30
+ resolutions
31
+ };
@@ -0,0 +1,156 @@
1
+ // src/ps/connected-domain.js
2
+ module.exports = function(tdArray, indicator, hardlink) {
3
+ hardlink = hardlink || false;
4
+ if (!tdArray) {
5
+ throw new Error("tdArray must be provided");
6
+ }
7
+ if (!indicator) {
8
+ throw new Error("indicator must be provided");
9
+ }
10
+ tdArray = JSON.parse(JSON.stringify(tdArray));
11
+ var domains = {};
12
+ var domainUUID = 0;
13
+ var pointsHash = {};
14
+ tdArray.forEach(function(row, y) {
15
+ row.forEach(function(colItem, x) {
16
+ var identifier2 = indicator(colItem, x, y);
17
+ var neighbours = [];
18
+ if (tdArray[y - 1] && tdArray[y - 1][x] !== void 0) {
19
+ neighbours.push(pointsHash[x + "_" + (y - 1)]);
20
+ }
21
+ if (row[x - 1] !== void 0) {
22
+ neighbours.push(pointsHash[x - 1 + "_" + y]);
23
+ }
24
+ if (!hardlink) {
25
+ if (tdArray[y - 1] && tdArray[y - 1][x - 1] !== void 0) {
26
+ neighbours.push(pointsHash[x - 1 + "_" + (y - 1)]);
27
+ }
28
+ if (tdArray[y - 1] && tdArray[y - 1][x + 1] !== void 0) {
29
+ neighbours.push(pointsHash[x + 1 + "_" + (y - 1)]);
30
+ }
31
+ }
32
+ if (neighbours.length) {
33
+ var matched = false;
34
+ neighbours.forEach(function(neighbour) {
35
+ if (neighbour.identifier == identifier2) {
36
+ if (!matched) {
37
+ addPointToDomain(colItem, x, y, neighbour.domainId);
38
+ matched = true;
39
+ } else {
40
+ var colItemPoint = pointsHash[x + "_" + y];
41
+ if (neighbour.domainId != colItemPoint.domainId) {
42
+ mergeDomains(neighbour.domainId, colItemPoint.domainId);
43
+ }
44
+ }
45
+ }
46
+ });
47
+ if (!matched) {
48
+ addNewDomain(colItem, x, y, identifier2);
49
+ }
50
+ } else {
51
+ addNewDomain(colItem, x, y, identifier2);
52
+ }
53
+ });
54
+ });
55
+ var result = {
56
+ domains: [],
57
+ totalDomains: 0,
58
+ groupByIdentifier: {},
59
+ totalIdentifiers: 0
60
+ };
61
+ var domainId = null;
62
+ var identifier = null;
63
+ var domain = null;
64
+ for (domainId in domains) {
65
+ domain = domains[domainId];
66
+ domain.bounding = calculateBounding(domain.points);
67
+ identifier = domain.identifier;
68
+ result.domains.push(domain);
69
+ result.totalDomains++;
70
+ if (!(identifier in result.groupByIdentifier)) {
71
+ result.groupByIdentifier[identifier] = [];
72
+ result.totalIdentifiers++;
73
+ }
74
+ result.groupByIdentifier[identifier].push(domain);
75
+ }
76
+ function calculateBounding(points) {
77
+ var minX = null;
78
+ var minY = null;
79
+ var maxX = null;
80
+ var maxY = null;
81
+ points.forEach(function(point) {
82
+ if (minX === null || point.x < minX) {
83
+ minX = point.x;
84
+ }
85
+ if (minY === null || point.y < minY) {
86
+ minY = point.y;
87
+ }
88
+ if (maxX === null || point.x > maxX) {
89
+ maxX = point.x;
90
+ }
91
+ if (maxY === null || point.y > maxY) {
92
+ maxY = point.y;
93
+ }
94
+ });
95
+ var w = maxX - minX;
96
+ var h = maxY - minY;
97
+ return {
98
+ x: minX,
99
+ y: minY,
100
+ w,
101
+ h
102
+ };
103
+ }
104
+ function addNewDomain(point, x, y, identifier2) {
105
+ var newDomain = {
106
+ identifier: identifier2,
107
+ domainId: ++domainUUID,
108
+ bounding: {},
109
+ points: []
110
+ };
111
+ var newPoint = {
112
+ value: point,
113
+ x,
114
+ y,
115
+ identifier: identifier2,
116
+ domainId: newDomain.domainId
117
+ };
118
+ pointsHash[x + "_" + y] = {
119
+ value: point,
120
+ identifier: identifier2,
121
+ domainId: newDomain.domainId
122
+ };
123
+ newDomain.points.push(newPoint);
124
+ domains[newDomain.domainId] = newDomain;
125
+ }
126
+ function addPointToDomain(point, x, y, domainId2) {
127
+ var domain2 = domains[domainId2];
128
+ var newPoint = {
129
+ value: point,
130
+ x,
131
+ y,
132
+ identifier: domain2.identifier,
133
+ domainId: domainId2
134
+ };
135
+ pointsHash[x + "_" + y] = {
136
+ value: point,
137
+ identifier: domain2.identifier,
138
+ domainId: domainId2
139
+ };
140
+ domain2.points.push(newPoint);
141
+ }
142
+ function mergeDomains(domainAId, domainBId) {
143
+ var domainA = domains[domainAId];
144
+ var domainB = domains[domainBId];
145
+ if (domainA.identifier == domainB.identifier) {
146
+ domainB.domainId = domainA.domainId;
147
+ domainB.points.forEach(function(point) {
148
+ point.domainId = domainA.domainId;
149
+ pointsHash[point.x + "_" + point.y].domainId = domainA.domainId;
150
+ });
151
+ domainA.points = domainA.points.concat(domainB.points);
152
+ delete domains[domainBId];
153
+ }
154
+ }
155
+ return result;
156
+ };
@@ -0,0 +1,3 @@
1
+ declare function _exports(tdArray: any[], indicator: Function, hardlink: boolean): any;
2
+
3
+ export { _exports as default };
@@ -0,0 +1,2 @@
1
+ declare function _exports(tdArray: any[], indicator: Function, hardlink: boolean): any;
2
+ export = _exports;
@@ -0,0 +1,202 @@
1
+ /**
2
+ * calculate all the connected domains based on the given two-dimensional array
3
+ */
4
+ /**
5
+ * @param {Array} tdArray
6
+ * @param {Function} indicator It receive the raw point data as the first parameter and decide what kind of domain the point belongs to, it should return a string as a domain identifier.
7
+ * @param {Boolean} hardlink If use hard link. Default to false.
8
+ * @return {Object} [{ bounding: { w: 12, h: 19, x: 0, y: 1 }, points: [ { x: 1, y: 2, point: {} } ], identifier: 'blue', domainId: 1 } ]
9
+ */
10
+ module.exports = function (tdArray, indicator, hardlink) {
11
+ hardlink = hardlink || false;
12
+ if (!tdArray) {
13
+ throw new Error("tdArray must be provided");
14
+ }
15
+ if (!indicator) {
16
+ throw new Error("indicator must be provided");
17
+ }
18
+ // clone 一份数据,因为需要对饮用进行修改,方便执行
19
+ tdArray = JSON.parse(JSON.stringify(tdArray));
20
+ // Result
21
+ var domains = {};
22
+ var domainUUID = 0;
23
+ var pointsHash = {};
24
+ // 遍历数组,划分domain
25
+ tdArray.forEach(function (row, y) {
26
+ row.forEach(function (colItem, x) {
27
+ // get the current point identifier.
28
+ var identifier = indicator(colItem, x, y);
29
+ // get neighbours
30
+ // Except for Undefined every data type is valid.
31
+ var neighbours = [];
32
+ // top neighbour
33
+ if (tdArray[y - 1] && tdArray[y - 1][x] !== undefined) {
34
+ neighbours.push(pointsHash[x + "_" + (y - 1)]);
35
+ }
36
+ // left neighbour
37
+ if (row[x - 1] !== undefined) {
38
+ neighbours.push(pointsHash[x - 1 + "_" + y]);
39
+ }
40
+ // soft link will treat corner link as domain link.
41
+ if (!hardlink) {
42
+ // top left neighbour
43
+ if (tdArray[y - 1] && tdArray[y - 1][x - 1] !== undefined) {
44
+ neighbours.push(pointsHash[x - 1 + "_" + (y - 1)]);
45
+ }
46
+ // top right neighbour
47
+ if (tdArray[y - 1] && tdArray[y - 1][x + 1] !== undefined) {
48
+ neighbours.push(pointsHash[x + 1 + "_" + (y - 1)]);
49
+ }
50
+ }
51
+ if (neighbours.length) {
52
+ var matched = false;
53
+ neighbours.forEach(function (neighbour) {
54
+ if (neighbour.identifier == identifier) {
55
+ // If the neighbour is the first neighbour has the same identifier
56
+ if (!matched) {
57
+ addPointToDomain(colItem, x, y, neighbour.domainId);
58
+ matched = true;
59
+ }
60
+ // If more than one neighbour matched, check if these neighbours belong to the same domain
61
+ // If not, merge these domains since they connects to each other.
62
+ else {
63
+ var colItemPoint = pointsHash[x + "_" + y];
64
+ if (neighbour.domainId != colItemPoint.domainId) {
65
+ mergeDomains(neighbour.domainId, colItemPoint.domainId);
66
+ }
67
+ }
68
+ }
69
+ });
70
+ if (!matched) {
71
+ addNewDomain(colItem, x, y, identifier);
72
+ }
73
+ }
74
+ else {
75
+ addNewDomain(colItem, x, y, identifier);
76
+ }
77
+ });
78
+ });
79
+ // some summary
80
+ var result = {
81
+ domains: [],
82
+ totalDomains: 0,
83
+ groupByIdentifier: {},
84
+ totalIdentifiers: 0
85
+ };
86
+ var domainId = null;
87
+ var identifier = null;
88
+ var domain = null;
89
+ for (domainId in domains) {
90
+ domain = domains[domainId];
91
+ domain.bounding = calculateBounding(domain.points);
92
+ identifier = domain.identifier;
93
+ result.domains.push(domain);
94
+ result.totalDomains++;
95
+ if (!(identifier in result.groupByIdentifier)) {
96
+ result.groupByIdentifier[identifier] = [];
97
+ result.totalIdentifiers++;
98
+ }
99
+ result.groupByIdentifier[identifier].push(domain);
100
+ }
101
+ function calculateBounding(points) {
102
+ var minX = null;
103
+ var minY = null;
104
+ var maxX = null;
105
+ var maxY = null;
106
+ points.forEach(function (point) {
107
+ if (minX === null || point.x < minX) {
108
+ minX = point.x;
109
+ }
110
+ if (minY === null || point.y < minY) {
111
+ minY = point.y;
112
+ }
113
+ if (maxX === null || point.x > maxX) {
114
+ maxX = point.x;
115
+ }
116
+ if (maxY === null || point.y > maxY) {
117
+ maxY = point.y;
118
+ }
119
+ });
120
+ var w = maxX - minX;
121
+ var h = maxY - minY;
122
+ return {
123
+ x: minX,
124
+ y: minY,
125
+ w: w,
126
+ h: h
127
+ };
128
+ }
129
+ /**
130
+ *
131
+ * @param point
132
+ * @param x
133
+ * @param y
134
+ * @param identifier
135
+ */
136
+ function addNewDomain(point, x, y, identifier) {
137
+ var newDomain = {
138
+ identifier: identifier,
139
+ domainId: ++domainUUID,
140
+ bounding: {},
141
+ points: []
142
+ };
143
+ var newPoint = {
144
+ value: point,
145
+ x: x,
146
+ y: y,
147
+ identifier: identifier,
148
+ domainId: newDomain.domainId
149
+ };
150
+ pointsHash[x + "_" + y] = {
151
+ value: point,
152
+ identifier: identifier,
153
+ domainId: newDomain.domainId
154
+ };
155
+ newDomain.points.push(newPoint);
156
+ domains[newDomain.domainId] = newDomain;
157
+ }
158
+ /**
159
+ * add a point to a existing domain, and attach properties domainId and identifier to point.
160
+ * @param point
161
+ * @param x
162
+ * @param y
163
+ * @param domainId
164
+ */
165
+ function addPointToDomain(point, x, y, domainId) {
166
+ var domain = domains[domainId];
167
+ var newPoint = {
168
+ value: point,
169
+ x: x,
170
+ y: y,
171
+ identifier: domain.identifier,
172
+ domainId: domainId
173
+ };
174
+ pointsHash[x + "_" + y] = {
175
+ value: point,
176
+ identifier: domain.identifier,
177
+ domainId: domainId
178
+ };
179
+ domain.points.push(newPoint);
180
+ }
181
+ /**
182
+ * 将 domainB 合并到 domainA
183
+ * @param domainAId
184
+ * @param domainBId
185
+ */
186
+ function mergeDomains(domainAId, domainBId) {
187
+ var domainA = domains[domainAId];
188
+ var domainB = domains[domainBId];
189
+ if (domainA.identifier == domainB.identifier) {
190
+ // 更新 domainB 的domainId
191
+ domainB.domainId = domainA.domainId;
192
+ domainB.points.forEach(function (point) {
193
+ point.domainId = domainA.domainId;
194
+ pointsHash[point.x + "_" + point.y].domainId = domainA.domainId;
195
+ });
196
+ domainA.points = domainA.points.concat(domainB.points);
197
+ // 删除domainB
198
+ delete domains[domainBId];
199
+ }
200
+ }
201
+ return result;
202
+ };