Skip to content

Commit

Permalink
Allow ts_project to see package.json (for esmodule resolution).
Browse files Browse the repository at this point in the history
  • Loading branch information
Zemnmez committed Jan 23, 2024
1 parent 5538c1d commit 246dcfc
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
3 changes: 0 additions & 3 deletions ci/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ js_binary(
"//project/ck3/recursive-vassals:patch",
"//ts/cmd/svgshot:npm_pkg.publish",
"//ts/cmd/svgshot:npm_pkg.tgz",
"//ts/cmd/svgshot:package.json",
"//ts/do-sync:npm_pkg.publish",
"//ts/do-sync:npm_pkg.tgz",
"//ts/do-sync:package.json",
"//ts/knowitwhenyouseeit:npm_pkg.publish",
"//ts/knowitwhenyouseeit:npm_pkg.tgz",
"//ts/knowitwhenyouseeit:package.json",
],

entry_point = "postsubmit.js",
Expand Down
4 changes: 2 additions & 2 deletions js/npm/package_json/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def package_json(name, targets, template, version, depSpec):
],
args = [
"--out",
"../../../$(execpath package.json)",
"../../../$(execpath package_new.json)",
"--base",
"../../../$(location //:package_json)",
"--query",
Expand All @@ -38,5 +38,5 @@ def package_json(name, targets, template, version, depSpec):
"--depOnlyOut",
"../../../$(execpath " + depSpec + ")",
],
outs = ["package.json", depSpec],
outs = ["package_new.json", depSpec],
)
7 changes: 5 additions & 2 deletions ts/math/conv_test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import * as cartesian from '#root/ts/math/cartesian.js';
import {
Cartestian as C,
Euler as E,
Quaternion as Q,
} from '#root/ts/math/conv.js';
import * as euler_angle from '#root/ts/math/euler_angle.js';
import * as quaternion from '#root/ts/math/quaternion.js';

import { Cartestian as C, Euler as E, Quaternion as Q } from './conv';

describe('Conversions', () => {
test('Quaternion from EulerAngles', () => {
const eulerAngles = new euler_angle.EulerAngle(
Expand Down
2 changes: 1 addition & 1 deletion ts/next.js/component/Redirect/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* app router.
*/

import Head from 'next/head';
import Head from 'next/head.js';
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion ts/next.js/component/Redirect/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Head from 'next/head';
import { useRouter } from 'next/router';
import { useRouter } from 'next/router.js';
import { useEffect } from 'react';

export interface Props {
Expand Down
2 changes: 1 addition & 1 deletion ts/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def ts_project(name, visibility = None, deps = [], ignores_lint = [], resolve_js

_ts_project(
name = name,
srcs = srcs,
srcs = srcs + [ "//:package_json" ],
tsconfig = tsconfig,
# swc injects this
deps = deps + ["//:node_modules/regenerator-runtime"],
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"module": "node16",
"module": "esnext",
"moduleResolution": "bundler",
"target": "es2020",
"strictFunctionTypes": true,
"esModuleInterop": true,
"moduleResolution": "node16",
"strict": true,
"jsx": "react-jsx",
"resolveJsonModule": true,
Expand Down

0 comments on commit 246dcfc

Please sign in to comment.