tsds-lib-test 1.4.12 → 1.5.2
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/lib/data.js +10 -4
- package/dist/cjs/lib/data.js.map +1 -1
- package/dist/esm/lib/data.mjs +10 -4
- package/dist/esm/lib/data.mjs.map +1 -1
- package/package.json +4 -3
package/dist/cjs/lib/data.js
CHANGED
|
@@ -10,11 +10,13 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
12
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
+
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
13
14
|
var _crossspawncb = /*#__PURE__*/ _interop_require_default(require("cross-spawn-cb"));
|
|
14
15
|
var _mkdirpclassic = /*#__PURE__*/ _interop_require_default(require("mkdirp-classic"));
|
|
15
16
|
var _osshim = /*#__PURE__*/ _interop_require_default(require("os-shim"));
|
|
16
17
|
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
17
18
|
var _shorthash = /*#__PURE__*/ _interop_require_default(require("short-hash"));
|
|
19
|
+
var _tsdslib = require("tsds-lib");
|
|
18
20
|
var _prepareGit = /*#__PURE__*/ _interop_require_default(require("./prepareGit.js"));
|
|
19
21
|
function _array_like_to_array(arr, len) {
|
|
20
22
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -46,7 +48,10 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
46
48
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
47
49
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
var __dirname = _path.default.dirname(typeof __filename !== 'undefined' ? __filename : _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()));
|
|
52
|
+
var major = +process.versions.node.split('.')[0];
|
|
53
|
+
var workerWrapper = (0, _tsdslib.wrapWorker)(_path.default.join((0, _tsdslib.packageRoot)(__dirname), 'dist', 'cjs', 'lib', 'data.js'));
|
|
54
|
+
function worker(git, options, callback) {
|
|
50
55
|
var cwd = options.cwd || process.cwd();
|
|
51
56
|
var pkg = JSON.parse(_fs.default.readFileSync(_path.default.join(cwd, 'package.json'), 'utf8'));
|
|
52
57
|
var dest = _path.default.join(_osshim.default.tmpdir(), pkg.name, (0, _shorthash.default)(cwd));
|
|
@@ -62,10 +67,8 @@ function data(git, options, callback) {
|
|
|
62
67
|
// clone or reset the git repo
|
|
63
68
|
queue.defer(_prepareGit.default.bind(null, git, options));
|
|
64
69
|
// install
|
|
65
|
-
queue.defer(_crossspawncb.default.bind(null, '
|
|
66
|
-
'lts',
|
|
70
|
+
queue.defer(_crossspawncb.default.bind(null, 'npm', [
|
|
67
71
|
'--silent',
|
|
68
|
-
'npm',
|
|
69
72
|
'install'
|
|
70
73
|
], {
|
|
71
74
|
cwd: targetPath
|
|
@@ -84,4 +87,7 @@ function data(git, options, callback) {
|
|
|
84
87
|
});
|
|
85
88
|
}
|
|
86
89
|
}
|
|
90
|
+
function data(git, options, callback) {
|
|
91
|
+
major < 14 ? workerWrapper('stable', git, options, callback) : worker(git, options, callback);
|
|
92
|
+
}
|
|
87
93
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
package/dist/cjs/lib/data.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["data.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport mkdirp from 'mkdirp-classic';\nimport os from 'os-shim';\nimport Queue from 'queue-cb';\nimport shortHash from 'short-hash';\
|
|
1
|
+
{"version":3,"sources":["data.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport url from 'url';\nimport spawn from 'cross-spawn-cb';\nimport mkdirp from 'mkdirp-classic';\nimport os from 'os-shim';\nimport Queue from 'queue-cb';\nimport shortHash from 'short-hash';\nimport { packageRoot, wrapWorker } from 'tsds-lib';\nimport prepareGit from './prepareGit.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst major = +process.versions.node.split('.')[0];\nconst workerWrapper = wrapWorker(path.join(packageRoot(__dirname), 'dist', 'cjs', 'lib', 'data.js'));\n\nfunction worker(git, options, callback) {\n const cwd = options.cwd || process.cwd();\n const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));\n const dest = path.join(os.tmpdir(), pkg.name, shortHash(cwd));\n const targetName = path.basename(git, path.extname(git));\n const targetPath = path.join(dest, targetName);\n mkdirp.sync(dest);\n\n const queue = new Queue(1);\n for (const binName in pkg.bin) {\n const packagePath = path.resolve(targetPath, 'node_modules', pkg.name);\n const binPath = path.resolve(targetPath, 'node_modules', '.bin', binName);\n\n console.log('------------------');\n console.log(`Preparing: ${targetPath}`);\n\n // clone or reset the git repo\n queue.defer(prepareGit.bind(null, git, options));\n\n // install\n queue.defer(spawn.bind(null, 'npm', ['--silent', 'install'], { cwd: targetPath }));\n\n // link package\n queue.defer(fs.rename.bind(null, packagePath, `${packagePath}.tsds`));\n queue.defer(fs.symlink.bind(null, cwd, packagePath, 'dir'));\n\n // link bin\n queue.defer(fs.rename.bind(null, binPath, `${binPath}.tsds`));\n queue.defer(fs.symlink.bind(null, path.resolve.apply(null, [cwd, ...pkg.bin[binName].split('/')]), binPath, 'file'));\n\n queue.await((err) => {\n console.log('------------------');\n err ? callback(err) : callback(null, targetPath);\n });\n }\n}\n\nexport default function data(git, options, callback) {\n major < 14 ? workerWrapper('stable', git, options, callback) : worker(git, options, callback);\n}\n"],"names":["data","__dirname","path","dirname","__filename","url","fileURLToPath","major","process","versions","node","split","workerWrapper","wrapWorker","join","packageRoot","worker","git","options","callback","cwd","pkg","JSON","parse","fs","readFileSync","dest","os","tmpdir","name","shortHash","targetName","basename","extname","targetPath","mkdirp","sync","queue","Queue","binName","bin","packagePath","resolve","binPath","console","log","defer","prepareGit","bind","spawn","rename","symlink","apply","await","err"],"mappings":";;;;+BAoDA;;;eAAwBA;;;yDApDT;2DACE;0DACD;mEACE;oEACC;6DACJ;8DACG;gEACI;uBACkB;iEACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AAClG,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,gBAAgBC,IAAAA,mBAAU,EAACX,aAAI,CAACY,IAAI,CAACC,IAAAA,oBAAW,EAACd,YAAY,QAAQ,OAAO,OAAO;AAEzF,SAASe,OAAOC,GAAG,EAAEC,OAAO,EAAEC,QAAQ;IACpC,IAAMC,MAAMF,QAAQE,GAAG,IAAIZ,QAAQY,GAAG;IACtC,IAAMC,MAAMC,KAAKC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACvB,aAAI,CAACY,IAAI,CAACM,KAAK,iBAAiB;IACvE,IAAMM,OAAOxB,aAAI,CAACY,IAAI,CAACa,eAAE,CAACC,MAAM,IAAIP,IAAIQ,IAAI,EAAEC,IAAAA,kBAAS,EAACV;IACxD,IAAMW,aAAa7B,aAAI,CAAC8B,QAAQ,CAACf,KAAKf,aAAI,CAAC+B,OAAO,CAAChB;IACnD,IAAMiB,aAAahC,aAAI,CAACY,IAAI,CAACY,MAAMK;IACnCI,sBAAM,CAACC,IAAI,CAACV;IAEZ,IAAMW,QAAQ,IAAIC,gBAAK,CAAC;IACxB,IAAK,IAAMC,WAAWlB,IAAImB,GAAG,CAAE;QAC7B,IAAMC,c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
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import url from 'url';
|
|
3
4
|
import spawn from 'cross-spawn-cb';
|
|
4
5
|
import mkdirp from 'mkdirp-classic';
|
|
5
6
|
import os from 'os-shim';
|
|
6
7
|
import Queue from 'queue-cb';
|
|
7
8
|
import shortHash from 'short-hash';
|
|
9
|
+
import { packageRoot, wrapWorker } from 'tsds-lib';
|
|
8
10
|
import prepareGit from './prepareGit.mjs';
|
|
9
|
-
|
|
11
|
+
const __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));
|
|
12
|
+
const major = +process.versions.node.split('.')[0];
|
|
13
|
+
const workerWrapper = wrapWorker(path.join(packageRoot(__dirname), 'dist', 'cjs', 'lib', 'data.js'));
|
|
14
|
+
function worker(git, options, callback) {
|
|
10
15
|
const cwd = options.cwd || process.cwd();
|
|
11
16
|
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));
|
|
12
17
|
const dest = path.join(os.tmpdir(), pkg.name, shortHash(cwd));
|
|
@@ -22,10 +27,8 @@ export default function data(git, options, callback) {
|
|
|
22
27
|
// clone or reset the git repo
|
|
23
28
|
queue.defer(prepareGit.bind(null, git, options));
|
|
24
29
|
// install
|
|
25
|
-
queue.defer(spawn.bind(null, '
|
|
26
|
-
'lts',
|
|
30
|
+
queue.defer(spawn.bind(null, 'npm', [
|
|
27
31
|
'--silent',
|
|
28
|
-
'npm',
|
|
29
32
|
'install'
|
|
30
33
|
], {
|
|
31
34
|
cwd: targetPath
|
|
@@ -45,3 +48,6 @@ export default function data(git, options, callback) {
|
|
|
45
48
|
});
|
|
46
49
|
}
|
|
47
50
|
}
|
|
51
|
+
export default function data(git, options, callback) {
|
|
52
|
+
major < 14 ? workerWrapper('stable', git, options, callback) : worker(git, options, callback);
|
|
53
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["data.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport mkdirp from 'mkdirp-classic';\nimport os from 'os-shim';\nimport Queue from 'queue-cb';\nimport shortHash from 'short-hash';\
|
|
1
|
+
{"version":3,"sources":["data.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport url from 'url';\nimport spawn from 'cross-spawn-cb';\nimport mkdirp from 'mkdirp-classic';\nimport os from 'os-shim';\nimport Queue from 'queue-cb';\nimport shortHash from 'short-hash';\nimport { packageRoot, wrapWorker } from 'tsds-lib';\nimport prepareGit from './prepareGit.js';\n\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\nconst major = +process.versions.node.split('.')[0];\nconst workerWrapper = wrapWorker(path.join(packageRoot(__dirname), 'dist', 'cjs', 'lib', 'data.js'));\n\nfunction worker(git, options, callback) {\n const cwd = options.cwd || process.cwd();\n const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));\n const dest = path.join(os.tmpdir(), pkg.name, shortHash(cwd));\n const targetName = path.basename(git, path.extname(git));\n const targetPath = path.join(dest, targetName);\n mkdirp.sync(dest);\n\n const queue = new Queue(1);\n for (const binName in pkg.bin) {\n const packagePath = path.resolve(targetPath, 'node_modules', pkg.name);\n const binPath = path.resolve(targetPath, 'node_modules', '.bin', binName);\n\n console.log('------------------');\n console.log(`Preparing: ${targetPath}`);\n\n // clone or reset the git repo\n queue.defer(prepareGit.bind(null, git, options));\n\n // install\n queue.defer(spawn.bind(null, 'npm', ['--silent', 'install'], { cwd: targetPath }));\n\n // link package\n queue.defer(fs.rename.bind(null, packagePath, `${packagePath}.tsds`));\n queue.defer(fs.symlink.bind(null, cwd, packagePath, 'dir'));\n\n // link bin\n queue.defer(fs.rename.bind(null, binPath, `${binPath}.tsds`));\n queue.defer(fs.symlink.bind(null, path.resolve.apply(null, [cwd, ...pkg.bin[binName].split('/')]), binPath, 'file'));\n\n queue.await((err) => {\n console.log('------------------');\n err ? callback(err) : callback(null, targetPath);\n });\n }\n}\n\nexport default function data(git, options, callback) {\n major < 14 ? workerWrapper('stable', git, options, callback) : worker(git, options, callback);\n}\n"],"names":["fs","path","url","spawn","mkdirp","os","Queue","shortHash","packageRoot","wrapWorker","prepareGit","__dirname","dirname","__filename","fileURLToPath","major","process","versions","node","split","workerWrapper","join","worker","git","options","callback","cwd","pkg","JSON","parse","readFileSync","dest","tmpdir","name","targetName","basename","extname","targetPath","sync","queue","binName","bin","packagePath","resolve","binPath","console","log","defer","bind","rename","symlink","apply","await","err","data"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,WAAW,iBAAiB;AACnC,OAAOC,YAAY,iBAAiB;AACpC,OAAOC,QAAQ,UAAU;AACzB,OAAOC,WAAW,WAAW;AAC7B,OAAOC,eAAe,aAAa;AACnC,SAASC,WAAW,EAAEC,UAAU,QAAQ,WAAW;AACnD,OAAOC,gBAAgB,kBAAkB;AAEzC,MAAMC,YAAYV,KAAKW,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaX,IAAIY,aAAa,CAAC,YAAYZ,GAAG;AACjH,MAAMa,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,MAAMC,gBAAgBX,WAAWR,KAAKoB,IAAI,CAACb,YAAYG,YAAY,QAAQ,OAAO,OAAO;AAEzF,SAASW,OAAOC,GAAG,EAAEC,OAAO,EAAEC,QAAQ;IACpC,MAAMC,MAAMF,QAAQE,GAAG,IAAIV,QAAQU,GAAG;IACtC,MAAMC,MAAMC,KAAKC,KAAK,CAAC7B,GAAG8B,YAAY,CAAC7B,KAAKoB,IAAI,CAACK,KAAK,iBAAiB;IACvE,MAAMK,OAAO9B,KAAKoB,IAAI,CAAChB,GAAG2B,MAAM,IAAIL,IAAIM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CAAC;YACZO,MAAM5B,SAAS4B,OAAO5B,SAAS,MAAMY;QACvC;IACF;AACF;AAEA,eAAe,SAASiB,KAAK/B,GAAG,EAAEC,OAAO,EAAEC,QAAQ;IACjDV,QAAQ,KAAKK,cAAc,UAAUG,KAAKC,SAASC,YAAYH,OAAOC,KAAKC,SAASC;AACtF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsds-lib-test",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Development stack for TypeScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dev",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"os-shim": "^0.1.3",
|
|
48
48
|
"queue-cb": "^1.4.4",
|
|
49
49
|
"rimraf2": "^2.8.2",
|
|
50
|
-
"short-hash": "^1.0.0"
|
|
50
|
+
"short-hash": "^1.0.0",
|
|
51
|
+
"tsds-lib": "^1.5.2"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@biomejs/biome": "^1.9.4",
|
|
@@ -62,5 +63,5 @@
|
|
|
62
63
|
"tsds": {
|
|
63
64
|
"source": "src/index.ts"
|
|
64
65
|
},
|
|
65
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "c5967e391ae7457b2d0356c44054fb8c792fc1b6"
|
|
66
67
|
}
|