@anatine/esbuild-decorators
Advanced tools
Comparing version 0.2.17 to 0.2.18
@@ -0,1 +1,10 @@ | ||
## 0.2.17 (2021-08-20) | ||
### Updates | ||
* **release:** Support Node 12 | ||
## 0.2.17 (2021-08-04) | ||
### Updates | ||
* **release:** Updating dependencies | ||
## 0.2.12 (2021-06-29) | ||
@@ -2,0 +11,0 @@ |
{ | ||
"name": "@anatine/esbuild-decorators", | ||
"version": "0.2.17", | ||
"version": "0.2.18", | ||
"description": "Esbuild plugin for Nx to handle emitDecoratorMetadata", | ||
@@ -32,5 +32,5 @@ "repository": { | ||
"peerDependencies": { | ||
"esbuild": "~0.12.17" | ||
"esbuild": "~0.12.28" | ||
}, | ||
"typings": "./src/index.d.ts" | ||
} | ||
} |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const promises_1 = require("fs/promises"); | ||
const fs_1 = require("fs"); | ||
const path_1 = require("path"); | ||
@@ -11,4 +11,5 @@ const typescript_1 = require("typescript"); | ||
const strip_it_1 = require("./strip-it"); | ||
const { readFile } = fs_1.promises; | ||
const theFinder = new RegExp(/((?<![(\s]\s*['"])@\w[.[\]\w\d]*\s*(?![;])[((?=\s)])/); | ||
const findDecorators = (fileContent) => theFinder.test(strip_it_1.strip(fileContent)); | ||
const findDecorators = (fileContent) => theFinder.test((0, strip_it_1.strip)(fileContent)); | ||
const esbuildDecorators = (options = {}) => ({ | ||
@@ -21,7 +22,7 @@ name: 'tsc', | ||
((_a = build.initialOptions) === null || _a === void 0 ? void 0 : _a.tsconfig) || | ||
path_1.join(cwd, './tsconfig.json'); | ||
(0, path_1.join)(cwd, './tsconfig.json'); | ||
const forceTsc = (_b = options.force) !== null && _b !== void 0 ? _b : false; | ||
const tsx = (_c = options.tsx) !== null && _c !== void 0 ? _c : true; | ||
let parsedTsConfig = null; | ||
build.onLoad({ filter: tsx ? /\.tsx?$/ : /\.ts$/ }, (args) => tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
build.onLoad({ filter: tsx ? /\.tsx?$/ : /\.ts$/ }, (args) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if (!parsedTsConfig) { | ||
@@ -42,3 +43,3 @@ parsedTsConfig = parseTsConfig(tsconfigPath, cwd); | ||
} | ||
const ts = yield promises_1.readFile(args.path, 'utf8').catch((err) => printDiagnostics({ file: args.path, err })); | ||
const ts = yield readFile(args.path, 'utf8').catch((err) => printDiagnostics({ file: args.path, err })); | ||
// Find the decorator and if there isn't one, return out | ||
@@ -49,3 +50,3 @@ const hasDecorator = findDecorators(ts); | ||
} | ||
const program = typescript_1.transpileModule(ts, { | ||
const program = (0, typescript_1.transpileModule)(ts, { | ||
compilerOptions: parsedTsConfig.options, | ||
@@ -59,3 +60,3 @@ }); | ||
function parseTsConfig(tsconfig, cwd = process.cwd()) { | ||
const fileName = typescript_1.findConfigFile(cwd, typescript_1.sys.fileExists, tsconfig); | ||
const fileName = (0, typescript_1.findConfigFile)(cwd, typescript_1.sys.fileExists, tsconfig); | ||
// if the value was provided, but no file, fail hard | ||
@@ -70,3 +71,3 @@ if (tsconfig !== undefined && !fileName) | ||
throw new Error(`failed to read '${fileName}'`); | ||
const result = typescript_1.parseConfigFileTextToJson(fileName, text); | ||
const result = (0, typescript_1.parseConfigFileTextToJson)(fileName, text); | ||
if (result.error !== undefined) { | ||
@@ -77,5 +78,5 @@ printDiagnostics(result.error); | ||
loadedConfig = result.config; | ||
baseDir = path_1.dirname(fileName); | ||
baseDir = (0, path_1.dirname)(fileName); | ||
} | ||
const parsedTsConfig = typescript_1.parseJsonConfigFileContent(loadedConfig, typescript_1.sys, baseDir); | ||
const parsedTsConfig = (0, typescript_1.parseJsonConfigFileContent)(loadedConfig, typescript_1.sys, baseDir); | ||
if (parsedTsConfig.errors[0]) | ||
@@ -86,4 +87,4 @@ printDiagnostics(parsedTsConfig.errors); | ||
function printDiagnostics(...args) { | ||
console.log(util_1.inspect(args, false, 10, true)); | ||
console.log((0, util_1.inspect)(args, false, 10, true)); | ||
} | ||
//# sourceMappingURL=esbuild-decorators.js.map |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
22307
252