Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Nov 23, 2024
1 parent c198b0a commit 4bf559a
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"test-watch": "git ls-files | entr npm run test",
"update-snapshots": "ava --timeout=1m --update-snapshots test/markdownlint-cli2-test-exec.mjs test/markdownlint-cli2-test-fs.mjs test/markdownlint-cli2-test-main.mjs",
"webworker": "cd webworker && webpack --mode none",
"webworker-install": "npm install --no-package-lock --no-save path-browserify setimmediate stream-browserify util webpack-cli && cpy ./node_modules/setimmediate/setImmediate.js ./webworker/setImmediate.cjs --flat"
"webworker-install": "npm install --no-package-lock --no-save path-browserify setimmediate stream-browserify util webpack-cli && cpy ./node_modules/setimmediate/setImmediate.js ./webworker --flat --rename=setImmediate.cjs"
},
"engines": {
"node": ">=18"
Expand Down
2 changes: 1 addition & 1 deletion test/fs-virtual-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from "node:path";
import { promisify } from "node:util";
import test from "ava";
import { __filename } from "./esm-helpers.mjs";
import FsVirtual from "../webworker/fs-virtual.mjs";
import FsVirtual from "../webworker/fs-virtual.cjs";

const mockPath = "/mock";
const thisFile = path.basename(__filename(import.meta));
Expand Down
2 changes: 1 addition & 1 deletion test/markdownlint-cli2-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { "main" as markdownlintCli2 } from "../markdownlint-cli2.mjs";
import jsoncParse from "../parsers/jsonc-parse.mjs";
import yamlParse from "../parsers/yaml-parse.mjs";
import FsMock from "./fs-mock.mjs";
import FsVirtual from "../webworker/fs-virtual.mjs";
import FsVirtual from "../webworker/fs-virtual.cjs";
import firstLine from "./customRules/rules/first-line.cjs";

const schemaIdVersionRe = /^.*v(?<version>\d+\.\d+\.\d+).*$/u;
Expand Down
6 changes: 5 additions & 1 deletion webworker/fs-virtual.mjs → webworker/fs-virtual.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// @ts-check

"use strict";

const dirent = (path, directory) => {
const name = path.replace(/^.*\//u, "");
return {
Expand Down Expand Up @@ -97,4 +99,6 @@ class FsVirtual {
}
}

export default FsVirtual;
if (typeof module !== "undefined") {
module.exports = FsVirtual;
}
8 changes: 8 additions & 0 deletions webworker/module-stub.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-check

"use strict";

module.exports = {
// @ts-ignore
"createRequire": () => require
};
1 change: 1 addition & 0 deletions webworker/process-stub.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"use strict";

module.exports = {
"argv": [],
"cwd": () => "/",
"env": {},
"versions": {
Expand Down
2 changes: 1 addition & 1 deletion webworker/webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = {
"fallback": {
"buffer": false,
"fs": false,
"module": false,
"module": require.resolve("./module-stub.cjs"),
"os": require.resolve("./os-stub.cjs"),
"path": require.resolve("path-browserify"),
"process": require.resolve("./process-stub.cjs"),
Expand Down

0 comments on commit 4bf559a

Please sign in to comment.