Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let wxsPath = filename;
wxsPath = wxsPath.replace(_fileInfo.output, '');
wxsPath = wxsPath + moduleName + 'sjs.js';
if (sjsCode.match(/\s*getRegExp/g)) {
let preCode = `
function getRegExp (p1, p2) {
return new RegExp(p1, p2);
}
\n
`;
sjsCode = preCode + sjsCode;
}
fs.outputFileSync(filename + moduleName + 'sjs.js', sjsCode);
_ast.children[0].value = '';
wxsApp.createDep(route, wxsPath, moduleName, _fileInfo.output);
// _ast.props.src = { type: 'double', value: [ './' + _relativePath ] };
bool = true;
} catch (e) {
if (e) {
console.error(e);
}
}
} else {
let filename = _fileInfo.dist;
let moduleName = _ast.props.module.value[0];
let wxsPath = _ast.props.src.value[0] + '.js';
//////////////////////////////////////////
validateSchema.validateBatch('field', registry.field);
validateSchema.validateBatch('model', registry.model);
validateSchema.validateBatch('form', registry.form);
//////////////////////////////////////////
// EXPAND REGISTRY THROUGH INHERITANCE //
//////////////////////////////////////////
registry.expandedModel = exports.expandModels(registry);
registry.expandedForm = exports.expandForms(registry);
// Write Registry to file
fs.outputFileSync(settings.processedModelDir + '/_registry.json', JSON.stringify(registry, null, 4));
callback(false, registry);
}).catch(function(error){
callback(error, false);
beforeEach(function () {
fs.outputFileSync('.tmp/index.html', 'index', 'utf8');
fs.outputFileSync('.tmp/me.html', 'testing', 'utf8');
fs.outputFileSync('.tmp/about/index.html', 'about index', 'utf8');
app = connect()
.use(function (req, res, next) {
responder({
req: req,
res: res,
provider: provider
});
next();
});
});
beforeAll(() => {
fse.outputFileSync(path.join(__dirname, 'output/watch-import-chunk/chunk1.js'), 'console.log(\'chunk 1\')');
fse.outputFileSync(path.join(__dirname, 'output/watch-import-chunk/chunk2.js'), 'console.log(\'chunk 2\')');
fse.outputFileSync(path.join(__dirname, 'output/watch-import-chunk/index.js'), 'import(\'./chunk1\')\nimport(\'./chunk2\')');
isFirstRun = true;
});
const preparations = () => {
fse.outputFileSync("a/b/file.txt", "1");
fse.outputFileSync("a/b/c/file.txt", "2");
fse.outputFileSync("a/b/c/file.md", "3");
fse.outputFileSync("a/x/y/z", "Zzzzz...");
};
outputFile(filePathRelativeToLocalScope: string, data = ''): void {
return fs.outputFileSync(path.join(this.scopes.localPath, filePathRelativeToLocalScope), data);
}
contents.forEach(function (content, index) {
if (self.hashLength) {
output[index] = self.rename(output[index], self.hash.string(content), self.hashLength);
}
log.trace('Write %s.', chalk.blue(output[index]));
fs.outputFileSync(output[index], content);
});
}
}
if(col.dataType === 'string') {
rule.max = col.maxLength || 10
}
return {
key: `${col.key}`,
name: `${col.label}`,
rule,
validType: 'all'
}
})
}
const template =
`module.exports = ${JSON.stringify(model, null, ' ')}`
fs.outputFileSync(dist, template)
}
build() {
let filename = join(this.outputPath, 'config/environment.js');
let contents;
if (this.storeConfigInMeta) {
contents = metaLoader(this.appName);
} else {
contents = `export default ${JSON.stringify(this.inputTree.readConfig())};`;
}
if (!this.lastContents || this.lastContents !== contents) {
outputFileSync(filename, contents);
}
this.lastContents = contents;
}
}
const prepareComponent = (comp: Component) => {
const componentPath = path.join(tmpdir, comp.name, comp.version);
fs.outputFileSync(path.join(componentPath, 'index.js'), comp.code);
fs.outputFileSync(
path.join(componentPath, 'package.json'),
JSON.stringify({ main: 'index.js', peerDependencies: comp.peerDependencies })
);
};