@umijs/utils 4.0.0-canary.20220628.2 → 4.0.0-canary.20220718.1

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 (46) hide show
  1. package/dist/BaseGenerator/BaseGenerator.d.ts +1 -0
  2. package/dist/BaseGenerator/BaseGenerator.d.ts.map +1 -0
  3. package/dist/BaseGenerator/generateFile.d.ts +1 -0
  4. package/dist/BaseGenerator/generateFile.d.ts.map +1 -0
  5. package/dist/Generator/Generator.d.ts +1 -0
  6. package/dist/Generator/Generator.d.ts.map +1 -0
  7. package/dist/getCorejsVersion.d.ts +1 -0
  8. package/dist/getCorejsVersion.d.ts.map +1 -0
  9. package/dist/getGitInfo.d.ts +7 -0
  10. package/dist/getGitInfo.d.ts.map +1 -0
  11. package/dist/getGitInfo.js +42 -0
  12. package/dist/importLazy.d.ts +1 -0
  13. package/dist/importLazy.d.ts.map +1 -0
  14. package/dist/index.d.ts +4 -3
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +5 -3
  17. package/dist/installDeps.d.ts +1 -0
  18. package/dist/installDeps.d.ts.map +1 -0
  19. package/dist/isLocalDev.d.ts +1 -0
  20. package/dist/isLocalDev.d.ts.map +1 -0
  21. package/dist/isStyleFile.d.ts +1 -0
  22. package/dist/isStyleFile.d.ts.map +1 -0
  23. package/dist/logger.d.ts +2 -1
  24. package/dist/logger.d.ts.map +1 -0
  25. package/dist/logger.js +35 -24
  26. package/dist/npmClient.d.ts +1 -0
  27. package/dist/npmClient.d.ts.map +1 -0
  28. package/dist/printHelp.d.ts +3 -0
  29. package/dist/printHelp.d.ts.map +1 -0
  30. package/dist/printHelp.js +44 -0
  31. package/dist/randomColor/randomColor.d.ts +1 -0
  32. package/dist/randomColor/randomColor.d.ts.map +1 -0
  33. package/dist/register.d.ts +1 -0
  34. package/dist/register.d.ts.map +1 -0
  35. package/dist/register.js +15 -7
  36. package/dist/tryPaths.d.ts +1 -0
  37. package/dist/tryPaths.d.ts.map +1 -0
  38. package/dist/updatePackageJSON.d.ts +1 -0
  39. package/dist/updatePackageJSON.d.ts.map +1 -0
  40. package/dist/winPath.d.ts +1 -0
  41. package/dist/winPath.d.ts.map +1 -0
  42. package/package.json +1 -2
  43. package/dist/folderCache/AutoUpdateFolderCache.d.ts +0 -32
  44. package/dist/folderCache/AutoUpdateFolderCache.js +0 -133
  45. package/dist/folderCache/AutoUpdateSourceCodeCache.d.ts +0 -27
  46. package/dist/folderCache/AutoUpdateSourceCodeCache.js +0 -147
@@ -17,3 +17,4 @@ export default class BaseGenerator extends Generator {
17
17
  writing(): Promise<void>;
18
18
  }
19
19
  export {};
20
+ //# sourceMappingURL=BaseGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseGenerator.d.ts","sourceRoot":"","sources":["../../src/BaseGenerator/BaseGenerator.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAE/C,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;CACpC;AAED,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAS;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;gBAEtB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,KAAK;IAQ7D,SAAS;IAIH,OAAO;CAyBd"}
@@ -7,3 +7,4 @@ declare const generateFile: ({ path, target, baseDir, data, questions, }: {
7
7
  questions?: prompts.PromptObject<string>[] | undefined;
8
8
  }) => Promise<void>;
9
9
  export default generateFile;
10
+ //# sourceMappingURL=generateFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateFile.d.ts","sourceRoot":"","sources":["../../src/BaseGenerator/generateFile.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAG7C,QAAA,MAAM,YAAY;UAOV,MAAM;YACJ,MAAM;;WAEP,GAAG;;mBAYX,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -23,3 +23,4 @@ declare class Generator {
23
23
  }): void;
24
24
  }
25
25
  export default Generator;
26
+ //# sourceMappingURL=Generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Generator.d.ts","sourceRoot":"","sources":["../../src/Generator/Generator.ts"],"names":[],"mappings":"AAOA,OAAO,OAAO,MAAM,6BAA6B,CAAC;AAElD,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC;CACzB;AAED,cAAM,SAAS;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC;IACxB,OAAO,EAAE,GAAG,CAAC;gBAED,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK;IAM9B,GAAG;IAMT,SAAS;IAIH,OAAO;IAEb,OAAO,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAUvE,aAAa,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAuBtE;AAED,eAAe,SAAS,CAAC"}
@@ -1 +1,2 @@
1
1
  export declare const getCorejsVersion: (pkgPath: string) => any;
2
+ //# sourceMappingURL=getCorejsVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCorejsVersion.d.ts","sourceRoot":"","sources":["../src/getCorejsVersion.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,YAAa,MAAM,QAK/C,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface IGitInfo {
2
+ username: string;
3
+ email: string;
4
+ }
5
+ declare const getGitInfo: () => Promise<IGitInfo>;
6
+ export default getGitInfo;
7
+ //# sourceMappingURL=getGitInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGitInfo.d.ts","sourceRoot":"","sources":["../src/getGitInfo.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,UAAU,QAAa,QAAQ,QAAQ,CAa5C,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const execa = __importStar(require("../compiled/execa"));
27
+ const getGitInfo = async () => {
28
+ try {
29
+ const [{ stdout: username }, { stdout: email }] = await Promise.all([
30
+ execa.execaCommand('git config --global user.name'),
31
+ execa.execaCommand('git config --global user.email'),
32
+ ]);
33
+ return { username, email };
34
+ }
35
+ catch (e) {
36
+ return {
37
+ username: '',
38
+ email: '',
39
+ };
40
+ }
41
+ };
42
+ exports.default = getGitInfo;
@@ -4,3 +4,4 @@
4
4
  * 2. https://github.com/microsoft/rushstack/blob/90301e9/libraries/node-core-library/src/Import.ts#L175
5
5
  */
6
6
  export declare function importLazy(moduleName: string, requireFn?: (id: string) => unknown): any;
7
+ //# sourceMappingURL=importLazy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importLazy.d.ts","sourceRoot":"","sources":["../src/importLazy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,wBAAgB,UAAU,CACxB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,GAClC,GAAG,CAKL"}
package/dist/index.d.ts CHANGED
@@ -22,11 +22,11 @@ import yParser from '../compiled/yargs-parser';
22
22
  import BaseGenerator from './BaseGenerator/BaseGenerator';
23
23
  import generateFile from './BaseGenerator/generateFile';
24
24
  import Generator from './Generator/Generator';
25
+ import getGitInfo from './getGitInfo';
25
26
  import installDeps from './installDeps';
26
27
  import * as logger from './logger';
28
+ import * as printHelp from './printHelp';
27
29
  import updatePackageJSON from './updatePackageJSON';
28
- export * from './folderCache/AutoUpdateFolderCache';
29
- export * from './folderCache/AutoUpdateSourceCodeCache';
30
30
  export * from './getCorejsVersion';
31
31
  export * from './importLazy';
32
32
  export * from './isLocalDev';
@@ -36,4 +36,5 @@ export * from './randomColor/randomColor';
36
36
  export * as register from './register';
37
37
  export * from './tryPaths';
38
38
  export * from './winPath';
39
- export { address, axios, chalk, cheerio, chokidar, crossSpawn, debug, deepmerge, execa, fsExtra, glob, Generator, BaseGenerator, generateFile, installDeps, lodash, logger, Mustache, pkgUp, portfinder, prompts, resolve, rimraf, semver, stripAnsi, updatePackageJSON, yParser, };
39
+ export { address, axios, chalk, cheerio, chokidar, crossSpawn, debug, deepmerge, execa, fsExtra, glob, Generator, BaseGenerator, generateFile, installDeps, lodash, logger, Mustache, pkgUp, portfinder, prompts, resolve, rimraf, semver, stripAnsi, updatePackageJSON, yParser, getGitInfo, printHelp, };
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAEpC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAC;AAC5C,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAC/C,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAC1D,OAAO,YAAY,MAAM,8BAA8B,CAAC;AACxD,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,OAAO,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EACV,KAAK,EACL,SAAS,EACT,KAAK,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,aAAa,EACb,YAAY,EACZ,WAAW,EAEX,MAAM,EACN,MAAM,EACN,QAAQ,EACR,KAAK,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,MAAM,EACN,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,UAAU,EACV,SAAS,GACV,CAAC"}
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.yParser = exports.updatePackageJSON = exports.stripAnsi = exports.semver = exports.rimraf = exports.resolve = exports.prompts = exports.portfinder = exports.pkgUp = exports.Mustache = exports.logger = exports.lodash = exports.installDeps = exports.generateFile = exports.BaseGenerator = exports.Generator = exports.glob = exports.fsExtra = exports.execa = exports.deepmerge = exports.debug = exports.crossSpawn = exports.chokidar = exports.cheerio = exports.chalk = exports.axios = exports.address = exports.register = void 0;
32
+ exports.printHelp = exports.getGitInfo = exports.yParser = exports.updatePackageJSON = exports.stripAnsi = exports.semver = exports.rimraf = exports.resolve = exports.prompts = exports.portfinder = exports.pkgUp = exports.Mustache = exports.logger = exports.lodash = exports.installDeps = exports.generateFile = exports.BaseGenerator = exports.Generator = exports.glob = exports.fsExtra = exports.execa = exports.deepmerge = exports.debug = exports.crossSpawn = exports.chokidar = exports.cheerio = exports.chalk = exports.axios = exports.address = exports.register = void 0;
33
33
  const chokidar = __importStar(require("chokidar"));
34
34
  exports.chokidar = chokidar;
35
35
  const address_1 = __importDefault(require("../compiled/address"));
@@ -79,14 +79,16 @@ const generateFile_1 = __importDefault(require("./BaseGenerator/generateFile"));
79
79
  exports.generateFile = generateFile_1.default;
80
80
  const Generator_1 = __importDefault(require("./Generator/Generator"));
81
81
  exports.Generator = Generator_1.default;
82
+ const getGitInfo_1 = __importDefault(require("./getGitInfo"));
83
+ exports.getGitInfo = getGitInfo_1.default;
82
84
  const installDeps_1 = __importDefault(require("./installDeps"));
83
85
  exports.installDeps = installDeps_1.default;
84
86
  const logger = __importStar(require("./logger"));
85
87
  exports.logger = logger;
88
+ const printHelp = __importStar(require("./printHelp"));
89
+ exports.printHelp = printHelp;
86
90
  const updatePackageJSON_1 = __importDefault(require("./updatePackageJSON"));
87
91
  exports.updatePackageJSON = updatePackageJSON_1.default;
88
- __exportStar(require("./folderCache/AutoUpdateFolderCache"), exports);
89
- __exportStar(require("./folderCache/AutoUpdateSourceCodeCache"), exports);
90
92
  __exportStar(require("./getCorejsVersion"), exports);
91
93
  __exportStar(require("./importLazy"), exports);
92
94
  __exportStar(require("./isLocalDev"), exports);
@@ -7,3 +7,4 @@ declare function installDeps({ opts, cwd, }: {
7
7
  cwd?: string;
8
8
  }): void;
9
9
  export default installDeps;
10
+ //# sourceMappingURL=installDeps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installDeps.d.ts","sourceRoot":"","sources":["../src/installDeps.ts"],"names":[],"mappings":"AAIA,UAAU,YAAY;IACpB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,iBAAS,WAAW,CAAC,EACnB,IAAI,EACJ,GAAmB,GACpB,EAAE;IACD,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,QAyCA;AACD,eAAe,WAAW,CAAC"}
@@ -2,3 +2,4 @@
2
2
  * Check whether it is development in local
3
3
  */
4
4
  export declare const isLocalDev: () => string | false;
5
+ //# sourceMappingURL=isLocalDev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isLocalDev.d.ts","sourceRoot":"","sources":["../src/isLocalDev.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,UAAU,sBAGtB,CAAC"}
@@ -3,3 +3,4 @@ export declare const isStyleFile: ({ filename, ext, }: {
3
3
  filename?: string | undefined;
4
4
  ext?: string | undefined;
5
5
  }) => boolean;
6
+ //# sourceMappingURL=isStyleFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isStyleFile.d.ts","sourceRoot":"","sources":["../src/isStyleFile.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,UAOhC,CAAC;AAEF,eAAO,MAAM,WAAW;;;aAQvB,CAAC"}
package/dist/logger.d.ts CHANGED
@@ -16,4 +16,5 @@ export declare function info(...message: any[]): void;
16
16
  export declare function event(...message: any[]): void;
17
17
  export declare function debug(...message: any[]): void;
18
18
  export declare function fatal(...message: any[]): void;
19
- export declare function getLatestLogFilePath(): string;
19
+ export declare function getLatestLogFilePath(): string | null;
20
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ;;;;;;;;;CASpB,CAAC;AAuCF,wBAAgB,IAAI,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,QAGrC;AAED,wBAAgB,KAAK,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,QAGtC;AAED,wBAAgB,IAAI,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,QAGrC;AAED,wBAAgB,KAAK,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,QAGtC;AAED,wBAAgB,IAAI,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,QAGrC;AAED,wBAAgB,KAAK,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,QAGtC;AAED,wBAAgB,KAAK,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,QAKtC;AAED,wBAAgB,KAAK,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,QAGtC;AAED,wBAAgB,oBAAoB,kBAEnC"}
package/dist/logger.js CHANGED
@@ -5,33 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getLatestLogFilePath = exports.fatal = exports.debug = exports.event = exports.info = exports.ready = exports.warn = exports.error = exports.wait = exports.prefixes = void 0;
7
7
  const path_1 = require("path");
8
- const pino_1 = __importDefault(require("pino"));
9
8
  const chalk_1 = __importDefault(require("../compiled/chalk"));
10
9
  const fs_extra_1 = __importDefault(require("../compiled/fs-extra"));
10
+ const importLazy_1 = require("./importLazy");
11
+ const enableFSLogger = process.env.FS_LOGGER !== 'none' && !process.versions.webcontainer;
11
12
  const loggerDir = (0, path_1.join)(process.cwd(), 'node_modules/.cache/logger');
12
13
  const loggerPath = (0, path_1.join)(loggerDir, 'umi.log');
13
- fs_extra_1.default.mkdirpSync(loggerDir);
14
- const customLevels = {
15
- ready: 31,
16
- event: 32,
17
- wait: 55,
18
- // 虽然这里设置了 debug 为 30,但日志中还是 20,符合预期
19
- // 这里不加会不生成到 umi.log,transport 的 level 配置没有生效,原因不明
20
- debug: 30,
21
- };
22
- const logger = (0, pino_1.default)({
23
- customLevels,
24
- }, pino_1.default.transport({
25
- targets: [
26
- {
27
- target: require.resolve('pino/file'),
28
- options: {
29
- destination: loggerPath,
30
- },
31
- level: 'trace',
32
- },
33
- ],
34
- }));
35
14
  exports.prefixes = {
36
15
  wait: chalk_1.default.cyan('wait') + ' -',
37
16
  error: chalk_1.default.red('error') + ' -',
@@ -42,6 +21,38 @@ exports.prefixes = {
42
21
  event: chalk_1.default.magenta('event') + ' -',
43
22
  debug: chalk_1.default.gray('debug') + ' -',
44
23
  };
24
+ let logger;
25
+ if (enableFSLogger) {
26
+ const { default: pino } = (0, importLazy_1.importLazy)(require.resolve('pino'));
27
+ fs_extra_1.default.mkdirpSync(loggerDir);
28
+ const customLevels = {
29
+ ready: 31,
30
+ event: 32,
31
+ wait: 55,
32
+ // 虽然这里设置了 debug 为 30,但日志中还是 20,符合预期
33
+ // 这里不加会不生成到 umi.log,transport 的 level 配置没有生效,原因不明
34
+ debug: 30,
35
+ };
36
+ logger = pino({
37
+ customLevels,
38
+ }, pino.transport({
39
+ targets: [
40
+ {
41
+ target: require.resolve('pino/file'),
42
+ options: {
43
+ destination: loggerPath,
44
+ },
45
+ level: 'trace',
46
+ },
47
+ ],
48
+ }));
49
+ }
50
+ else {
51
+ logger = {};
52
+ Object.keys(exports.prefixes).forEach((key) => {
53
+ logger[key] = () => { };
54
+ });
55
+ }
45
56
  function wait(...message) {
46
57
  console.log(exports.prefixes.wait, ...message);
47
58
  logger.wait(message[0]);
@@ -85,6 +96,6 @@ function fatal(...message) {
85
96
  }
86
97
  exports.fatal = fatal;
87
98
  function getLatestLogFilePath() {
88
- return loggerPath;
99
+ return enableFSLogger ? loggerPath : null;
89
100
  }
90
101
  exports.getLatestLogFilePath = getLatestLogFilePath;
@@ -14,3 +14,4 @@ export declare const installWithNpmClient: ({ npmClient, cwd, }: {
14
14
  npmClient: NpmClient;
15
15
  cwd?: string | undefined;
16
16
  }) => void;
17
+ //# sourceMappingURL=npmClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npmClient.d.ts","sourceRoot":"","sources":["../src/npmClient.ts"],"names":[],"mappings":"AAGA,oBAAY,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAClE,eAAO,MAAM,UAAU,UAA0C,CAAC;AAClE,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AACD,eAAO,MAAM,YAAY,SAAU;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,KAAG,SAqBpD,CAAC;AAEF,eAAO,MAAM,oBAAoB;eAIpB,SAAS;;MAElB,IASH,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function exit(): void;
2
+ export declare function runtime(e: Error): void;
3
+ //# sourceMappingURL=printHelp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"printHelp.d.ts","sourceRoot":"","sources":["../src/printHelp.ts"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,SAUnB;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,QAG/B"}
@@ -0,0 +1,44 @@
1
+ "use strict";
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.runtime = exports.exit = void 0;
27
+ const logger = __importStar(require("./logger"));
28
+ // TODO: 先注释,因为这里要考虑比如 @alipay/bigfish 不应该走这个提示
29
+ // const FEEDBACK_MESSAGE = '如果你需要进交流群,请访问 https://fb.umijs.org';
30
+ function exit() {
31
+ const loggerPath = logger.getLatestLogFilePath();
32
+ if (loggerPath) {
33
+ logger.fatal('A complete log of this run can be found in:');
34
+ logger.fatal(loggerPath);
35
+ }
36
+ logger.fatal('Consider reporting a GitHub issue on https://github.com/umijs/umi/issues');
37
+ // logger.fatal(FEEDBACK_MESSAGE);
38
+ }
39
+ exports.exit = exit;
40
+ function runtime(e) {
41
+ logger.error(e);
42
+ // logger.fatal(FEEDBACK_MESSAGE);
43
+ }
44
+ exports.runtime = runtime;
@@ -4,3 +4,4 @@ export declare function randomColor(saturation?: number, value?: number): color<
4
4
  s: number;
5
5
  v: number;
6
6
  }>;
7
+ //# sourceMappingURL=randomColor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomColor.d.ts","sourceRoot":"","sources":["../../src/randomColor/randomColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,sBAAsB,CAAC;AAKzC,wBAAgB,WAAW,CAAC,UAAU,GAAE,MAAY,EAAE,KAAK,GAAE,MAAa;;;;GASzE"}
@@ -5,3 +5,4 @@ export declare function register(opts: {
5
5
  export declare function getFiles(): string[];
6
6
  export declare function clearFiles(): void;
7
7
  export declare function restore(): void;
8
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AA8BA,wBAAgB,QAAQ,CAAC,IAAI,EAAE;IAAE,WAAW,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,QAanE;AAED,wBAAgB,QAAQ,aAEvB;AAED,wBAAgB,UAAU,SAEzB;AAED,wBAAgB,OAAO,SAGtB"}
package/dist/register.js CHANGED
@@ -12,13 +12,21 @@ function transform(opts) {
12
12
  const { code, filename, implementor } = opts;
13
13
  files.push(filename);
14
14
  const ext = (0, path_1.extname)(filename);
15
- return implementor.transformSync(code, {
16
- loader: ext.slice(1),
17
- // consistent with `tsconfig.base.json`
18
- // https://github.com/umijs/umi-next/pull/729
19
- target: 'es2019',
20
- format: 'cjs',
21
- }).code;
15
+ try {
16
+ return implementor.transformSync(code, {
17
+ sourcefile: filename,
18
+ loader: ext.slice(1),
19
+ // consistent with `tsconfig.base.json`
20
+ // https://github.com/umijs/umi-next/pull/729
21
+ target: 'es2019',
22
+ format: 'cjs',
23
+ logLevel: 'error',
24
+ }).code;
25
+ }
26
+ catch (e) {
27
+ // @ts-ignore
28
+ throw new Error(`Parse file failed: [${filename}]`, { cause: e });
29
+ }
22
30
  }
23
31
  function register(opts) {
24
32
  files = [];
@@ -1 +1,2 @@
1
1
  export declare function tryPaths(paths: string[]): string | undefined;
2
+ //# sourceMappingURL=tryPaths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tryPaths.d.ts","sourceRoot":"","sources":["../src/tryPaths.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,sBAIvC"}
@@ -3,3 +3,4 @@ declare function updatePackageJSON({ opts, cwd, }: {
3
3
  cwd?: string;
4
4
  }): void;
5
5
  export default updatePackageJSON;
6
+ //# sourceMappingURL=updatePackageJSON.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updatePackageJSON.d.ts","sourceRoot":"","sources":["../src/updatePackageJSON.ts"],"names":[],"mappings":"AAKA,iBAAS,iBAAiB,CAAC,EACzB,IAAI,EACJ,GAAmB,GACpB,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,QAYA;AACD,eAAe,iBAAiB,CAAC"}
package/dist/winPath.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export declare function winPath(path: string): string;
2
+ //# sourceMappingURL=winPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"winPath.d.ts","sourceRoot":"","sources":["../src/winPath.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,UAMnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/utils",
3
- "version": "4.0.0-canary.20220628.2",
3
+ "version": "4.0.0-canary.20220718.1",
4
4
  "homepage": "https://github.com/umijs/umi/tree/master/packages/utils#readme",
5
5
  "bugs": "https://github.com/umijs/umi/issues",
6
6
  "repository": {
@@ -22,7 +22,6 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "chokidar": "3.5.3",
25
- "fast-glob": "^3.2.11",
26
25
  "pino": "7.11.0"
27
26
  },
28
27
  "devDependencies": {
@@ -1,32 +0,0 @@
1
- declare type AbsPath = string;
2
- declare type FileContent = string;
3
- declare type FileContentCache = Record<AbsPath, FileContent>;
4
- export declare type FileChangeEvent = {
5
- event: 'unlink' | 'change' | 'add';
6
- path: string;
7
- };
8
- export declare class AutoUpdateFolderCache {
9
- fileContentCache: FileContentCache;
10
- private watcher;
11
- private readonly readyPromise;
12
- private readonly cwd;
13
- pendingChanges: FileChangeEvent[];
14
- private readonly debouchedHandleChanges;
15
- private readonly onCacheUpdated;
16
- private readonly filesLoader;
17
- constructor(opts: {
18
- cwd: string;
19
- exts: string[];
20
- onCacheUpdate: (cache: FileContentCache, events: FileChangeEvent[]) => void;
21
- debouncedTimeout?: number;
22
- ignored: string[];
23
- filesLoader?: (files: string[]) => Promise<Record<string, string>>;
24
- });
25
- unwatch(): Promise<void>;
26
- init(): Promise<void>;
27
- private watchAll;
28
- getFileCache(): FileContentCache;
29
- loadFiles(files: string[]): Promise<void>;
30
- private _defaultLoader;
31
- }
32
- export {};
@@ -1,133 +0,0 @@
1
- "use strict";
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.AutoUpdateFolderCache = void 0;
30
- const chokidar_1 = require("chokidar");
31
- const fs_1 = require("fs");
32
- const path_1 = require("path");
33
- const lodash_1 = __importDefault(require("../../compiled/lodash"));
34
- const logger = __importStar(require("../logger"));
35
- class AutoUpdateFolderCache {
36
- constructor(opts) {
37
- this.fileContentCache = {};
38
- this.pendingChanges = [];
39
- console.log('the path ', `./**/*.{${opts.exts.join(',')}}`);
40
- this.cwd = opts.cwd;
41
- this.onCacheUpdated = opts.onCacheUpdate;
42
- this.filesLoader = opts.filesLoader || this._defaultLoader;
43
- this.watcher = (0, chokidar_1.watch)(`./**/*.{${opts.exts.join(',')}}`, {
44
- ignored: opts.ignored || [],
45
- cwd: opts.cwd,
46
- ignorePermissionErrors: true,
47
- ignoreInitial: true,
48
- });
49
- this.watchAll();
50
- this.readyPromise = new Promise((resolve) => {
51
- this.watcher.on('ready', () => {
52
- resolve();
53
- });
54
- });
55
- this.debouchedHandleChanges = lodash_1.default.debounce(async () => {
56
- const modifiedFiles = [];
57
- const events = this.pendingChanges.slice();
58
- while (this.pendingChanges.length > 0) {
59
- const c = this.pendingChanges.pop();
60
- switch (c.event) {
61
- case 'unlink':
62
- delete this.fileContentCache[c.path];
63
- break;
64
- case 'change':
65
- case 'add':
66
- modifiedFiles.push(c.path);
67
- break;
68
- default:
69
- ((_n) => { })(c.event);
70
- }
71
- }
72
- await this.loadFiles(modifiedFiles);
73
- await this.onCacheUpdated(this.fileContentCache, events);
74
- }, opts.debouncedTimeout);
75
- }
76
- unwatch() {
77
- return this.watcher.close();
78
- }
79
- async init() {
80
- await this.readyPromise;
81
- }
82
- watchAll() {
83
- this.watcher.on('all', (eventName, path) => {
84
- switch (eventName) {
85
- case 'change':
86
- this.pendingChanges.push({
87
- event: 'change',
88
- path: (0, path_1.join)(this.cwd, path),
89
- });
90
- this.debouchedHandleChanges();
91
- break;
92
- case 'add':
93
- this.pendingChanges.push({
94
- event: 'add',
95
- path: (0, path_1.join)(this.cwd, path),
96
- });
97
- this.debouchedHandleChanges();
98
- break;
99
- case 'unlink':
100
- this.pendingChanges.push({
101
- event: 'unlink',
102
- path: (0, path_1.join)(this.cwd, path),
103
- });
104
- this.debouchedHandleChanges();
105
- break;
106
- default:
107
- // ignore all others;
108
- }
109
- });
110
- }
111
- getFileCache() {
112
- return this.fileContentCache;
113
- }
114
- async loadFiles(files) {
115
- const loaded = await this.filesLoader(files);
116
- for (const f of Object.keys(loaded)) {
117
- this.fileContentCache[f] = loaded[f];
118
- }
119
- }
120
- async _defaultLoader(files) {
121
- const loaded = {};
122
- for (let file of files) {
123
- try {
124
- loaded[file] = (0, fs_1.readFileSync)(file, 'utf-8');
125
- }
126
- catch (e) {
127
- logger.error('[fileCache] load file', (0, path_1.relative)(this.cwd, file), 'failed ', e);
128
- }
129
- }
130
- return loaded;
131
- }
132
- }
133
- exports.AutoUpdateFolderCache = AutoUpdateFolderCache;
@@ -1,27 +0,0 @@
1
- import { ImportSpecifier } from '@umijs/bundler-utils/compiled/es-module-lexer';
2
- import { AutoUpdateFolderCache, FileChangeEvent } from './AutoUpdateFolderCache';
3
- export declare type MergedCodeInfo = {
4
- code: string;
5
- imports: readonly ImportSpecifier[];
6
- events: FileChangeEvent[];
7
- };
8
- export declare type Listener = (info: MergedCodeInfo) => void;
9
- export declare class AutoUpdateSrcCodeCache {
10
- private readonly srcPath;
11
- private readonly cachePath;
12
- folderCache: AutoUpdateFolderCache;
13
- private listeners;
14
- constructor(opts: {
15
- cwd: string;
16
- cachePath: string;
17
- });
18
- init(): Promise<void>;
19
- private initFileList;
20
- batchProcess(files: string[]): Promise<void>;
21
- getMergedCode(): {
22
- code: string;
23
- imports: readonly ImportSpecifier[];
24
- };
25
- register(l: Listener): () => void;
26
- unwatch(): Promise<void>;
27
- }
@@ -1,147 +0,0 @@
1
- "use strict";
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.AutoUpdateSrcCodeCache = void 0;
30
- const es_module_lexer_1 = require("@umijs/bundler-utils/compiled/es-module-lexer");
31
- const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
32
- const logger = __importStar(require("../logger"));
33
- // @ts-ignore
34
- const fast_glob_1 = __importDefault(require("fast-glob"));
35
- const fs_1 = require("fs");
36
- const path_1 = require("path");
37
- const AutoUpdateFolderCache_1 = require("./AutoUpdateFolderCache");
38
- class AutoUpdateSrcCodeCache {
39
- constructor(opts) {
40
- this.listeners = [];
41
- this.srcPath = opts.cwd;
42
- this.cachePath = opts.cachePath;
43
- this.folderCache = new AutoUpdateFolderCache_1.AutoUpdateFolderCache({
44
- cwd: this.srcPath,
45
- exts: ['ts', 'js', 'jsx', 'tsx'],
46
- ignored: [
47
- '**/*.d.ts',
48
- '**/*.test.{js,ts,jsx,tsx}',
49
- // fixme respect to environment
50
- '**/.umi-production/**',
51
- '**/node_modules/**',
52
- '**/.git/**',
53
- ],
54
- debouncedTimeout: 500,
55
- filesLoader: async (files) => {
56
- const loaded = {};
57
- await this.batchProcess(files);
58
- for (const f of files) {
59
- let newFile = (0, path_1.join)(this.cachePath, (0, path_1.relative)(this.srcPath, f));
60
- // fixme ensure the last one
61
- newFile = newFile.replace((0, path_1.extname)(newFile), '.js');
62
- loaded[f] = (0, fs_1.readFileSync)(newFile, 'utf-8');
63
- }
64
- return loaded;
65
- },
66
- onCacheUpdate: (_cache, events) => {
67
- const merged = this.getMergedCode();
68
- const info = { ...merged, events };
69
- this.listeners.forEach((l) => l(info));
70
- },
71
- });
72
- }
73
- async init() {
74
- const [files] = await Promise.all([this.initFileList(), es_module_lexer_1.init]);
75
- await this.folderCache.loadFiles(files);
76
- }
77
- async initFileList() {
78
- const start = Date.now();
79
- const files = await (0, fast_glob_1.default)((0, path_1.join)(this.srcPath, '**', '*.{ts,js,jsx,tsx}'), {
80
- dot: true,
81
- ignore: [
82
- '**/*.d.ts',
83
- '**/*.test.{js,ts,jsx,tsx}',
84
- // fixme respect to environment
85
- '**/.umi-production/**',
86
- '**/node_modules/**',
87
- '**/.git/**',
88
- ],
89
- });
90
- logger.debug('[MFSU][eager] fast-glob costs', Date.now() - start);
91
- return files;
92
- }
93
- async batchProcess(files) {
94
- var _a, _b, _c, _d;
95
- try {
96
- await (0, esbuild_1.build)({
97
- entryPoints: files,
98
- bundle: false,
99
- outdir: this.cachePath,
100
- outbase: this.srcPath,
101
- loader: {
102
- // in case some js using some feature, eg: decorator
103
- '.jsx': 'tsx',
104
- },
105
- logLevel: 'silent',
106
- });
107
- }
108
- catch (e) {
109
- // error ignored due to user have to update code to fix then trigger another batchProcess;
110
- // @ts-ignore
111
- if (((_a = e.errors) === null || _a === void 0 ? void 0 : _a.length) || ((_b = e.warnings) === null || _b === void 0 ? void 0 : _b.length)) {
112
- logger.warn('transpile code with esbuild got ',
113
- // @ts-ignore
114
- ((_c = e.errors) === null || _c === void 0 ? void 0 : _c.lenght) || 0, 'errors,',
115
- // @ts-ignore
116
- ((_d = e.warnings) === null || _d === void 0 ? void 0 : _d.length) || 0, 'warnings');
117
- logger.debug('esbuild transpile code with error', e);
118
- }
119
- else {
120
- logger.warn('transpile code with esbuild error', e);
121
- }
122
- }
123
- }
124
- getMergedCode() {
125
- const fileContentCache = this.folderCache.getFileCache();
126
- const code = Object.values(fileContentCache).join('\n');
127
- const [imports] = (0, es_module_lexer_1.parse)(code);
128
- const merged = {
129
- code,
130
- imports,
131
- };
132
- return merged;
133
- }
134
- register(l) {
135
- if (this.listeners.indexOf(l) < 0) {
136
- this.listeners.push(l);
137
- }
138
- return () => {
139
- const i = this.listeners.indexOf(l);
140
- this.listeners.splice(i, 1);
141
- };
142
- }
143
- unwatch() {
144
- return this.folderCache.unwatch();
145
- }
146
- }
147
- exports.AutoUpdateSrcCodeCache = AutoUpdateSrcCodeCache;