feat(cache): enable --nocache cli option
This commit is contained in:
parent
42f2f132f1
commit
51808f230a
15
dist/index.js
vendored
15
dist/index.js
vendored
@ -1,14 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const tsNode = require("./tsnode");
|
||||
tsNode.register({
|
||||
const tsNode = require("ts-node");
|
||||
const defaultTsNodeOptions = {
|
||||
compilerOptions: {
|
||||
lib: ['es2016', 'es2017']
|
||||
lib: ['es2016', 'es2017'],
|
||||
target: 'es2015',
|
||||
},
|
||||
skipIgnore: true,
|
||||
cacheDirectory: path.join(__dirname, '../tscache')
|
||||
});
|
||||
};
|
||||
if (process.argv.includes('--nocache')) {
|
||||
defaultTsNodeOptions.cache = false;
|
||||
}
|
||||
tsNode.register(defaultTsNodeOptions);
|
||||
if (process.env.CLI_CALL_TSRUN) {
|
||||
// contents of argv array
|
||||
// process.argv[0] -> node Executable
|
||||
@ -17,4 +22,4 @@ if (process.env.CLI_CALL_TSRUN) {
|
||||
const pathToLoad = path.join(process.cwd(), pathToTsFile);
|
||||
Promise.resolve().then(() => require(pathToLoad));
|
||||
}
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixtQ0FBbUM7QUFFbkMsTUFBTSxDQUFDLFFBQVEsQ0FBQztJQUNkLGVBQWUsRUFBRTtRQUNmLEdBQUcsRUFBRSxDQUFFLFFBQVEsRUFBRSxRQUFRLENBQUU7S0FDNUI7SUFDRCxVQUFVLEVBQUUsSUFBSTtJQUNoQixjQUFjLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsWUFBWSxDQUFDO0NBQ25ELENBQUMsQ0FBQztBQUVILElBQUksT0F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DckMsc0NBQXNDO0lBQ3RDLE1BQU0sWUFBWSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFFcEMsTUFBTSxVQUFVLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLEVBQUUsWUFBWSxDQUFDLENBQUM7SUFDMUQscUNBQU8sVUFBVSxHQUFFO0NBQ3BCIn0=
|
99
dist/tsnode.d.ts
vendored
99
dist/tsnode.d.ts
vendored
@ -1,99 +0,0 @@
|
||||
import { BaseError } from 'make-error';
|
||||
import * as _ts from 'typescript';
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare const INSPECT_CUSTOM: string | symbol;
|
||||
/**
|
||||
* Common TypeScript interfaces between versions.
|
||||
*/
|
||||
export interface TSCommon {
|
||||
version: typeof _ts.version;
|
||||
sys: typeof _ts.sys;
|
||||
ScriptSnapshot: typeof _ts.ScriptSnapshot;
|
||||
displayPartsToString: typeof _ts.displayPartsToString;
|
||||
createLanguageService: typeof _ts.createLanguageService;
|
||||
getDefaultLibFilePath: typeof _ts.getDefaultLibFilePath;
|
||||
getPreEmitDiagnostics: typeof _ts.getPreEmitDiagnostics;
|
||||
flattenDiagnosticMessageText: typeof _ts.flattenDiagnosticMessageText;
|
||||
transpileModule: typeof _ts.transpileModule;
|
||||
ModuleKind: typeof _ts.ModuleKind;
|
||||
ScriptTarget: typeof _ts.ScriptTarget;
|
||||
findConfigFile: typeof _ts.findConfigFile;
|
||||
readConfigFile: typeof _ts.readConfigFile;
|
||||
parseJsonConfigFileContent: typeof _ts.parseJsonConfigFileContent;
|
||||
formatDiagnostics: typeof _ts.formatDiagnostics;
|
||||
formatDiagnosticsWithColorAndContext: typeof _ts.formatDiagnosticsWithColorAndContext;
|
||||
}
|
||||
/**
|
||||
* Export the current version.
|
||||
*/
|
||||
export declare const VERSION: any;
|
||||
/**
|
||||
* Registration options.
|
||||
*/
|
||||
export interface Options {
|
||||
pretty?: boolean | null;
|
||||
typeCheck?: boolean | null;
|
||||
transpileOnly?: boolean | null;
|
||||
files?: boolean | null;
|
||||
cache?: boolean | null;
|
||||
cacheDirectory?: string;
|
||||
compiler?: string;
|
||||
ignore?: string | string[];
|
||||
project?: string;
|
||||
skipIgnore?: boolean | null;
|
||||
skipProject?: boolean | null;
|
||||
compilerOptions?: object;
|
||||
ignoreDiagnostics?: number | string | Array<number | string>;
|
||||
readFile?: (path: string) => string | undefined;
|
||||
fileExists?: (path: string) => boolean;
|
||||
transformers?: _ts.CustomTransformers;
|
||||
}
|
||||
/**
|
||||
* Information retrieved from type info check.
|
||||
*/
|
||||
export interface TypeInfo {
|
||||
name: string;
|
||||
comment: string;
|
||||
}
|
||||
/**
|
||||
* Default register options.
|
||||
*/
|
||||
export declare const DEFAULTS: Options;
|
||||
/**
|
||||
* Split a string array of values.
|
||||
*/
|
||||
export declare function split(value: string | undefined): string[];
|
||||
/**
|
||||
* Parse a string as JSON.
|
||||
*/
|
||||
export declare function parse(value: string | undefined): object | undefined;
|
||||
/**
|
||||
* Replace backslashes with forward slashes.
|
||||
*/
|
||||
export declare function normalizeSlashes(value: string): string;
|
||||
/**
|
||||
* TypeScript diagnostics error.
|
||||
*/
|
||||
export declare class TSError extends BaseError {
|
||||
diagnosticText: string;
|
||||
diagnosticCodes: number[];
|
||||
name: string;
|
||||
constructor(diagnosticText: string, diagnosticCodes: number[]);
|
||||
}
|
||||
/**
|
||||
* Return type for registering `ts-node`.
|
||||
*/
|
||||
export interface Register {
|
||||
cwd: string;
|
||||
extensions: string[];
|
||||
cachedir: string;
|
||||
ts: TSCommon;
|
||||
compile(code: string, fileName: string, lineOffset?: number): string;
|
||||
getTypeInfo(code: string, fileName: string, position: number): TypeInfo;
|
||||
}
|
||||
/**
|
||||
* Register TypeScript compiler.
|
||||
*/
|
||||
export declare function register(opts?: Options): Register;
|
439
dist/tsnode.js
vendored
439
dist/tsnode.js
vendored
File diff suppressed because one or more lines are too long
6
package-lock.json
generated
6
package-lock.json
generated
@ -13,9 +13,9 @@
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "10.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.3.0.tgz",
|
||||
"integrity": "sha512-hWzNviaVFIr1TqcRA8ou49JaSHp+Rfabmnqg2kNvusKqLhPU0rIsGPUj5WJJ7ld4Bb7qdgLmIhLfCD1qS08IVA=="
|
||||
"version": "10.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.1.tgz",
|
||||
"integrity": "sha512-AFLl1IALIuyt6oK4AYZsgWVJ/5rnyzQWud7IebaZWWV3YmgtPZkQmYio9R5Ze/2pdd7XfqF5bP+hWS11mAKoOQ=="
|
||||
},
|
||||
"@types/vinyl": {
|
||||
"version": "2.0.2",
|
||||
|
@ -16,7 +16,7 @@
|
||||
"postinstall": "(node ./cli.js scripts/postinstall.ts)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.3.0"
|
||||
"@types/node": "^10.5.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"smartfile": "^4.2.28",
|
||||
|
13
ts/index.ts
13
ts/index.ts
@ -1,13 +1,20 @@
|
||||
import * as path from 'path';
|
||||
import * as tsNode from 'ts-node';
|
||||
|
||||
tsNode.register({
|
||||
const defaultTsNodeOptions: tsNode.Options = {
|
||||
compilerOptions: {
|
||||
lib: [ 'es2016', 'es2017' ]
|
||||
lib: ['es2016','es2017'],
|
||||
target: 'es2015',
|
||||
},
|
||||
skipIgnore: true,
|
||||
cacheDirectory: path.join(__dirname, '../tscache')
|
||||
});
|
||||
}
|
||||
|
||||
if (process.argv.includes('--nocache')) {
|
||||
defaultTsNodeOptions.cache = false;
|
||||
}
|
||||
|
||||
tsNode.register(defaultTsNodeOptions);
|
||||
|
||||
if (process.env.CLI_CALL_TSRUN) {
|
||||
// contents of argv array
|
||||
|
Loading…
Reference in New Issue
Block a user