@idlebox/itypes 1.0.4 → 1.0.6

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/filter-dts.js ADDED
@@ -0,0 +1,36 @@
1
+ const { resolve } = require('path');
2
+ const { readFileSync, writeFileSync } = require('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
+ } else {
17
+ return false;
18
+ }
19
+ }
20
+
21
+ const PLUGIN_NAME = 'filter-dts';
22
+
23
+ module.exports = class CopyDtsIndexPlugin {
24
+ apply(session, configuration) {
25
+ session.hooks.run.tapPromise(PLUGIN_NAME, async (_opt) => {
26
+ console.error('todo');
27
+ const root = resolve(configuration.buildFolderPath, 'lib');
28
+
29
+ const ch1 = action(resolve(root, 'esm/__create_index.generated.d.mts'));
30
+ if (ch1) session.logger.terminal.writeLine('.d.mts filtered.');
31
+
32
+ const ch2 = action(resolve(root, 'cjs/__create_index.generated.d.cts'));
33
+ if (ch2) session.logger.terminal.writeLine('.d.mts filtered.');
34
+ });
35
+ }
36
+ };
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft-plugin.schema.json",
3
+ "taskPlugins": [
4
+ {
5
+ "pluginName": "filter-dts",
6
+ "entryPoint": "./filter-dts.js"
7
+ }
8
+ ]
9
+ }
package/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  /// <reference path="./console.d.ts" />
2
2
  /// <reference path="./timeout.d.ts" />
3
+ /// <reference path="./url.d.ts" />
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@idlebox/itypes",
3
3
  "type": "commonjs",
4
- "version": "1.0.4",
4
+ "version": "1.0.6",
5
5
  "description": "some global variables copied from @types/node or dom",
6
6
  "keywords": [
7
7
  "Typescript",
@@ -11,13 +11,10 @@
11
11
  ],
12
12
  "license": "MIT",
13
13
  "typings": "./index.d.ts",
14
- "dependencies": {
15
- "tslib": "^2.4.1"
16
- },
17
14
  "scripts": {
18
- "build": "",
19
- "build:watch": "",
20
- "clean": "",
21
- "watch": ""
15
+ "build": "true",
16
+ "clean": "true",
17
+ "test": "true",
18
+ "watch": "true"
22
19
  }
23
20
  }
package/url.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ declare class URL {
2
+ constructor(v: string);
3
+ protocol: string;
4
+ host: string;
5
+ pathname: string;
6
+ }