Skip to content

Do not use experimental JSON import feature #7379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 5, 2025
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
4 changes: 3 additions & 1 deletion .github/workflows/prepare_package_upload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as fs from "node:fs";
import * as os from "node:os";

import packageSpec from "rescript/package.json" with { type: "json" };
const packageSpec = JSON.parse(
fs.readFileSync(new URL("../../package.json", import.meta.url), "utf-8")
);

const { version } = packageSpec;

Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@

# 12.0.0-alpha.12 (Unreleased)

#### :bug: Bug fix

- Fix node.js ExperimentalWarning. https://github.com/rescript-lang/rescript/pull/7379

#### :house: Internal
- Better representation of JSX in AST . https://github.com/rescript-lang/rescript/pull/7286

- Better representation of JSX in AST. https://github.com/rescript-lang/rescript/pull/7286

# 12.0.0-alpha.11

Expand Down
8 changes: 6 additions & 2 deletions cli/rescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// and its content are file/directories with regard to project root

import * as tty from "node:tty";
import packageJson from "rescript/package.json" with { type: "json" };
import * as fs from "node:fs";

import { bsc_exe, rescript_exe } from "./common/bins.js";
import * as bsb from "./common/bsb.js";
Expand Down Expand Up @@ -93,7 +93,11 @@ if (
) {
console.log(helpMessage);
} else if (argPatterns.version.includes(args[0])) {
console.log(packageJson.version);
const packageSpec = JSON.parse(
fs.readFileSync(new URL("../package.json", import.meta.url), "utf-8")
);

console.log(packageSpec.version);
} else if (firstPositionalArgIndex !== -1) {
const subcmd = args[firstPositionalArgIndex];
const subcmdArgs = args.slice(firstPositionalArgIndex + 1);
Expand Down
7 changes: 5 additions & 2 deletions scripts/prebuilt.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import assert from "node:assert";
import fs from "node:fs";
import packageJson from "rescript/package.json" with { type: "json" };
import semver from "semver";
import { compilerVersionFile } from "#dev/paths";

Expand All @@ -29,7 +28,11 @@ assert.ok(bsVersionMatch, "Failed to parse the compiler version file");
const bsVersion = semver.parse(bsVersionMatch.version);
assert.ok(bsVersion, "Failed to parse the compiler version file");

const packageVersion = semver.parse(packageJson.version);
const packageSpec = JSON.parse(
fs.readFileSync(new URL("../package.json", import.meta.url), "utf-8"),
);

const packageVersion = semver.parse(packageSpec.version);
assert.ok(packageVersion, "Failed to parse the version of the package.json");

assert.ok(
Expand Down
4 changes: 3 additions & 1 deletion scripts/setVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
// @ts-check

import fs from "node:fs";
import packageSpec from "rescript/package.json" with { type: "json" };

const packageSpec = JSON.parse(
fs.readFileSync(new URL("../package.json", import.meta.url), "utf-8"),
);
const { name, version } = packageSpec;

const stdlibPackageSpec = JSON.parse(
Expand Down