smartclient-eval
Advanced tools
Comparing version 0.9.19 to 0.9.20
@@ -296,3 +296,3 @@ /* | ||
static get REACT_SOURCE_PATTERN() { | ||
return "^[^#~]+\\.[A-Za-z]+$"; | ||
return "^(?=[^#~]).*?([A-Za-z]+)\\.js$"; | ||
} | ||
@@ -299,0 +299,0 @@ |
@@ -37,3 +37,3 @@ { | ||
}, | ||
"version": "0.9.19" | ||
"version": "0.9.20" | ||
} |
@@ -770,4 +770,2 @@ #!/usr/bin/env node | ||
} else { | ||
fs.outputFileSync(reactLoaderPath.replace(".js", ".d.ts"), | ||
"declare module '" + Const.MODULE_NAME + "/react'"); | ||
Update._createReactLoader(branch, reactLoaderPath, reactWrapperPath); | ||
@@ -857,2 +855,4 @@ console.log("Installed SmartClient React support and import script."); | ||
static _createReactLoader(branch, loaderPath, wrappersDir) { | ||
const typescriptPath = loaderPath.replace(".js", ".d.ts"); | ||
// if not an internal project, install wrapper files under React app source dir | ||
@@ -877,2 +877,3 @@ if (!path.resolve(wrappersDir).match(/isomorphic\/react\/[^\/]+\/isomorphic/)) { | ||
// build the React module definition out into the file index.js | ||
let exportStatements = [ | ||
@@ -887,4 +888,25 @@ "if (window.isc) window.isc.react = true;\n" | ||
}); | ||
fs.outputFileSync(loaderPath, exportStatements.join( EOL ) + EOL); | ||
fs.outputFileSync(loaderPath, exportStatements.join( EOL )); | ||
// build the React module typescript out into the file index.d.ts | ||
exportStatements = [ | ||
"// typescript declarations for module " + Const.MODULE_NAME + "\n" | ||
]; | ||
files.forEach( filePath => { | ||
let tsMatch = filePath.match(Const.REACT_SOURCE_PATTERN); | ||
if (tsMatch) { | ||
let className = tsMatch[1]; | ||
filePath = Update._canonicalizePath(filePath).replace(/\.js$/, ""); | ||
exportStatements.push( | ||
`export { ${className} } from "${wrappersDir}/${filePath}";`); | ||
} | ||
}); | ||
exportStatements.push( | ||
"\n// to disable typescript for SmartClient, remove all the exports above", | ||
"declare module '" + Const.MODULE_NAME + "/react'"); | ||
fs.outputFileSync(typescriptPath, exportStatements.join( EOL ) + EOL); | ||
} | ||
@@ -891,0 +913,0 @@ |
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
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
80867
1617