@tsslint/config 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/lib/build.d.ts CHANGED
@@ -1,2 +1,4 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import type { Config } from '@tsslint/types';
2
- export declare function buildConfigFile(configFilePath: string, createHash?: (path: string) => string): Promise<Config>;
4
+ export declare function buildConfigFile(configFilePath: string, createHash?: (path: string) => string, logger?: Pick<typeof console, 'log' | 'warn' | 'error'>): Promise<Config>;
package/lib/build.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildConfigFile = void 0;
4
4
  const watch_1 = require("./watch");
5
- function buildConfigFile(configFilePath, createHash) {
5
+ function buildConfigFile(configFilePath, createHash, logger) {
6
6
  return new Promise((resolve, reject) => {
7
7
  (0, watch_1.watchConfigFile)(configFilePath, (config, result) => {
8
8
  if (config) {
@@ -11,7 +11,7 @@ function buildConfigFile(configFilePath, createHash) {
11
11
  else {
12
12
  reject(result);
13
13
  }
14
- }, false, createHash);
14
+ }, false, createHash, logger);
15
15
  });
16
16
  }
17
17
  exports.buildConfigFile = buildConfigFile;
package/lib/watch.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import esbuild = require('esbuild');
2
4
  import type { Config } from '@tsslint/types';
3
- export declare function watchConfigFile(configFilePath: string, onBuild: (config: Config | undefined, result: esbuild.BuildResult) => void, watch?: boolean, createHash?: (path: string) => string): Promise<esbuild.BuildContext<{
5
+ export declare function watchConfigFile(configFilePath: string, onBuild: (config: Config | undefined, result: esbuild.BuildResult) => void, watch?: boolean, createHash?: (path: string) => string, logger?: Pick<typeof console, 'log' | 'warn' | 'error'>): Promise<esbuild.BuildContext<{
4
6
  entryPoints: string[];
5
7
  bundle: true;
6
8
  sourcemap: true;
package/lib/watch.js CHANGED
@@ -4,7 +4,8 @@ exports.watchConfigFile = void 0;
4
4
  const esbuild = require("esbuild");
5
5
  const _path = require("path");
6
6
  const fs = require("fs");
7
- async function watchConfigFile(configFilePath, onBuild, watch = true, createHash = btoa) {
7
+ async function watchConfigFile(configFilePath, onBuild, watch = true, createHash = btoa, logger = console) {
8
+ let start;
8
9
  const outDir = _path.resolve(configFilePath, '..', 'node_modules', '.tsslint');
9
10
  const outFileName = createHash(_path.relative(outDir, configFilePath)) + '.mjs';
10
11
  const outFile = _path.join(outDir, outFileName);
@@ -19,6 +20,7 @@ async function watchConfigFile(configFilePath, onBuild, watch = true, createHash
19
20
  result.errors.push({ text: String(e) });
20
21
  }
21
22
  }
23
+ logger.log(`Built ${_path.relative(process.cwd(), configFilePath)} in ${Date.now() - start}ms`);
22
24
  onBuild(config, result);
23
25
  };
24
26
  const cacheDir = _path.resolve(outDir, 'http_resources');
@@ -33,6 +35,9 @@ async function watchConfigFile(configFilePath, onBuild, watch = true, createHash
33
35
  plugins: [{
34
36
  name: 'tsslint',
35
37
  setup(build) {
38
+ build.onStart(() => {
39
+ start = Date.now();
40
+ });
36
41
  build.onResolve({ filter: /^https?:\/\// }, ({ path }) => {
37
42
  const cachePath = _path.join(cacheDir, createHash(path));
38
43
  cachePathToOriginalPath.set(cachePath, path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsslint/config",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,8 +12,8 @@
12
12
  "directory": "packages/config"
13
13
  },
14
14
  "dependencies": {
15
- "@tsslint/types": "1.0.2",
15
+ "@tsslint/types": "1.0.3",
16
16
  "esbuild": "^0.21.4"
17
17
  },
18
- "gitHead": "e9bbdd4eba295de6bcb663e02c305f2b48893d6f"
18
+ "gitHead": "e88e802c863fc265c0e659c3d3e92fdd01523a95"
19
19
  }