Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dep: isomorphic-loader 3.1.0 #1636

Merged
merged 1 commit into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/xarc-app-dev/lib/dev-admin/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion packages/xarc-app-dev/lib/dev-admin/webpack-dev-relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/xarc-app-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion packages/xarc-app-dev/scripts/map-isomorphic-cdn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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);
Expand All @@ -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 });
}
Expand All @@ -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(
Expand All @@ -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 });
}
Expand Down
4 changes: 0 additions & 4 deletions packages/xarc-app/arch-clap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/xarc-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/xarc-webpack/lib/partials/isomorphic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion packages/xarc-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down