Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const define = { FOOTER: null };
if (paths.rdocConf && paths.rdocConf.footer && typeof paths.rdocConf.footer === 'string') {
define.FOOTER = JSON.stringify(paths.rdocConf.footer);
}
module.exports = {
entry: {},
output: {
path: paths.appBuildDist,
publicPath: paths.publicPath,
filename: 'js/[name].[hash:8].js',
chunkFilename: 'js/[name].[hash:8].js',
},
resolve: {
alias: {
'rdoc-theme': UPATH.normalizeSafe(paths.appThemePath),
},
},
module: {
rules: [
{
test: /\.(js|jsx|mjs)$/,
exclude: [/node_modules/, /\.(cache)/, /rdoc-theme-(.*)/],
enforce: 'pre',
use: [
// TODO:禁用require.ensure也不是一种标准的语言特征。
// 我们等待https://github.com/facebookincubator/create-react-app/issues/2176。
// { parser: { requireEnsure: false } },
{
// 首先运行linter。
// 在Babel处理js之前做这一点很重要。
options: {
constructor(options = {}) {
options.root = options.root ? path.normalizeSafe(options.root) : path.dirname(module.parent.filename);
options.src = options.src ? path.normalizeSafe(options.src) : path.resolve(options.root, 'src');
options.nameExternalModules = options.nameExternalModules == undefined || options.nameExternalModules == true;
options.nameLocalModules = options.nameLocalModules == undefined || options.nameLocalModules == true;
options.resourceRegExp = options.resourceRegExp || /aurelia-loader-context/;
options.customViewLoaders = Object.assign({
'.css': ['css-loader'],
'.scss': ['css-loader', 'sass-loader'],
'.sass': ['css-loader', 'sass-loader'],
'.less': ['css-loader', 'less-loader'],
'.styl': ['css-loader', 'stylus-loader'],
}, options.customViewLoaders || {});
if (options.includeSubModules || options.contextMap) {
console.error('WARNING: You are passing a depracated option "includeSubModules" / "contextMap" to aurelia-webpack-plugin.');
console.error(' Please migrate your config to use aurelia.build.resources inside of your package.json.');
console.error(' For more information see: https://github.com/aurelia/skeleton-navigation/blob/master/skeleton-typescript-webpack/README.md#resource-and-bundling-configuration');
private getPathRelativeToInstallPath(
normalizedInstallPath: string,
maybeRelativePath: string
) {
const normalizedRelativePath = path.normalizeSafe(maybeRelativePath);
if (path.isAbsolute(normalizedRelativePath)) {
return normalizedRelativePath;
}
return path.resolve(
path.join(normalizedInstallPath, maybeRelativePath)
);
}
patterns = patterns.map((path, ...args) => upath.normalizeSafe(this.globPathWithExtensions(path), ...args))
public findFilesAsUris(globPattern: string): string[] {
return new GlobSync(normalize(globPattern)).found.map((f) =>
URI.file(f).toString()
);
}
}).then(answer => {
if (answer) {
newConfig.localPath = upath.normalizeSafe(answer);
} else {
newConfig.localPath = upath.normalizeSafe(process.cwd());
}
return this.cli.read(this.getPrompt("Remote Path", { required: true }));
}).then(answer => {
if (answer) {
getRemotePath(path: string): string {
let normalPath = upath.normalizeSafe(path);
let normalLocalPath = upath.normalizeSafe(this.config.localPath);
let remotePath = normalPath.replace(normalLocalPath, this.config.remotePath);
return upath.normalizeSafe(remotePath);
}
description: '
projectConfig.imports = projectConfig.imports
.map((importPath) => path.normalizeSafe(importPath))
.map(
(importPath) =>
path.isAbsolute(importPath)
? importPath
: path.resolve(base, importPath)
)
.map((importPath) => URI.file(importPath).toString());
projectConfig.filePath = URI.file(filePath).toString();
if (projectConfig.output) {
projectConfig.output = URI.file(
path.normalizeSafe(projectConfig.output)
).toString();
}
return projectConfig;
}
}
getRemotePath(path: string): string {
let normalPath = upath.normalizeSafe(path);
let normalLocalPath = upath.normalizeSafe(this.config.localPath);
let remotePath = normalPath.replace(normalLocalPath, this.config.remotePath);
return upath.normalizeSafe(remotePath);
}