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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 7 additions & 2 deletions compiler/core/js_name_of_module_id.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let string_of_module_id_in_browser (x : Lam_module_ident.t) =
match x.kind with
| External {name} -> name
| Runtime | Ml ->
"./stdlib/" ^ x.id.name ^ ".js"
"./stdlib/" ^ x.id.name ^ ".mjs"

let string_of_module_id
(id : Lam_module_ident.t)
Expand All @@ -48,6 +48,11 @@ let fix_path_for_windows : string -> string =
if Ext_sys.is_windows_or_cygwin then Ext_string.replace_backward_slash
else fun s -> s

let runtime_suffix_of_module_system (module_system : Js_packages_info.module_system)
=
match module_system with
| Commonjs -> ".cjs"
| Esmodule -> ".mjs"

(* dependency is runtime module *)
let get_runtime_module_path
Expand All @@ -59,7 +64,7 @@ let get_runtime_module_path
module_system in
let js_file =
Ext_namespace.js_name_of_modulename dep_module_id.id.name
Upper Literals.suffix_js in
Upper (runtime_suffix_of_module_system module_system) in
match current_info_query with
| Package_not_found -> assert false
| Package_script ->
Expand Down
22 changes: 1 addition & 21 deletions compiler/core/js_packages_info.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,7 @@ let runtime_package_path (ms : module_system) js_file =

type t = {name: package_name; module_systems: package_info list}

let runtime_package_specs : t =
{
name = Pkg_runtime;
module_systems =
[
{module_system = Esmodule; path = "lib/es6"; suffix = Literals.suffix_js};
{module_system = Commonjs; path = "lib/js"; suffix = Literals.suffix_js};
];
}
let runtime_package_specs : t = {name = Pkg_runtime; module_systems = []}

let same_package_by_name (x : t) (y : t) =
match x.name with
Expand Down Expand Up @@ -201,15 +193,3 @@ let add_npm_package_path (packages_info : t) (s : string) : t =
| _ -> Bsc_args.bad_arg ("invalid npm package path: " ^ s)
in
{packages_info with module_systems = m :: packages_info.module_systems}

(* support es6 modules instead
TODO: enrich ast to support import export
http://www.ecma-international.org/ecma-262/6.0/#sec-imports
For every module, we need [Ident.t] for accessing and [filename] for import,
they are not necessarily the same.

Es6 modules is not the same with commonjs, we use commonjs currently
(play better with node)

FIXME: the module order matters?
*)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


import * as Primitive_int from "./Primitive_int.js";
import * as Primitive_option from "./Primitive_option.js";
import * as Primitive_int from "./Primitive_int.mjs";
import * as Primitive_option from "./Primitive_option.mjs";

function get(arr, i) {
if (i >= 0 && i < arr.length) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Primitive_option from "./Primitive_option.js";
import * as Belt_internalBuckets from "./Belt_internalBuckets.js";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.js";
import * as Primitive_option from "./Primitive_option.mjs";
import * as Belt_internalBuckets from "./Belt_internalBuckets.mjs";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.mjs";

function size(h) {
return h.size;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@


import * as Primitive_hash from "./Primitive_hash.js";
import * as Primitive_option from "./Primitive_option.js";
import * as Belt_internalBuckets from "./Belt_internalBuckets.js";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.js";
import * as Primitive_hash from "./Primitive_hash.mjs";
import * as Primitive_option from "./Primitive_option.mjs";
import * as Belt_internalBuckets from "./Belt_internalBuckets.mjs";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.mjs";

function copyBucketReHash(h_buckets, ndata_tail, _old_bucket) {
while (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@


import * as Primitive_hash from "./Primitive_hash.js";
import * as Primitive_option from "./Primitive_option.js";
import * as Belt_internalBuckets from "./Belt_internalBuckets.js";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.js";
import * as Primitive_hash from "./Primitive_hash.mjs";
import * as Primitive_option from "./Primitive_option.mjs";
import * as Belt_internalBuckets from "./Belt_internalBuckets.mjs";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.mjs";

function copyBucketReHash(h_buckets, ndata_tail, _old_bucket) {
while (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


import * as Belt_internalSetBuckets from "./Belt_internalSetBuckets.js";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.js";
import * as Belt_internalSetBuckets from "./Belt_internalSetBuckets.mjs";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.mjs";

function copyBucket(hash, h_buckets, ndata_tail, _old_bucket) {
while (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Primitive_hash from "./Primitive_hash.js";
import * as Belt_internalSetBuckets from "./Belt_internalSetBuckets.js";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.js";
import * as Primitive_hash from "./Primitive_hash.mjs";
import * as Belt_internalSetBuckets from "./Belt_internalSetBuckets.mjs";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.mjs";

function copyBucket(h_buckets, ndata_tail, _old_bucket) {
while (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Primitive_hash from "./Primitive_hash.js";
import * as Belt_internalSetBuckets from "./Belt_internalSetBuckets.js";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.js";
import * as Primitive_hash from "./Primitive_hash.mjs";
import * as Belt_internalSetBuckets from "./Belt_internalSetBuckets.mjs";
import * as Belt_internalBucketsType from "./Belt_internalBucketsType.mjs";

function copyBucket(h_buckets, ndata_tail, _old_bucket) {
while (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Belt_Array from "./Belt_Array.js";
import * as Belt_SortArray from "./Belt_SortArray.js";
import * as Primitive_option from "./Primitive_option.js";
import * as Belt_Array from "./Belt_Array.mjs";
import * as Belt_SortArray from "./Belt_SortArray.mjs";
import * as Primitive_option from "./Primitive_option.mjs";

function head(x) {
if (x !== 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


import * as Belt_MapDict from "./Belt_MapDict.js";
import * as Belt_MapDict from "./Belt_MapDict.mjs";

function fromArray(data, id) {
let cmp = id.cmp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


import * as Primitive_option from "./Primitive_option.js";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.js";
import * as Primitive_option from "./Primitive_option.mjs";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.mjs";

function set(t, newK, newD, cmp) {
if (t === undefined) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Primitive_option from "./Primitive_option.js";
import * as Belt_internalMapInt from "./Belt_internalMapInt.js";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.js";
import * as Primitive_option from "./Primitive_option.mjs";
import * as Belt_internalMapInt from "./Belt_internalMapInt.mjs";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.mjs";

function set(t, newK, newD) {
if (t === undefined) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Primitive_option from "./Primitive_option.js";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.js";
import * as Belt_internalMapString from "./Belt_internalMapString.js";
import * as Primitive_option from "./Primitive_option.mjs";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.mjs";
import * as Belt_internalMapString from "./Belt_internalMapString.mjs";

function set(t, newK, newD) {
if (t === undefined) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


import * as Primitive_option from "./Primitive_option.js";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.js";
import * as Primitive_option from "./Primitive_option.mjs";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.mjs";

function removeMutateAux(nt, x, cmp) {
let k = nt.k;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Primitive_option from "./Primitive_option.js";
import * as Belt_internalMapInt from "./Belt_internalMapInt.js";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.js";
import * as Primitive_option from "./Primitive_option.mjs";
import * as Belt_internalMapInt from "./Belt_internalMapInt.mjs";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.mjs";

function make() {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Primitive_option from "./Primitive_option.js";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.js";
import * as Belt_internalMapString from "./Belt_internalMapString.js";
import * as Primitive_option from "./Primitive_option.mjs";
import * as Belt_internalAVLtree from "./Belt_internalAVLtree.mjs";
import * as Belt_internalMapString from "./Belt_internalMapString.mjs";

function make() {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


import * as Primitive_option from "./Primitive_option.js";
import * as Primitive_option from "./Primitive_option.mjs";

function make() {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Primitive_int from "./Primitive_int.js";
import * as Belt_SortArray from "./Belt_SortArray.js";
import * as Belt_internalAVLset from "./Belt_internalAVLset.js";
import * as Primitive_int from "./Primitive_int.mjs";
import * as Belt_SortArray from "./Belt_SortArray.mjs";
import * as Belt_internalAVLset from "./Belt_internalAVLset.mjs";

function remove0(nt, x, cmp) {
let k = nt.v;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@


import * as Primitive_int from "./Primitive_int.js";
import * as Belt_SortArrayInt from "./Belt_SortArrayInt.js";
import * as Belt_internalAVLset from "./Belt_internalAVLset.js";
import * as Belt_internalSetInt from "./Belt_internalSetInt.js";
import * as Primitive_int from "./Primitive_int.mjs";
import * as Belt_SortArrayInt from "./Belt_SortArrayInt.mjs";
import * as Belt_internalAVLset from "./Belt_internalAVLset.mjs";
import * as Belt_internalSetInt from "./Belt_internalSetInt.mjs";

function remove0(nt, x) {
let k = nt.v;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@


import * as Primitive_int from "./Primitive_int.js";
import * as Belt_internalAVLset from "./Belt_internalAVLset.js";
import * as Belt_SortArrayString from "./Belt_SortArrayString.js";
import * as Belt_internalSetString from "./Belt_internalSetString.js";
import * as Primitive_int from "./Primitive_int.mjs";
import * as Belt_internalAVLset from "./Belt_internalAVLset.mjs";
import * as Belt_SortArrayString from "./Belt_SortArrayString.mjs";
import * as Belt_internalSetString from "./Belt_internalSetString.mjs";

function remove0(nt, x) {
let k = nt.v;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


import * as Primitive_option from "./Primitive_option.js";
import * as Primitive_option from "./Primitive_option.mjs";

function make() {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


import * as Primitive_option from "./Primitive_option.js";
import * as Primitive_option from "./Primitive_option.mjs";

function keep(opt, p) {
if (opt !== undefined && p(Primitive_option.valFromOption(opt))) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


import * as Belt_SetDict from "./Belt_SetDict.js";
import * as Belt_SetDict from "./Belt_SetDict.mjs";

function fromArray(data, id) {
let cmp = id.cmp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


import * as Belt_internalAVLset from "./Belt_internalAVLset.js";
import * as Belt_internalAVLset from "./Belt_internalAVLset.mjs";

function add(t, x, cmp) {
if (t === undefined) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


import * as Belt_internalAVLset from "./Belt_internalAVLset.js";
import * as Belt_internalSetInt from "./Belt_internalSetInt.js";
import * as Belt_internalAVLset from "./Belt_internalAVLset.mjs";
import * as Belt_internalSetInt from "./Belt_internalSetInt.mjs";

function add(t, x) {
if (t === undefined) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


import * as Belt_internalAVLset from "./Belt_internalAVLset.js";
import * as Belt_internalSetString from "./Belt_internalSetString.js";
import * as Belt_internalAVLset from "./Belt_internalAVLset.mjs";
import * as Belt_internalSetString from "./Belt_internalSetString.mjs";

function add(t, x) {
if (t === undefined) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


import * as Belt_Array from "./Belt_Array.js";
import * as Belt_Array from "./Belt_Array.mjs";

function sortedLengthAuxMore(xs, _prec, _acc, len, lt) {
while (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


import * as Belt_Array from "./Belt_Array.js";
import * as Belt_Array from "./Belt_Array.mjs";

function sortedLengthAuxMore(xs, _prec, _acc, len) {
while (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


import * as Belt_Array from "./Belt_Array.js";
import * as Belt_Array from "./Belt_Array.mjs";

function sortedLengthAuxMore(xs, _prec, _acc, len) {
while (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Primitive_int from "./Primitive_int.js";
import * as Belt_SortArray from "./Belt_SortArray.js";
import * as Primitive_option from "./Primitive_option.js";
import * as Primitive_int from "./Primitive_int.mjs";
import * as Belt_SortArray from "./Belt_SortArray.mjs";
import * as Primitive_option from "./Primitive_option.mjs";

function copy(n) {
if (n !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Primitive_int from "./Primitive_int.js";
import * as Belt_SortArray from "./Belt_SortArray.js";
import * as Primitive_option from "./Primitive_option.js";
import * as Primitive_int from "./Primitive_int.mjs";
import * as Belt_SortArray from "./Belt_SortArray.mjs";
import * as Primitive_option from "./Primitive_option.mjs";

function treeHeight(n) {
if (n !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@


import * as Belt_Array from "./Belt_Array.js";
import * as Primitive_int from "./Primitive_int.js";
import * as Primitive_option from "./Primitive_option.js";
import * as Belt_Array from "./Belt_Array.mjs";
import * as Primitive_int from "./Primitive_int.mjs";
import * as Primitive_option from "./Primitive_option.mjs";

function copyAuxCont(_c, _prec) {
while (true) {
Expand Down
Loading
Loading