@stylin/ts-loader
Advanced tools
Comparing version
@@ -9,3 +9,3 @@ "use strict"; | ||
const fs_1 = require("fs"); | ||
const template = fs_1.readFileSync(path_1.join(__dirname, `template.hbs`), `utf8`); | ||
const template = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, `template.hbs`), `utf8`); | ||
const toDTS = Handlebars.compile(template, { noEscape: true }); | ||
@@ -17,12 +17,12 @@ const makeOptions = R.merge({ | ||
const nameFile = (path) => { | ||
const dirName = path_1.dirname(path); | ||
const baseName = path_1.basename(path); | ||
return path_1.join(dirName, `${baseName}.d.ts`); | ||
const dirName = (0, path_1.dirname)(path); | ||
const baseName = (0, path_1.basename)(path); | ||
return (0, path_1.join)(dirName, `${baseName}.d.ts`); | ||
}; | ||
function loader(content, sourceMap, meta) { | ||
const onComplete = this.async(); | ||
const { propsType, styledPropsType } = makeOptions(loader_utils_1.getOptions(this)); | ||
const { propsType, styledPropsType } = makeOptions((0, loader_utils_1.getOptions)(this)); | ||
const exports = meta.msa.map(({ componentName, className, properties, tagName, variables }) => { | ||
const parsedProperties = parser_1.parseProperty(properties); | ||
const parsedVariables = parser_1.parseVariable(variables); | ||
const parsedProperties = (0, parser_1.parseProperty)(properties); | ||
const parsedVariables = (0, parser_1.parseVariable)(variables); | ||
return { | ||
@@ -41,3 +41,3 @@ className, | ||
const isRestyled = exports.some(({ isStyled }) => isStyled); | ||
fs_1.writeFile(nameFile(this.resource), toDTS({ isRestyled, exports }), error => error && this.emitWarning(error)); | ||
(0, fs_1.writeFile)(nameFile(this.resource), toDTS({ isRestyled, exports }), error => error && this.emitWarning(error)); | ||
onComplete(null, content, sourceMap, meta); | ||
@@ -44,0 +44,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const parseProperty: (x: Record<string | number, unknown>) => any; | ||
export declare const parseVariable: (x: Record<string | number, unknown>) => string; | ||
export declare const parseProperty: (obj: Record<string | number, unknown>) => unknown; | ||
export declare const parseVariable: (obj: Record<string | number, unknown>) => string; |
{ | ||
"name": "@stylin/ts-loader", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Stylin TypeScript typing loader module for webpack", | ||
@@ -28,14 +28,14 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "^14.14.31", | ||
"@types/ramda": "^0.27.38", | ||
"@typescript-eslint/eslint-plugin": "^4.15.0", | ||
"@typescript-eslint/parser": "^4.15.0", | ||
"eslint": "^7.19.0", | ||
"eslint-plugin-react": "^7.22.0", | ||
"loader-utils": "^2.0.0", | ||
"typescript": "^4.1.3" | ||
"@types/node": "^17.0.23", | ||
"@types/ramda": "^0.28.3", | ||
"@typescript-eslint/eslint-plugin": "^5.16.0", | ||
"@typescript-eslint/parser": "^5.16.0", | ||
"eslint": "^8.12.0", | ||
"eslint-plugin-react": "^7.29.4", | ||
"loader-utils": "^3.2.0", | ||
"typescript": "^4.6.3" | ||
}, | ||
"dependencies": { | ||
"handlebars": "^4.7.7", | ||
"ramda": "^0.27.1" | ||
"ramda": "^0.28.0" | ||
}, | ||
@@ -45,3 +45,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "39d0d9f6cbb2ec1af40cd2410604e5aa42d3762f" | ||
"gitHead": "6b0226e8080d0c6b74361234b1641cccb1bb9d54" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
11933
10.57%10
11.11%+ Added
- Removed
Updated