@idlebox/itypes 1.0.19 → 1.0.20
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/lib.bare.d.ts +9 -0
- package/lib.dom.d.ts +8 -0
- package/lib.es.d.ts +6 -0
- package/lib.node.d.ts +6 -0
- package/package.json +14 -2
- package/subpackages/bare/package.json +19 -0
- package/subpackages/dom/package.json +19 -0
- package/subpackages/node/package.json +19 -0
- package/typings/common/export-meta.d.ts +8 -0
- package/typings/common/timeout.d.ts +8 -0
- package/{console.d.ts → typings/console.d.ts} +2 -0
- package/typings/v8-error.d.ts +9 -0
- package/error.d.ts +0 -9
- package/filter-dts.js +0 -35
- package/heft-plugin.json +0 -9
- package/index.d.ts +0 -4
- package/remove-script/buildscript.js +0 -6
- package/remove-script/package.json +0 -5
- package/remove-script/postbuild.script.js +0 -2
- package/remove-script/remove.js +0 -28
- package/remove.js +0 -31
- package/timeout.d.ts +0 -5
- /package/{url.d.ts → typings/url.d.ts} +0 -0
package/lib.bare.d.ts
ADDED
package/lib.dom.d.ts
ADDED
package/lib.es.d.ts
ADDED
package/lib.node.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idlebox/itypes",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.20",
|
|
5
5
|
"description": "some global variables copied from @types/node or dom",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Typescript",
|
|
@@ -10,10 +10,22 @@
|
|
|
10
10
|
"typings"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@mpis/run": "^0.0.
|
|
13
|
+
"@mpis/run": "^0.0.26",
|
|
14
14
|
"@build-script/baseline-rig": "latest"
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib.es.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./node": {
|
|
21
|
+
"types": "./lib.node.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./dom": {
|
|
24
|
+
"types": "./lib.dom.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./bare": {
|
|
27
|
+
"types": "./lib.bare.d.ts"
|
|
28
|
+
},
|
|
17
29
|
"./package.json": "./package.json"
|
|
18
30
|
},
|
|
19
31
|
"sideEffects": false,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@idlebox/itypes-bare",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"description": "bare export of @idlebox/itypes",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "",
|
|
8
|
+
"watch": "",
|
|
9
|
+
"clean": ""
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@idlebox/itypes": "workspace:latest"
|
|
13
|
+
},
|
|
14
|
+
"types": "./node_modules/@idlebox/itypes/lib.bare.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": false
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@idlebox/itypes-dom",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"description": "dom export of @idlebox/itypes",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "",
|
|
8
|
+
"watch": "",
|
|
9
|
+
"clean": ""
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@idlebox/itypes": "workspace:latest"
|
|
13
|
+
},
|
|
14
|
+
"types": "./node_modules/@idlebox/itypes/lib.dom.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": false
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@idlebox/itypes-node",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"description": "node export of @idlebox/itypes",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "",
|
|
8
|
+
"watch": "",
|
|
9
|
+
"clean": ""
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@idlebox/itypes": "workspace:latest"
|
|
13
|
+
},
|
|
14
|
+
"types": "./node_modules/@idlebox/itypes/lib.node.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": false
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
type ITimeoutType = NodeJS.Timeout;
|
|
3
|
+
|
|
4
|
+
declare type ITimerHandler = string | Function;
|
|
5
|
+
declare function clearInterval(handle?: ITimeoutType): void;
|
|
6
|
+
declare function clearTimeout(handle?: ITimeoutType): void;
|
|
7
|
+
declare function setInterval(handler: ITimerHandler, timeout?: ITimeoutType, ...arguments: any[]): ITimeoutType;
|
|
8
|
+
declare function setTimeout(handler: ITimerHandler, timeout?: ITimeoutType, ...arguments: any[]): ITimeoutType;
|
package/error.d.ts
DELETED
package/filter-dts.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const { resolve } = require('node:path');
|
|
2
|
-
const { readFileSync, writeFileSync } = require('node:fs');
|
|
3
|
-
|
|
4
|
-
function action(file) {
|
|
5
|
-
const data = readFileSync(file, 'utf-8');
|
|
6
|
-
|
|
7
|
-
lines = data.split('\n').filter((l) => {
|
|
8
|
-
return !l.includes('@idlebox/itypes');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const result = `${lines.join('\n').trim()}\n`;
|
|
12
|
-
|
|
13
|
-
if (result !== data) {
|
|
14
|
-
writeFileSync(file, result);
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const PLUGIN_NAME = 'filter-dts';
|
|
21
|
-
|
|
22
|
-
module.exports = class CopyDtsIndexPlugin {
|
|
23
|
-
apply(session, configuration) {
|
|
24
|
-
session.hooks.run.tapPromise(PLUGIN_NAME, async (_opt) => {
|
|
25
|
-
console.error('todo');
|
|
26
|
-
const root = resolve(configuration.buildFolderPath, 'lib');
|
|
27
|
-
|
|
28
|
-
const ch1 = action(resolve(root, 'esm/__create_index.generated.d.mts'));
|
|
29
|
-
if (ch1) session.logger.terminal.writeLine('.d.mts filtered.');
|
|
30
|
-
|
|
31
|
-
const ch2 = action(resolve(root, 'cjs/__create_index.generated.d.cts'));
|
|
32
|
-
if (ch2) session.logger.terminal.writeLine('.d.mts filtered.');
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
};
|
package/heft-plugin.json
DELETED
package/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const { buildContext } = require('@build-script/builder');
|
|
2
|
-
const { resolve } = require('node:path');
|
|
3
|
-
|
|
4
|
-
buildContext.registerAlias('remove-extra-lib', resolve(__dirname, './postbuild.script.js'));
|
|
5
|
-
buildContext.addAction('post-build', ['remove-extra-lib']);
|
|
6
|
-
buildContext.postfixAction('build', ['post-build']);
|
package/remove-script/remove.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const { readFileSync, writeFileSync } = require('node:fs');
|
|
2
|
-
const { resolve } = require('node:path');
|
|
3
|
-
|
|
4
|
-
module.exports.remove = (cwd) => {
|
|
5
|
-
const pkgFile = resolve(cwd, 'package.json');
|
|
6
|
-
const pkg = require(pkgFile);
|
|
7
|
-
const typingFile = pkg.types || pkg.typings;
|
|
8
|
-
|
|
9
|
-
if (!typingFile) {
|
|
10
|
-
throw new Error(`missing types field in ${pkgFile}`);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const targetDts = resolve(cwd, typingFile);
|
|
14
|
-
console.log('[@idlebox/itypes] fixing file: %s', targetDts);
|
|
15
|
-
const data = readFileSync(targetDts, 'utf-8');
|
|
16
|
-
|
|
17
|
-
const mr = /^\/\/\/.+$/gm;
|
|
18
|
-
for (const [line] of data.matchAll(mr)) {
|
|
19
|
-
if (line.includes('@idlebox/itypes')) {
|
|
20
|
-
console.log('[@idlebox/itypes] updated, write back');
|
|
21
|
-
writeFileSync(targetDts, data.replace(line, '').trimStart(), 'utf-8');
|
|
22
|
-
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
console.log('[@idlebox/itypes] no need update');
|
|
28
|
-
};
|
package/remove.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
let walked = new WeakSet();
|
|
2
|
-
const parent = findParent(require.main);
|
|
3
|
-
walked = undefined;
|
|
4
|
-
|
|
5
|
-
if (!parent) {
|
|
6
|
-
throw new Error('[@idlebox/itypes] Can not find who import this file.');
|
|
7
|
-
}
|
|
8
|
-
if (parent.id.includes('@rushstack/heft')) {
|
|
9
|
-
module.exports = require('./remove-script/heft.js');
|
|
10
|
-
} else if (parent.id.includes('@build-script/builder')) {
|
|
11
|
-
require('./remove-script/buildscript.js');
|
|
12
|
-
} else {
|
|
13
|
-
throw new Error('[@idlebox/itypes] Can not detect builder type.');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function findParent(parent) {
|
|
17
|
-
for (const child of parent.children) {
|
|
18
|
-
if (walked.has(child)) {
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (child === module) {
|
|
23
|
-
return parent;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
walked.add(child);
|
|
27
|
-
|
|
28
|
-
const found = findParent(child);
|
|
29
|
-
if (found) return found;
|
|
30
|
-
}
|
|
31
|
-
}
|
package/timeout.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare type TimerHandler = string | Function;
|
|
2
|
-
declare function clearInterval(handle?: number): void;
|
|
3
|
-
declare function clearTimeout(handle?: number): void;
|
|
4
|
-
declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
|
|
5
|
-
declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
|
|
File without changes
|