Skip to content

Commit 8fa069e

Browse files
authored
Update import paths (#524)
1 parent 6d1fa50 commit 8fa069e

File tree

8 files changed

+16
-18
lines changed

8 files changed

+16
-18
lines changed

demo/app.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { ReactP5Wrapper } from "@/main.tsx";
12
import React, { useCallback, useMemo, useState } from "react";
23
import { createRoot } from "react-dom/client";
34

4-
import { ReactP5Wrapper } from "../src/main.tsx";
55
import "./demo.css";
66
import { sketch as box } from "./sketches/box";
77
import { sketch as plane } from "./sketches/plane";

src/components/ReactP5Wrapper.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as React from "react";
22
import { propsAreEqual } from "@utils/propsAreEqual";
33

4-
const ReactP5WrapperGuard = React.lazy(() => import("./ReactP5WrapperGuard"));
4+
const ReactP5WrapperGuard = React.lazy(
5+
() => import("@components/ReactP5WrapperGuard")
6+
);
57

68
export const ReactP5Wrapper = React.memo(ReactP5WrapperGuard, propsAreEqual);

src/components/ReactP5WrapperGuard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ReactNode } from "react";
77
import { FallbackProps } from "react-error-boundary";
88

99
const ReactP5WrapperWithSketch = React.lazy(
10-
() => import("./ReactP5WrapperWithSketch")
10+
() => import("@components/ReactP5WrapperWithSketch")
1111
);
1212

1313
const ErrorBoundary = React.lazy(() =>

src/main.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
export { ReactP5Wrapper } from "./components/ReactP5Wrapper";
2-
export { P5WrapperClassName } from "./constants/P5WrapperClassName";
3-
export { type P5CanvasInstance } from "./contracts/P5CanvasInstance";
4-
export { type P5WrapperProps } from "./contracts/P5WrapperProps";
5-
export { type Sketch } from "./contracts/Sketch";
6-
export { type SketchProps } from "./contracts/SketchProps";
1+
export { ReactP5Wrapper } from "@components/ReactP5Wrapper";
2+
export { P5WrapperClassName } from "@constants/P5WrapperClassName";
3+
export { type P5CanvasInstance } from "@contracts/P5CanvasInstance";
4+
export { type P5WrapperProps } from "@contracts/P5WrapperProps";
5+
export { type Sketch } from "@contracts/Sketch";
6+
export { type SketchProps } from "@contracts/SketchProps";

src/utils/updateCanvasInstance.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { type CanvasInstanceRef } from "@contracts/CanvasInstanceRef";
22
import { type Sketch } from "@contracts/Sketch";
33
import { type SketchProps } from "@contracts/SketchProps";
44
import { type WrapperRef } from "@contracts/WrapperRef";
5-
6-
import { createCanvasInstance } from "./createCanvasInstance";
7-
import { removeCanvasInstance } from "./removeCanvasInstance";
5+
import { createCanvasInstance } from "@utils/createCanvasInstance";
6+
import { removeCanvasInstance } from "@utils/removeCanvasInstance";
87

98
export function updateCanvasInstance<Props extends SketchProps>(
109
canvasInstanceRef: CanvasInstanceRef<Props>,

tests/exports.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
import { P5WrapperClassName, ReactP5Wrapper } from "@/main";
12
import { createElement, isValidElement } from "react";
23
import { assert, describe, expect, it, vi } from "vitest";
34

4-
import { P5WrapperClassName, ReactP5Wrapper } from "../src/main";
5-
65
describe("Exports", () => {
76
describe("P5WrapperClassName", () => {
87
it("Exports the css class name used on the wrapper", () => {

tests/utils/removeCanvasInstance.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
import { SketchProps } from "@/main";
12
import { type CanvasInstanceRef } from "@contracts/CanvasInstanceRef";
23
import p5 from "@contracts/p5";
34
import { removeCanvasInstance } from "@utils/removeCanvasInstance";
45
import { createRef } from "react";
56
import { describe, expect, it, vi } from "vitest";
67

7-
import { SketchProps } from "../../src/main";
8-
98
describe("removeCanvasInstance", () => {
109
it("Calls the remove method on the canvas if it exists", () => {
1110
const instance = new p5(() => {

tests/utils/updateCanvasInstance.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { SketchProps } from "@/main";
12
import { type CanvasInstanceRef } from "@contracts/CanvasInstanceRef";
23
import p5 from "@contracts/p5";
34
import { type WrapperRef } from "@contracts/WrapperRef";
@@ -6,8 +7,6 @@ import { updateCanvasInstance } from "@utils/updateCanvasInstance";
67
import { createRef } from "react";
78
import { describe, expect, it, vi } from "vitest";
89

9-
import { SketchProps } from "../../src/main";
10-
1110
describe("updateCanvasInstance", () => {
1211
it("Should update a canvas instance to a new version", () => {
1312
const sketch = vi.fn();

0 commit comments

Comments
 (0)