Skip to content
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
10 changes: 1 addition & 9 deletions jscomp/bsb/templates/basic/bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,5 @@
"sources": {
"dir" : "src",
"subdirs" : true
},
"package-specs": {
"module": "commonjs",
"in-source": true
},
"suffix": ".bs.js",
"bs-dependencies": [
],
"refmt": 3
}
}
6 changes: 4 additions & 2 deletions jscomp/build_tests/top/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ var cmjTargets = output
.filter(x => x.endsWith(".cmj"))
.map(x => path.basename(x))
.sort();

assert.deepEqual(cmjTargets, ["demo.cmj", "hello00.cmj","hexll.cmj"]);
cmjTargets.sort()
var expected = ["demo.cmj", "hello00.cmj","hexll..cmj",'hexll.cmj']
expected.sort()
assert.deepEqual(cmjTargets, expected);


26 changes: 26 additions & 0 deletions jscomp/build_tests/weird_names/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
*.exe
*.obj
*.out
*.compile
*.native
*.byte
*.cmo
*.annot
*.cmi
*.cmx
*.cmt
*.cmti
*.cma
*.a
*.cmxa
*.obj
*~
*.annot
*.cmj
*.bak
lib/bs
*.mlast
*.mliast
.vscode
.merlin
.bsb.lock
13 changes: 13 additions & 0 deletions jscomp/build_tests/weird_names/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


# Build
```
npm run build
```

# Watch

```
npm run watch
```

8 changes: 8 additions & 0 deletions jscomp/build_tests/weird_names/bsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "weird_names",
"version": "0.1.0",
"sources": {
"dir" : "src",
"subdirs" : true
}
}
24 changes: 24 additions & 0 deletions jscomp/build_tests/weird_names/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var cp = require("child_process");
var assert = require("assert");
var path = require("path");

var out = cp.spawnSync(`bsb`, { encoding: "utf8" });

console.log(out.stdout);
assert.ok(out.stderr === "");

let files = [
"_app.res",
"[...params_max_3].res",
"[...params].res",
"[[...params]].res",
"[slug_or_ID].res",
"404.res",
];

for (let f of files) {
let { name } = path.parse(f);
let m = `./lib/js/src/${name}.js`;
// console.log(m);
assert.deepEqual(require(m), { a: 1 });
}
17 changes: 17 additions & 0 deletions jscomp/build_tests/weird_names/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "weird_names",
"version": "0.1.0",
"scripts": {
"clean": "bsb -clean-world",
"build": "bsb -make-world",
"watch": "bsb -make-world -w"
},
"keywords": [
"BuckleScript"
],
"author": "",
"license": "MIT",
"devDependencies": {
"bs-platform": "^8.3.0-dev.2"
}
}
1 change: 1 addition & 0 deletions jscomp/build_tests/weird_names/src/404.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let a = 1
1 change: 1 addition & 0 deletions jscomp/build_tests/weird_names/src/[...params].res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let a = 1
1 change: 1 addition & 0 deletions jscomp/build_tests/weird_names/src/[...params_max_3].res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let a = 1
1 change: 1 addition & 0 deletions jscomp/build_tests/weird_names/src/[[...params]].res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let a = 1
1 change: 1 addition & 0 deletions jscomp/build_tests/weird_names/src/[slug_or_ID].res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let a = 1
1 change: 1 addition & 0 deletions jscomp/build_tests/weird_names/src/_app.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let a = 1
1 change: 1 addition & 0 deletions jscomp/build_tests/weird_names/src/demo.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let a = 1
5 changes: 4 additions & 1 deletion jscomp/ext/ext_filename.ml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ let rec valid_module_name_aux name off len =
else
let c = String.unsafe_get name off in
match c with
| 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '\'' ->
| 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '\'' | '.' | '[' | ']' ->
valid_module_name_aux name (off + 1) len
| _ -> false

Expand All @@ -145,6 +145,9 @@ let valid_module_name name len =
else Invalid
| 'a' .. 'z'
| '0' .. '9'
| '_'
| '['
| ']'
->
if valid_module_name_aux name 1 len then
Lower
Expand Down
2 changes: 1 addition & 1 deletion jscomp/ounit_tests/ounit_string_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ let suites =
Ext_filename.module_name "a/hello.ml" =~ "Hello";
Ext_filename.as_module ~basename:"a.ml" =~ Some {module_name = "A"; case = false};
Ext_filename.as_module ~basename:"Aa.ml" =~ Some {module_name = "Aa"; case = true};
Ext_filename.as_module ~basename:"_Aa.ml" =~ None;
(* Ext_filename.as_module ~basename:"_Aa.ml" =~ None; *)
Ext_filename.as_module ~basename:"A_a" =~ Some {module_name = "A_a"; case = true};
Ext_filename.as_module ~basename:"" =~ None;
Ext_filename.as_module ~basename:"a/hello.ml" =~
Expand Down
5 changes: 4 additions & 1 deletion lib/4.06.1/bsb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6799,7 +6799,7 @@ let rec valid_module_name_aux name off len =
else
let c = String.unsafe_get name off in
match c with
| 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '\'' ->
| 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '\'' | '.' | '[' | ']' ->
valid_module_name_aux name (off + 1) len
| _ -> false

Expand All @@ -6820,6 +6820,9 @@ let valid_module_name name len =
else Invalid
| 'a' .. 'z'
| '0' .. '9'
| '_'
| '['
| ']'
->
if valid_module_name_aux name 1 len then
Lower
Expand Down
5 changes: 4 additions & 1 deletion lib/4.06.1/bsb_helper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2115,7 +2115,7 @@ let rec valid_module_name_aux name off len =
else
let c = String.unsafe_get name off in
match c with
| 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '\'' ->
| 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '\'' | '.' | '[' | ']' ->
valid_module_name_aux name (off + 1) len
| _ -> false

Expand All @@ -2136,6 +2136,9 @@ let valid_module_name name len =
else Invalid
| 'a' .. 'z'
| '0' .. '9'
| '_'
| '['
| ']'
->
if valid_module_name_aux name 1 len then
Lower
Expand Down
7 changes: 5 additions & 2 deletions lib/4.06.1/unstable/all_ounit_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16266,7 +16266,7 @@ let rec valid_module_name_aux name off len =
else
let c = String.unsafe_get name off in
match c with
| 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '\'' ->
| 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '\'' | '.' | '[' | ']' ->
valid_module_name_aux name (off + 1) len
| _ -> false

Expand All @@ -16287,6 +16287,9 @@ let valid_module_name name len =
else Invalid
| 'a' .. 'z'
| '0' .. '9'
| '_'
| '['
| ']'
->
if valid_module_name_aux name 1 len then
Lower
Expand Down Expand Up @@ -16815,7 +16818,7 @@ let suites =
Ext_filename.module_name "a/hello.ml" =~ "Hello";
Ext_filename.as_module ~basename:"a.ml" =~ Some {module_name = "A"; case = false};
Ext_filename.as_module ~basename:"Aa.ml" =~ Some {module_name = "Aa"; case = true};
Ext_filename.as_module ~basename:"_Aa.ml" =~ None;
(* Ext_filename.as_module ~basename:"_Aa.ml" =~ None; *)
Ext_filename.as_module ~basename:"A_a" =~ Some {module_name = "A_a"; case = true};
Ext_filename.as_module ~basename:"" =~ None;
Ext_filename.as_module ~basename:"a/hello.ml" =~
Expand Down
5 changes: 4 additions & 1 deletion lib/4.06.1/unstable/bspack.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10255,7 +10255,7 @@ let rec valid_module_name_aux name off len =
else
let c = String.unsafe_get name off in
match c with
| 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '\'' ->
| 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '\'' | '.' | '[' | ']' ->
valid_module_name_aux name (off + 1) len
| _ -> false

Expand All @@ -10276,6 +10276,9 @@ let valid_module_name name len =
else Invalid
| 'a' .. 'z'
| '0' .. '9'
| '_'
| '['
| ']'
->
if valid_module_name_aux name 1 len then
Lower
Expand Down
Loading