Skip to content

Commit

Permalink
fully obey nodejs esm import rules with exts
Browse files Browse the repository at this point in the history
  • Loading branch information
anilanar committed Nov 22, 2024
1 parent 4d54321 commit 3fbfe9e
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 30 deletions.
2 changes: 1 addition & 1 deletion packages/chakra-ui/src/Block.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { chakra, forwardRef } from '@chakra-ui/system';
import { __DEV__ } from '@moblin/core';

import { ContainerProps } from './props';
import { ContainerProps } from './props.js';

export interface BlockProps extends ContainerProps<'div'> {}

Expand Down
4 changes: 2 additions & 2 deletions packages/chakra-ui/src/Box.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { forwardRef } from "@chakra-ui/system";
import { __DEV__, ContentPosition } from "@moblin/core";

import { Flex, FlexItem } from "./Flex";
import { ContainerProps } from "./props";
import { Flex, FlexItem } from "./Flex.js";
import { ContainerProps } from "./props.js";

export interface BoxOptions {
valign?: ContentPosition;
Expand Down
4 changes: 2 additions & 2 deletions packages/chakra-ui/src/Flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
unsafeCoerce,
} from "@moblin/core";

import { ContainerProps, SafeFlexItemProps } from "./props";
import { WithChildren } from "./react";
import { ContainerProps, SafeFlexItemProps } from "./props.js";
import { WithChildren } from "./react.js";

export interface FlexItemProps extends WithChildren, SafeFlexItemProps {
alignSelf?: AlignSelf;
Expand Down
2 changes: 1 addition & 1 deletion packages/chakra-ui/src/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { forwardRef, SystemProps } from "@chakra-ui/system";
import { __DEV__ } from "@moblin/core";
import { Children, isValidElement } from "react";

import { Flex, FlexItem, FlexProps } from "./Flex";
import { Flex, FlexItem, FlexProps } from "./Flex.js";

export interface ListProps extends FlexProps {
grow?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/chakra-ui/src/Scrollable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
unsafeCoerce,
} from "@moblin/core";

import { ContainerProps } from "./props";
import { ContainerProps } from "./props.js";

export interface ScrollableOptions {
direction?: FlexDirection;
Expand Down
2 changes: 1 addition & 1 deletion packages/chakra-ui/src/hierarchy.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContext, useContext } from 'react';

import { WithChildren } from './react';
import { WithChildren } from './react.js';

export const HierarchyValidator = createContext<symbol | undefined>(undefined);

Expand Down
13 changes: 6 additions & 7 deletions packages/chakra-ui/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from "./Block";
export * from "./Box";
export * from "./Flex";
export * from "./List";
export * from "./react";
export * from "./Scrollable";
export * from "./Text";
export * from "./Block.js";
export * from "./Box.js";
export * from "./Flex.js";
export * from "./List.js";
export * from "./Scrollable.js";
export * from "./Text.js";
2 changes: 1 addition & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FlexDirection } from "./types";
import { FlexDirection } from "./types.js";

export function unsafeCoerce<T>(x: unknown): T {
return x as T;
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"compilerOptions": {
"incremental": true,
"target": "ES5",
"module": "ESNext",
"module": "NodeNext",
"moduleResolution": "nodenext",
"lib": ["dom", "esnext"],
"importHelpers": true,
"sourceMap": true,
Expand All @@ -13,7 +14,6 @@
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"moduleResolution": "bundler",
"jsx": "react-jsx",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/bin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $.verbose = true;
const commonFlags = "--rootDir src";

const build = {
esm: `tsc ${commonFlags} --module esnext --outDir dist/esm --declaration true --declarationMap true --declarationDir dist/types`,
esm: `tsc ${commonFlags} --outDir dist/esm --declaration true --declarationMap true --declarationDir dist/types`,
};

const command = argv._.length === 1 ? argv._[0] : null;
Expand Down
3 changes: 3 additions & 0 deletions packages/storybook-chakra-ui/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ module.exports = {
core: {
builder: "webpack5",
},
typescript: {
reactDocgen: false
}
};
2 changes: 1 addition & 1 deletion packages/storybook-chakra-ui/src/animatable-demo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { chakra, HTMLChakraProps, keyframes } from '@chakra-ui/system';
import isChromatic from 'chromatic/isChromatic';

import * as S from './storybook';
import * as S from './storybook.js';

interface DemoOptions {
title?: string;
Expand Down
6 changes: 5 additions & 1 deletion packages/storybook-chakra-ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"include": ["./src/**/*"],
"extends": "../dev/base.json"
"extends": "../dev/base.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler"
}
}
3 changes: 3 additions & 0 deletions packages/storybook-web/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ module.exports = {
core: {
builder: "webpack5",
},
typescript: {
reactDocgen: false
}
};
6 changes: 5 additions & 1 deletion packages/storybook-web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"include": ["./src/**/*"],
"extends": "../dev/base.json"
"extends": "../dev/base.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler"
}
}
4 changes: 2 additions & 2 deletions packages/web/src/Box.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "./Flex";
import "./FlexItem";
import "./Flex.js";
import "./FlexItem.js";

import type { ContentPosition } from "@moblin/core";
import { html, LitElement } from "lit";
Expand Down
6 changes: 3 additions & 3 deletions packages/web/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import "./Box";
import "./Flex";
import "./FlexItem";
import "./Box.js";
import "./Flex.js";
import "./FlexItem.js";
6 changes: 3 additions & 3 deletions packages/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"compilerOptions": {
"lib": ["ES2015", "DOM"],
"target": "ES5",
"module": "NodeNext",
"moduleResolution": "nodenext",
"composite": true,
"incremental": true,
"declaration": true,
"declarationDir": "dist/types",
"experimentalDecorators": true,
"useDefineForClassFields": false,
"esModuleInterop": true,
"module": "ESNext",
"moduleResolution": "bundler"
"esModuleInterop": true
},
"include": ["src/**/*"],
"exclude": ["node_modules/*"]
Expand Down

0 comments on commit 3fbfe9e

Please sign in to comment.