Skip to content

Commit 614c3fd

Browse files
committed
Fix build error
If it happens again, I'm going to fork bash-parser.
1 parent 2e43751 commit 614c3fd

File tree

4 files changed

+81
-3
lines changed

4 files changed

+81
-3
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
diff --git a/src/modes/posix/built-grammar.js b/src/modes/posix/built-grammar.js
2+
index bb784a0b1a7f8accf8ca0ab9353d5c449d85d94a..46c8b7fa03f2e0e200fa5164b063de4747ea8cba 100644
3+
--- a/src/modes/posix/built-grammar.js
4+
+++ b/src/modes/posix/built-grammar.js
5+
@@ -432,19 +432,6 @@ return new Parser;
6+
})();
7+
8+
9+
-if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
10+
exports.parser = parser;
11+
exports.Parser = parser.Parser;
12+
exports.parse = function () { return parser.parse.apply(parser, arguments); };
13+
-exports.main = function commonjsMain(args) {
14+
- if (!args[1]) {
15+
- console.log('Usage: '+args[0]+' FILE');
16+
- process.exit(1);
17+
- }
18+
- var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
19+
- return exports.parser.parse(source);
20+
-};
21+
-if (typeof module !== 'undefined' && require.main === module) {
22+
- exports.main(process.argv.slice(1));
23+
-}
24+
-}
25+
\ No newline at end of file
26+
diff --git a/src/modes/posix/index.js b/src/modes/posix/index.js
27+
index 7eba777d149f11359782067c8060b653bb32bad6..14f733a82f66baef9511577a0ff901e14e30a143 100644
28+
--- a/src/modes/posix/index.js
29+
+++ b/src/modes/posix/index.js
30+
@@ -5,6 +5,7 @@ const tokenizer = require('./tokenizer');
31+
const phaseCatalog = require('./rules');
32+
const grammarSource = require('./grammar');
33+
const enums = require('./enums');
34+
+const grammar = require('./built-grammar');
35+
36+
const lexerPhases = () => [
37+
phaseCatalog.newLineList,
38+
@@ -39,10 +40,6 @@ const lexerPhases = () => [
39+
module.exports = {
40+
inherits: null,
41+
init: (posixMode, utils) => {
42+
- let grammar = null;
43+
- try {
44+
- grammar = require('./built-grammar');
45+
- } catch (err) {}
46+
return {
47+
enums,
48+
phaseCatalog,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@mdx-js/react": "^3.0.0",
5050
"@mdx-js/rollup": "^3.0.0",
5151
"@vitejs/plugin-react": "^4.1.0",
52-
"bash-parser": "^0.5.0",
52+
"bash-parser": "patch:bash-parser@npm%3A0.5.0#~/.yarn/patches/bash-parser-npm-0.5.0-911330943d.patch",
5353
"clsx": "^2.0.0",
5454
"color": "^4.2.3",
5555
"copy-text-to-clipboard": "^3.2.0",

project-words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ noninteractive
1313
noreply
1414
peaceiris
1515
pipeable
16+
posix
1617
saturationl
1718
scrolly
1819
sida

yarn.lock

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,7 +2210,7 @@ __metadata:
22102210
languageName: node
22112211
linkType: hard
22122212

2213-
"bash-parser@npm:^0.5.0":
2213+
"bash-parser@npm:0.5.0":
22142214
version: 0.5.0
22152215
resolution: "bash-parser@npm:0.5.0"
22162216
dependencies:
@@ -2239,6 +2239,35 @@ __metadata:
22392239
languageName: node
22402240
linkType: hard
22412241

2242+
"bash-parser@patch:bash-parser@npm%3A0.5.0#~/.yarn/patches/bash-parser-npm-0.5.0-911330943d.patch":
2243+
version: 0.5.0
2244+
resolution: "bash-parser@patch:bash-parser@npm%3A0.5.0#~/.yarn/patches/bash-parser-npm-0.5.0-911330943d.patch::version=0.5.0&hash=b1cb46"
2245+
dependencies:
2246+
array-last: "npm:^1.1.1"
2247+
babylon: "npm:^6.9.1"
2248+
compose-function: "npm:^3.0.3"
2249+
curry: "npm:^1.2.0"
2250+
deep-freeze: "npm:0.0.1"
2251+
filter-iterator: "npm:0.0.1"
2252+
filter-obj: "npm:^1.1.0"
2253+
has-own-property: "npm:^0.1.0"
2254+
identity-function: "npm:^1.0.0"
2255+
iterable-lookahead: "npm:^1.0.0"
2256+
iterable-transform-replace: "npm:^1.1.1"
2257+
magic-string: "npm:^0.16.0"
2258+
map-iterable: "npm:^1.0.1"
2259+
map-obj: "npm:^2.0.0"
2260+
object-pairs: "npm:^0.1.0"
2261+
object-values: "npm:^1.0.0"
2262+
reverse-arguments: "npm:^1.0.0"
2263+
shell-quote-word: "npm:^1.0.1"
2264+
to-pascal-case: "npm:^1.0.0"
2265+
transform-spread-iterable: "npm:^1.1.0"
2266+
unescape-js: "npm:^1.0.5"
2267+
checksum: 841d102c2a8784072fb320a99df54d9c7e90b0ad41932d024feb102cc6324aead53369c95c365b89e6feb0497ac0ef0857ee701c76b7b7f68387509ff67e2998
2268+
languageName: node
2269+
linkType: hard
2270+
22422271
"binary-extensions@npm:^2.0.0":
22432272
version: 2.2.0
22442273
resolution: "binary-extensions@npm:2.2.0"
@@ -6843,7 +6872,7 @@ __metadata:
68436872
"@typescript-eslint/eslint-plugin": "npm:^6.9.0"
68446873
"@typescript-eslint/parser": "npm:^6.9.0"
68456874
"@vitejs/plugin-react": "npm:^4.1.0"
6846-
bash-parser: "npm:^0.5.0"
6875+
bash-parser: "patch:bash-parser@npm%3A0.5.0#~/.yarn/patches/bash-parser-npm-0.5.0-911330943d.patch"
68476876
clsx: "npm:^2.0.0"
68486877
color: "npm:^4.2.3"
68496878
copy-text-to-clipboard: "npm:^3.2.0"

0 commit comments

Comments
 (0)