Skip to content

Commit

Permalink
improve production build (#158)
Browse files Browse the repository at this point in the history
* improve verify

* fix preact

* fix collections

* dont check debug & verify packages

* wip

* fix reactive

* fix lint

* improve build

* fix type & lint

* more lint fixes

* fix lint

* update @starbeam-dev/eslint-plugin
  • Loading branch information
patricklx authored May 8, 2024
1 parent e2a724b commit 7099168
Show file tree
Hide file tree
Showing 94 changed files with 621 additions and 507 deletions.
2 changes: 1 addition & 1 deletion @types/ansicolor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test:types": "tsc -b"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@types/node": "18.16.18"
}
}
4 changes: 2 additions & 2 deletions @types/fsify/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export interface Options {
*/
cwd?: string;
/**
* A persistent fsify tree remains on the file system after the process exits.
* Defaults to true.
* A persistent fsify tree remains on the file system after the process
* exits. Defaults to true.
*/
persistent?: boolean;
/**
Expand Down
2 changes: 1 addition & 1 deletion @types/fsify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"test:types": "tsc -b"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@types/node": "18.16.1"
}
}
2 changes: 1 addition & 1 deletion @types/lines-and-columns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test:types": "tsc -b"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@types/node": "18.16.1"
}
}
2 changes: 1 addition & 1 deletion @types/plugin-commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"@rollup/plugin-commonjs": "25.0.5"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.3"
"@starbeam-dev/eslint-plugin": "^1.0.6"
}
}
2 changes: 1 addition & 1 deletion @types/plugin-node-resolve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"@rollup/plugin-node-resolve": "^15.2.3"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.3"
"@starbeam-dev/eslint-plugin": "^1.0.6"
}
}
2 changes: 1 addition & 1 deletion @types/rollup-plugin-polyfill-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"rollup": "^4.0.2"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4"
"@starbeam-dev/eslint-plugin": "^1.0.6"
}
}
2 changes: 1 addition & 1 deletion @types/shell-escape-tag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test:types": "tsc -b"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@types/node": "18.16.1"
}
}
2 changes: 1 addition & 1 deletion @types/shell-split/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"test:types": "tsc -b"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@types/node": "18.16.1"
}
}
2 changes: 1 addition & 1 deletion @types/vite-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"vitest": "^1.0.0-beta.2"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4"
"@starbeam-dev/eslint-plugin": "^1.0.6"
}
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@
"@nrr/pnpm-duplicate-cli": "^0.0.1",
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/core": "^1.0.2",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@types/eslint": "^8.56.0",
"@types/node": "^20.10.5",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@vitest/ui": "^1.1.0",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
Expand Down Expand Up @@ -162,7 +162,8 @@
"preact": "10.17.1",
"typescript": "$typescript",
"vite": "$vite",
"vue": "3.3.4"
"vue": "3.3.4",
"terser": "^5.31.0"
},
"peerDependencyRules": {
"allowAny": [
Expand Down
2 changes: 1 addition & 1 deletion packages/preact/preact-testing-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"preact-render-to-string": "^6.2.1",
"rollup": "^4.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/preact/preact-testing-utils/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"preact": "*"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"preact-render-to-string": "^6.2.1"
}
}
2 changes: 1 addition & 1 deletion packages/preact/preact-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"rollup": "^4.0.2"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/preact/preact-utils/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"preact": "*"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"preact-render-to-string": "^6.2.1"
}
}
2 changes: 1 addition & 1 deletion packages/preact/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"rollup": "^4.0.2"
},
"peerDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/preact/preact/src/frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ export class ComponentFrame {
): FinalizedFormula {
const frame = ComponentFrame.#frames.get(component);

verify(
verify?.(
frame,
isPresent,
expected.when("in Preact's _diff hook").as("a tracking frame"),
expected?.when("in Preact's _diff hook").as("a tracking frame"),
);

const end = frame.#end(subscription);
Expand Down Expand Up @@ -101,10 +101,10 @@ export class ComponentFrame {
}

#end(subscription: (() => void) | undefined) {
verify(
verify?.(
this.#active,
isPresent,
expected.when("in preact's _diff hook").as("an active tracking frame"),
expected?.when("in preact's _diff hook").as("an active tracking frame"),
);

const frame = (this.#frame = this.#active.done());
Expand Down
2 changes: 1 addition & 1 deletion packages/preact/preact/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"preact": "*"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"preact-render-to-string": "^6.2.1"
}
}
2 changes: 1 addition & 1 deletion packages/react/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@types/node": "18.16.1",
"@types/react": "^18.2.22",
"@types/scheduler": "^0.16.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/react/react/src/hooks/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ interface ScheduledHandler {
* Creates a {@linkcode ScheduledHandler} that will keep track of the
* synchronization functions to run.
*
* This function sets up a `useEffect` to run the handlers. This `useEffect` has
* a dependency on a `useState` that represents the set of handlers. The
* This function sets up a `useEffect` to run the handlers. This `useEffect`
* has a dependency on a `useState` that represents the set of handlers. The
* `useState` invalidates whenever a handler is added or whenever
* {@linkcode scheduleDep} is explicitly run.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/react/react/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"vitest": "^0.34.4"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4"
"@starbeam-dev/eslint-plugin": "^1.0.6"
}
}
8 changes: 4 additions & 4 deletions packages/react/react/tests/test-use.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ type DefineSetupReactiveComponent = (
) => Promise<void>;

/**
* Sets up a test suite for a reactive component using `setupReactive` to create
* subscribe to a reactive value.
* Sets up a test suite for a reactive component using `setupReactive` to
* create subscribe to a reactive value.
*
* Each test case has three variations, representing the three overloads of
* `IntoReactiveBlueprint`.
Expand Down Expand Up @@ -105,8 +105,8 @@ export function testSetupReactive(
}

/**
* Sets up a test suite for a reactive component using `setupReactive` to create
* subscribe to a reactive value.
* Sets up a test suite for a reactive component using `setupReactive` to
* create subscribe to a reactive value.
*
* Each test case has three variations, representing the three overloads of
* `IntoReactiveBlueprint`.
Expand Down
2 changes: 1 addition & 1 deletion packages/react/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@testing-library/react": "^14.0.0",
"@types/react": "^18.2.22",
"@types/scheduler": "^0.16.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/use-strict-lifecycle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@types/react": "^18.2.22",
"@types/scheduler": "^0.16.3",
"rollup": "^4.0.2"
Expand Down
8 changes: 4 additions & 4 deletions packages/react/use-strict-lifecycle/src/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
*
* ## The Solution
*
* The `useLifecycle` hook gives you a way to create a new instance of something
* when the component is first instantiated, clean it up when the component is
* unmounted, and create a brand **new** instance when the component is
* reactivated.
* The `useLifecycle` hook gives you a way to create a new instance of
* something when the component is first instantiated, clean it up when the
* component is unmounted, and create a brand **new** instance when the
* component is reactivated.
*
* TL;DR It works almost the same way that per-component state in React works,
* but gives you a fresh copy whenever React re-attaches the component.
Expand Down
2 changes: 1 addition & 1 deletion packages/react/use-strict-lifecycle/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react": "18.2.0"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@types/react": "^18.2.22",
"jsdom": "^22.1.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/universal/collections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"rollup": "^4.0.2"
},
"files": [
Expand Down
4 changes: 2 additions & 2 deletions packages/universal/collections/src/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export const cached = <T>(
): void => {
const get = descriptor.get;

verify(
verify?.(
get,
isPresent,
expected(`the target of @cached`)
expected?.(`the target of @cached`)
.toBe(`a getter`)
.butGot(() =>
typeof descriptor.value === "function" ? `a method` : `a field`,
Expand Down
2 changes: 1 addition & 1 deletion packages/universal/collections/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"@starbeam-workspace/test-utils": "workspace:^"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4"
"@starbeam-dev/eslint-plugin": "^1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/universal/core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"dependencies": {},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"rollup": "^4.0.2"
}
}
2 changes: 1 addition & 1 deletion packages/universal/core-utils/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"@starbeam/core-utils": "workspace:^"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4"
"@starbeam-dev/eslint-plugin": "^1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/universal/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"rollup": "^4.0.2"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/universal/debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4",
"@starbeam-dev/eslint-plugin": "^1.0.6",
"@types/node": "18.16.1",
"rollup": "^4.0.2"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/universal/debug/src/call-stack/debug/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function stripLeadingSlash(path: string) {

/**
* The whole `Stack` system is only intended to be used for logging, so the
* edge-cases where this normalization wouldn't work (verbatim paths on Windows)
* shouldn't matter.
* edge-cases where this normalization wouldn't work (verbatim paths on
* Windows) shouldn't matter.
*/
function normalizePath(...pathParts: (string | null | undefined)[]): string {
return pathParts
Expand All @@ -48,8 +48,8 @@ function normalizePath(...pathParts: (string | null | undefined)[]): string {
}

/**
* This function takes two paths and returns the suffix of the target that comes
* after any shared prefix with the source.
* This function takes two paths and returns the suffix of the target that
* comes after any shared prefix with the source.
*
* For example, if the source is `/src/app/foo/bar` and the target is
* `/src/app/baz/qux`, this function will return `baz/qux`.
Expand Down
2 changes: 1 addition & 1 deletion packages/universal/debug/src/call-stack/debug/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function callerStack(
"An error created in the internals of Stack.create",
).stack;

verify(stack, hasType("string"));
verify?.(stack, hasType("string"));
return callStack(stack)?.slice(internal + CALLER);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/universal/debug/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"@starbeam-workspace/test-utils": "workspace:^"
},
"devDependencies": {
"@starbeam-dev/eslint-plugin": "^1.0.4"
"@starbeam-dev/eslint-plugin": "^1.0.6"
}
}
2 changes: 1 addition & 1 deletion packages/universal/interfaces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
},
"devDependencies": {
"@starbeam-dev/compile": "workspace:*",
"@starbeam-dev/eslint-plugin": "^1.0.4"
"@starbeam-dev/eslint-plugin": "^1.0.6"
}
}
Loading

0 comments on commit 7099168

Please sign in to comment.