Skip to content

Commit

Permalink
Work around missing unicorn-magic export from globby in Webpack scena…
Browse files Browse the repository at this point in the history
…rio.
  • Loading branch information
DavidAnson committed Nov 17, 2023
1 parent be0af89 commit a37b780
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
],
"ignorePatterns": [
"test/*/**",
"webworker/markdownlint-cli2-webworker.js"
"webworker/markdownlint-cli2-webworker.js",
"webworker/setImmediate.js"
],
"reportUnusedDisableDirectives": true,
"rules": {
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ npm-debug.log
!test/markdownItPlugins/module/node_modules
!test/outputFormatters-module/node_modules
webworker/markdownlint-cli2-webworker.js
webworker/setImmediate.js
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"test-watch": "git ls-files | entr npm run test",
"update-snapshots": "ava --timeout=1m --update-snapshots test/markdownlint-cli2-test-exec.js test/markdownlint-cli2-test-fs.js test/markdownlint-cli2-test-main.js",
"webworker": "cd webworker && webpack --mode none",
"webworker-install": "npm run docker-npm-install -- --no-save path-browserify process setimmediate stream-browserify url util webpack-cli"
"webworker-install": "npm install --no-save path-browserify process setimmediate stream-browserify url util webpack-cli && cpy ./node_modules/setimmediate/setImmediate.js ./webworker --flat"
},
"engines": {
"node": ">=18"
Expand Down
2 changes: 1 addition & 1 deletion webworker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="https://code.jquery.com/qunit/qunit-2.19.1.js" crossorigin="anonymous" integrity="sha256-JKXf8hYyT6TCyX2GIQgbqsBGOx1Fq4kI0IHuoTxbj44="></script>
<script src="../node_modules/setimmediate/setImmediate.js"></script>
<script src="./setImmediate.js"></script>
<script src="./markdownlint-cli2-webworker.js"></script>
<script src="./fs-virtual.js"></script>
<script src="./webworker-test.js"></script>
Expand Down
7 changes: 7 additions & 0 deletions webworker/unicorn-magic-stub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @ts-check

"use strict";

module.exports = {
"toPath": (path) => path
};
6 changes: 6 additions & 0 deletions webworker/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ module.exports = {
resource.request = module;
}
),
new webpack.NormalModuleReplacementPlugin(
/^unicorn-magic$/u,
(resource) => {
resource.request = require.resolve("./unicorn-magic-stub.js");
}
),
new webpack.ProvidePlugin({
"process": "process-wrapper"
})
Expand Down

0 comments on commit a37b780

Please sign in to comment.