From 7cc13ff4db60a76e8e40c61f8a8d6d0910034cad Mon Sep 17 00:00:00 2001 From: Joel Chen Date: Fri, 1 May 2020 01:06:32 -0700 Subject: [PATCH] dep: isomorphic-loader 3.1.0 --- packages/xarc-app-dev/lib/dev-admin/middleware.js | 6 +++--- packages/xarc-app-dev/lib/dev-admin/webpack-dev-relay.js | 4 +++- packages/xarc-app-dev/package.json | 2 +- packages/xarc-app-dev/scripts/map-isomorphic-cdn.js | 3 ++- .../test/spec/dev-admin/webpack-dev-relay.spec.js | 9 +++++---- packages/xarc-app/arch-clap.js | 4 ---- packages/xarc-app/package.json | 2 +- packages/xarc-webpack/lib/partials/isomorphic.js | 3 ++- packages/xarc-webpack/package.json | 2 +- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/packages/xarc-app-dev/lib/dev-admin/middleware.js b/packages/xarc-app-dev/lib/dev-admin/middleware.js index 245a13c43..f60457860 100644 --- a/packages/xarc-app-dev/lib/dev-admin/middleware.js +++ b/packages/xarc-app-dev/lib/dev-admin/middleware.js @@ -13,6 +13,7 @@ const { getWebpackStartConfig } = require("@xarc/webpack/lib/util/custom-check") const { getLogs, getLogEventAsHtml } = require("./log-reader"); const { fullDevServer, controlPaths } = require("../../config/dev-proxy"); const { formUrl } = require("../utils"); +const isomorphicLoaderConfig = require("isomorphic-loader/lib/config"); hotHelpers.pathMatch = (url, path) => { try { @@ -166,10 +167,9 @@ class Middleware { this.logEventsUrl = urlJoin(this.devBaseUrl, "/log-events"); this.dllDevUrl = urlJoin(this.devBaseUrl, "/dll"); - const ISO_LOADER_CONFIG = ".isomorphic-loader-config.json"; const LOADABLE_STATS = "loadable-stats.json"; - const isoLockfile = Path.resolve(`${ISO_LOADER_CONFIG}.lock`); - const isoConfigFile = Path.resolve(ISO_LOADER_CONFIG); + const isoLockfile = Path.resolve(isomorphicLoaderConfig.lockFile); + const isoConfigFile = Path.resolve(isomorphicLoaderConfig.configFile); // Must wait for isomorphic-loader to complete saving its config // file before continuing and do hot reload in the app server. diff --git a/packages/xarc-app-dev/lib/dev-admin/webpack-dev-relay.js b/packages/xarc-app-dev/lib/dev-admin/webpack-dev-relay.js index ae95587ee..adebda3b4 100644 --- a/packages/xarc-app-dev/lib/dev-admin/webpack-dev-relay.js +++ b/packages/xarc-app-dev/lib/dev-admin/webpack-dev-relay.js @@ -5,9 +5,11 @@ const _ = require("lodash"); +const isomorphicConfig = require("isomorphic-loader/lib/config"); + const WEBPACK_DEV_MESSAGES = [ // received config from isomorphic-loader webpack plugin - "isomorphic-loader-config", + isomorphicConfig.configName, // received webpack compile report, for refresh assets in SSR "webpack-report", // received webpack compile stats diff --git a/packages/xarc-app-dev/package.json b/packages/xarc-app-dev/package.json index 45cba913f..817a48130 100644 --- a/packages/xarc-app-dev/package.json +++ b/packages/xarc-app-dev/package.json @@ -63,7 +63,7 @@ "filter-scan-dir": "^1.0.9", "fs-extra": "^0.30.0", "identity-obj-proxy": "^3.0.0", - "isomorphic-loader": "^3.0.0", + "isomorphic-loader": "^3.1.0", "lodash": "^4.13.1", "log-update": "^4.0.0", "mime": "^1.6.0", diff --git a/packages/xarc-app-dev/scripts/map-isomorphic-cdn.js b/packages/xarc-app-dev/scripts/map-isomorphic-cdn.js index 5e339251a..71bebe8c2 100644 --- a/packages/xarc-app-dev/scripts/map-isomorphic-cdn.js +++ b/packages/xarc-app-dev/scripts/map-isomorphic-cdn.js @@ -5,6 +5,7 @@ const logger = require("@xarc/app/lib/logger"); const fs = require("fs"); const Path = require("path"); +const isomorphicConfig = require("isomorphic-loader/lib/config"); const isMain = require.main === module; function exit(code) { @@ -13,7 +14,7 @@ function exit(code) { function mapIsomorphicCdn(appDir) { appDir = appDir || process.cwd(); - const isoConfigFile = Path.join(appDir, ".isomorphic-loader-config.json"); + const isoConfigFile = Path.join(appDir, isoConfig.prodConfigFile); const cdnAssetsFile = Path.join(appDir, "config/assets.json"); const isoConfig = require(isoConfigFile); const cdnAssets = require(cdnAssetsFile); diff --git a/packages/xarc-app-dev/test/spec/dev-admin/webpack-dev-relay.spec.js b/packages/xarc-app-dev/test/spec/dev-admin/webpack-dev-relay.spec.js index a13c6aa83..4ac6b3e6f 100644 --- a/packages/xarc-app-dev/test/spec/dev-admin/webpack-dev-relay.spec.js +++ b/packages/xarc-app-dev/test/spec/dev-admin/webpack-dev-relay.spec.js @@ -2,6 +2,7 @@ const { EventEmitter } = require("events"); const WebpackDevRelay = require("../../../lib/dev-admin/webpack-dev-relay"); +const isomorphicConfig = require("isomorphic-loader/lib/config"); const { asyncVerify } = require("run-verify"); const _ = require("lodash"); @@ -47,7 +48,7 @@ describe("webpack-dev-relay", function() { wds.emit("message", { name: "webpack-report", valid: true, id: 1 }); wds.emit("message", { name: "webpack-report", valid: true, id: 2 }); wds.emit("message", { name: "webpack-report", valid: true, id: 3 }); - wds.emit("message", { name: "isomorphic-loader-config", valid: true }); + wds.emit("message", { name: isomorphicConfig.configName, valid: true }); wds.emit("message", { name: "webpack-stats", valid: true }); const app = new EventEmitter(); app.send = data => app.emit("message", data); @@ -62,7 +63,7 @@ describe("webpack-dev-relay", function() { }, r => { const s = _.sortBy(r, "name"); - expect(s[0]).to.include({ name: "isomorphic-loader-config", valid: true }); + expect(s[0]).to.include({ name: isomorphicConfig.configName, valid: true }); expect(s[1]).to.include({ name: "webpack-report", valid: true, id: 3 }); expect(s[2]).to.include({ name: "webpack-stats", valid: true }); } @@ -81,7 +82,7 @@ describe("webpack-dev-relay", function() { wds.emit("message", { name: "webpack-report", valid: true, id: 1 }); wds.emit("message", { name: "webpack-report", valid: true, id: 2 }); wds.emit("message", { name: "webpack-report", valid: true, id: 3 }); - wds.emit("message", { name: "isomorphic-loader-config", valid: true }); + wds.emit("message", { name: isomorphicConfig.configName, valid: true }); wds.emit("message", { name: "webpack-stats", valid: true }); const recv = []; return asyncVerify( @@ -93,7 +94,7 @@ describe("webpack-dev-relay", function() { }, r => { const s = _.sortBy(r, "name"); - expect(s[0]).to.include({ name: "isomorphic-loader-config", valid: true }); + expect(s[0]).to.include({ name: isomorphicConfig.configName, valid: true }); expect(s[1]).to.include({ name: "webpack-report", valid: true, id: 3 }); expect(s[2]).to.include({ name: "webpack-stats", valid: true }); } diff --git a/packages/xarc-app/arch-clap.js b/packages/xarc-app/arch-clap.js index 5dd5568e7..9ed4fa807 100644 --- a/packages/xarc-app/arch-clap.js +++ b/packages/xarc-app/arch-clap.js @@ -802,10 +802,6 @@ Individual .babelrc files were generated for you in src/client and src/server options: node.js --inspect can be used to debug the dev-admin`, dep: [".remove-log-files", ".development-env", ".mk-dist-dir", ".build.babelrc"], task() { - if (!Fs.existsSync(".isomorphic-loader-config.json")) { - Fs.writeFileSync(".isomorphic-loader-config.json", JSON.stringify({})); - } - return [ ".set.css-module.env", ".webpack-dev", diff --git a/packages/xarc-app/package.json b/packages/xarc-app/package.json index 1c67f2717..edd22aa33 100644 --- a/packages/xarc-app/package.json +++ b/packages/xarc-app/package.json @@ -32,7 +32,7 @@ "@babel/runtime": "^7.8.3", "css-modules-require-hook": "^4.0.2", "ignore-styles": "^5.0.1", - "isomorphic-loader": "^3.0.0", + "isomorphic-loader": "^3.1.0", "optional-require": "^1.0.0", "subapp-util": "^1.0.5" }, diff --git a/packages/xarc-webpack/lib/partials/isomorphic.js b/packages/xarc-webpack/lib/partials/isomorphic.js index b9c347540..6df30c07f 100644 --- a/packages/xarc-webpack/lib/partials/isomorphic.js +++ b/packages/xarc-webpack/lib/partials/isomorphic.js @@ -2,12 +2,13 @@ const archetype = require("@xarc/app/config/archetype"); const IsomorphicLoaderPlugin = require("isomorphic-loader/lib/webpack-plugin"); +const isomorphicConfig = require("isomorphic-loader/lib/config"); const Path = require("path"); const { babel } = archetype; module.exports = function(opts) { const target = babel.target !== "default" ? `-${babel.target}` : ""; - const configFile = Path.resolve(`.isomorphic-loader-config${target}.json`); + const configFile = Path.resolve(isomorphicConfig.configFile.replace(".json", `${target}.json`)); return { plugins: [ new IsomorphicLoaderPlugin({ diff --git a/packages/xarc-webpack/package.json b/packages/xarc-webpack/package.json index 4ed068af8..fe27fbef9 100644 --- a/packages/xarc-webpack/package.json +++ b/packages/xarc-webpack/package.json @@ -35,7 +35,7 @@ "electrode-node-resolver": "^2.0.0", "file-loader": "^2.0.0", "filter-scan-dir": "^1.0.9", - "isomorphic-loader": "^3.0.0", + "isomorphic-loader": "^3.1.0", "lodash": "^4.13.1", "mini-css-extract-plugin": "^0.7.0", "mkdirp": "^1.0.3",