single-spa-angular
Advanced tools
Comparing version 6.3.0 to 6.3.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const find_up_1 = require("@angular/cli/utilities/find-up"); | ||
const externals_1 = require("./externals"); | ||
const remove_mini_css_extract_1 = require("./webpack-5/remove-mini-css-extract"); | ||
@@ -11,3 +11,3 @@ const defaultExtraOptions = { | ||
exports.default = (config, options, extraOptions) => { | ||
var _a, _b, _c, _d, _e; | ||
var _a, _b, _c, _d; | ||
const libraryName = getLibraryName(config, options); | ||
@@ -26,11 +26,2 @@ extraOptions = Object.assign(Object.assign({}, defaultExtraOptions), extraOptions); | ||
historyApiFallback: false, | ||
static: { | ||
// The `devServer.contentBase` property isn't used anymore, the Angular CLI sets the `resolve.roots` property | ||
// that references the project root directory. | ||
// See: https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/webpack/configs/common.ts#L304 | ||
// Otherwise, we just fallback to `src` folder. | ||
directory: Array.isArray((_c = config.resolve) === null || _c === void 0 ? void 0 : _c.roots) | ||
? config.resolve.roots[0] | ||
: path.join(process.cwd(), 'src'), | ||
}, | ||
headers: { | ||
@@ -45,9 +36,7 @@ 'Access-Control-Allow-Headers': '*', | ||
}; | ||
if ((_d = options === null || options === void 0 ? void 0 : options.customWebpackConfig) === null || _d === void 0 ? void 0 : _d.excludeAngularDependencies) { | ||
// Note: we need to specify packages explicitly w/o wildcards (e.g. /@angular\/*/). The developer | ||
// may have an alias that also starts with `@angular/`, this may lead to unexpected behavior. | ||
singleSpaConfig.externals.push('rxjs', 'rxjs/operators', '@angular/core', '@angular/compiler', '@angular/common', '@angular/common/http', '@angular/common/upgrade', '@angular/platform-browser', '@angular/platform-browser/animations', '@angular/platform-browser-dynamic', '@angular/router', '@angular/router/upgrade', '@angular/animations', '@angular/animations/browser', '@angular/forms', '@angular/elements', '@angular/upgrade', '@angular/upgrade/static', '@angular/service-worker', '@angular/service-worker/config', '@angular/localize', 'single-spa', 'single-spa-angular/internals', 'single-spa-angular', 'single-spa-angular/elements', 'single-spa-angular/parcel'); | ||
if ((_c = options === null || options === void 0 ? void 0 : options.customWebpackConfig) === null || _c === void 0 ? void 0 : _c.excludeAngularDependencies) { | ||
singleSpaConfig.externals.push(...externals_1.externals); | ||
} | ||
// Do not set the `client.webSocketURL` configuration if there's no host and port. | ||
if (((_e = config.devServer) === null || _e === void 0 ? void 0 : _e.host) && config.devServer.port) { | ||
if (((_d = config.devServer) === null || _d === void 0 ? void 0 : _d.host) && config.devServer.port) { | ||
singleSpaConfig.devServer.client = { | ||
@@ -98,2 +87,3 @@ webSocketURL: { | ||
} | ||
const logger = createLogger(); | ||
function getLibraryName(config, options) { | ||
@@ -107,8 +97,8 @@ var _a; | ||
return projectName; | ||
console.warn('Warning: single-spa-angular could not determine a library name to use and has used a default value.'); | ||
console.warn('This may cause issues if this app uses code-splitting or lazy loading.'); | ||
logger.warn('Warning: single-spa-angular could not determine a library name to use and has used a default value.'); | ||
logger.warn('This may cause issues if this app uses code-splitting or lazy loading.'); | ||
if (!options) { | ||
console.warn('You may also need to update extra-webpack.config.json.'); | ||
logger.warn('You may also need to update extra-webpack.config.json.'); | ||
} | ||
console.warn('See <https://single-spa.js.org/docs/ecosystem-angular/#use-custom-webpack> for information on how to resolve this.'); | ||
logger.warn('See <https://single-spa.js.org/docs/ecosystem-angular/#use-custom-webpack> for information on how to resolve this.'); | ||
return 'angular_single_spa_project'; | ||
@@ -204,2 +194,18 @@ } | ||
} | ||
function createLogger() { | ||
try { | ||
// If we're in an Nx workspace then use its logger. | ||
// eslint-disable-next-line | ||
const { output } = require('@nrwl/workspace'); | ||
return { | ||
warn: (message) => output.warn({ title: message }), | ||
}; | ||
} | ||
catch (_a) { | ||
// Otherwise, fallback to `console.warn`. | ||
return { | ||
warn: (message) => console.warn(message), | ||
}; | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"$schema": "../node_modules/ng-packagr/ng-package.schema.json", | ||
"name": "single-spa-angular", | ||
"version": "6.3.0", | ||
"version": "6.3.1", | ||
"description": "Helpers for building single-spa applications which use Angular 2", | ||
@@ -6,0 +6,0 @@ "schematics": "./schematics/schematics.json", |
Sorry, the diff of this file is not supported yet
244461
98
2363