-
-
Notifications
You must be signed in to change notification settings - Fork 112
chore: replace some unused/small/deprecated/long-updated dependencies and remove some spaces #2144
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
Conversation
📝 WalkthroughWalkthroughThis change introduces a new internal helpers module that centralizes utility functions such as string case transformations, object checks, and assertion helpers. All usages of these utilities across the codebase are updated to import from the new internal module instead of external packages. Additional changes include minor whitespace and formatting corrections in schema files and comments, with no modifications to logic or public APIs. Changes
Sequence Diagram(s)sequenceDiagram
participant CodeFile as Code File
participant LocalHelpers as @zenstackhq/runtime/local-helpers
participant Utility as Utility Function (e.g., lowerCaseFirst)
CodeFile->>LocalHelpers: import { Utility }
LocalHelpers->>Utility: re-export Utility from local implementation
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (5)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (11)
packages/runtime/src/local-helpers/sleep.ts (1)
1-5
: Add explicit return type & tiny style polishA couple of very small tweaks improve clarity and align with typical style:
-export function sleep(timeout: number) { - return new Promise<void>((resolve) => { - setTimeout(() => resolve(), timeout); - }) +export function sleep(timeout: number): Promise<void> { + return new Promise<void>(resolve => { + setTimeout(resolve, timeout); + }); }Reasons:
- Explicit
: Promise<void>
makes the API contract unmistakable.- Arrow-function shorthand (
setTimeout(resolve, timeout)
) is marginally leaner.- Ending semicolon keeps consistency with the majority of the codebase.
Purely cosmetic; adopt if it fits project conventions.
packages/schema/src/res/stdlib.zmodel (1)
538-546
: Typo in comment: “thrid” → “third”Small spelling glitch in the docs—worth correcting to keep generated documentation professional.
- * You can pass a thrid argument as `true` to make it override the model-level policies. + * You can pass a third argument as `true` to make it override the model-level policies.packages/runtime/src/local-helpers/tiny-invariant.ts (1)
4-17
: Optional: accept a lazy message to avoid needless string workIn hot paths callers often build error strings unconditionally.
Allowingmessage
to be a thunk keeps production builds lean without impacting DX.-export function invariant( - condition: unknown, - message?: string, -): asserts condition { +export function invariant( + condition: unknown, + message?: string | (() => string), +): asserts condition { @@ - throw new Error(message ? `${prefix}: ${message}` : prefix); + const text = typeof message === 'function' ? message() : message; + throw new Error(text ? `${prefix}: ${text}` : prefix);packages/runtime/src/enhancements/node/policy/policy-utils.ts (1)
18-18
: Use the canonical import path for consistencyEverywhere else you switched to
@zenstackhq/runtime/local-helpers
, but this file uses a relative path.
Aligning paths reduces duplication in bundlers and improves tree-shaking.-import { isPlainObject, lowerCaseFirst, upperCaseFirst } from '../../../local-helpers'; +import { isPlainObject, lowerCaseFirst, upperCaseFirst } from '@zenstackhq/runtime/local-helpers';packages/runtime/src/local-helpers.ts (1)
1-1
: Minor path nitThe explicit
/index
suffix is unnecessary; Node/TS will resolve the directory automatically.-export * from './local-helpers/index'; +export * from './local-helpers';packages/runtime/src/local-helpers/upper-case-first.ts (1)
1-3
: Handle empty input explicitlyConsider adding a guard for empty strings to avoid returning unexpected values when
input
is empty:export function upperCaseFirst(input: string) { + if (input.length === 0) { + return input; + } return input.charAt(0).toUpperCase() + input.slice(1); }packages/runtime/src/local-helpers/lower-case-first.ts (1)
1-3
: Handle empty input explicitlySimilar to
upperCaseFirst
, consider guarding against empty strings to ensure consistent behavior:export function lowerCaseFirst(input: string) { + if (input.length === 0) { + return input; + } return input.charAt(0).toLowerCase() + input.slice(1); }packages/plugins/openapi/src/rest-generator.ts (1)
36-36
: Variable name shadowing: importedname
vs. parametername
import { name } from '.'
introduces an identifier that is later shadowed by the
name
parameter insidemakeFilterParameter
. While TypeScript allows this, it
hurts readability and can lead to accidental misuse.-import { name } from '.'; +import { name as pluginName } from '.'; ... -private makeFilterParameter(..., name: string, ...) +private makeFilterParameter(..., filterName: string, ...)Also applies to: 521-529
packages/plugins/tanstack-query/scripts/postbuild.js (2)
6-18
: Nit: avoid shadowing and make variable intent clearer.Using
path
as the iterator masks thepath
module should you ever add it later, and reduces readability. Consider the rename below:- paths.forEach(path => { - const contents = fs.readFileSync(path, { encoding: 'utf-8' }); + paths.forEach(filePath => { + const contents = fs.readFileSync(filePath, { encoding: 'utf-8' }); … - fs.writeFileSync(path, newContents, { encoding: 'utf-8' }); + fs.writeFileSync(filePath, newContents, { encoding: 'utf-8' });
6-18
: Guard against single-replacement whenfrom
is a string.
String.prototype.replace
only touches the first occurrence unlessfrom
is a RegExp with the global flag.
If future calls provide a string literal you’ll silently miss extra matches.Quick defensive fix:
-const newContents = contents.replace(from, to); +const newContents = contents.replace( + typeof from === 'string' ? new RegExp(from, 'g') : from, + to +);packages/runtime/src/local-helpers/is-plain-object.ts (1)
5-23
: ExposeisPlainObject
as a type-guard to improve DX
Since callers typically branch on the result to treato
as a plain object, make the signature a predicate as well:-export function isPlainObject(o: unknown) { +export function isPlainObject(o: unknown): o is Record<string, unknown> {This eliminates the need for
as
casts at call-sites and keeps typings self-documenting.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (19)
package.json
is excluded by!**/*.json
packages/plugins/openapi/package.json
is excluded by!**/*.json
packages/plugins/openapi/tests/baseline/rest-3.1.0.baseline.yaml
is excluded by!**/*.yaml
packages/plugins/swr/package.json
is excluded by!**/*.json
packages/plugins/tanstack-query/package.json
is excluded by!**/*.json
packages/plugins/trpc/package.json
is excluded by!**/*.json
packages/plugins/trpc/tests/projects/nuxt-trpc-v10/package-lock.json
is excluded by!**/package-lock.json
,!**/*.json
packages/plugins/trpc/tests/projects/nuxt-trpc-v10/package.json
is excluded by!**/*.json
packages/plugins/trpc/tests/projects/nuxt-trpc-v11/package-lock.json
is excluded by!**/package-lock.json
,!**/*.json
packages/plugins/trpc/tests/projects/nuxt-trpc-v11/package.json
is excluded by!**/*.json
packages/plugins/trpc/tests/projects/t3-trpc-v10/package.json
is excluded by!**/*.json
packages/plugins/trpc/tests/projects/t3-trpc-v11/package.json
is excluded by!**/*.json
packages/runtime/package.json
is excluded by!**/*.json
packages/schema/package.json
is excluded by!**/*.json
packages/sdk/package.json
is excluded by!**/*.json
packages/server/package.json
is excluded by!**/*.json
packages/testtools/package.json
is excluded by!**/*.json
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
,!**/*.yaml
tests/integration/package.json
is excluded by!**/*.json
📒 Files selected for processing (51)
packages/ide/jetbrains/build.gradle.kts
(1 hunks)packages/language/src/zmodel.langium
(3 hunks)packages/plugins/openapi/src/rest-generator.ts
(1 hunks)packages/plugins/openapi/src/rpc-generator.ts
(1 hunks)packages/plugins/swr/src/generator.ts
(1 hunks)packages/plugins/swr/src/runtime/index.ts
(1 hunks)packages/plugins/swr/tests/react-hooks.test.tsx
(1 hunks)packages/plugins/tanstack-query/scripts/postbuild.js
(1 hunks)packages/plugins/tanstack-query/src/generator.ts
(1 hunks)packages/plugins/trpc/src/client-helper/index.ts
(1 hunks)packages/plugins/trpc/src/generator.ts
(2 hunks)packages/plugins/trpc/src/utils.ts
(1 hunks)packages/runtime/src/cross/clone.ts
(1 hunks)packages/runtime/src/cross/model-meta.ts
(1 hunks)packages/runtime/src/cross/query-analyzer.ts
(1 hunks)packages/runtime/src/cross/utils.ts
(1 hunks)packages/runtime/src/enhancements/node/delegate.ts
(1 hunks)packages/runtime/src/enhancements/node/policy/handler.ts
(1 hunks)packages/runtime/src/enhancements/node/policy/policy-utils.ts
(1 hunks)packages/runtime/src/local-helpers.ts
(1 hunks)packages/runtime/src/local-helpers/index.ts
(1 hunks)packages/runtime/src/local-helpers/is-plain-object.ts
(1 hunks)packages/runtime/src/local-helpers/lower-case-first.ts
(1 hunks)packages/runtime/src/local-helpers/param-case.ts
(1 hunks)packages/runtime/src/local-helpers/sleep.ts
(1 hunks)packages/runtime/src/local-helpers/tiny-invariant.ts
(1 hunks)packages/runtime/src/local-helpers/upper-case-first.ts
(1 hunks)packages/schema/src/plugins/enhancer/enhance/checker-type-generator.ts
(1 hunks)packages/schema/src/plugins/enhancer/enhance/index.ts
(1 hunks)packages/schema/src/plugins/enhancer/policy/expression-writer.ts
(1 hunks)packages/schema/src/plugins/enhancer/policy/policy-guard-generator.ts
(1 hunks)packages/schema/src/plugins/prisma/schema-generator.ts
(2 hunks)packages/schema/src/plugins/zod/generator.ts
(1 hunks)packages/schema/src/plugins/zod/index.ts
(1 hunks)packages/schema/src/plugins/zod/transformer.ts
(1 hunks)packages/schema/src/plugins/zod/utils/schema-gen.ts
(1 hunks)packages/schema/src/res/stdlib.zmodel
(6 hunks)packages/schema/src/telemetry.ts
(1 hunks)packages/schema/tests/schema/all-features.zmodel
(2 hunks)packages/schema/tests/schema/todo.zmodel
(2 hunks)packages/sdk/src/dmmf-helpers/aggregate-helpers.ts
(1 hunks)packages/sdk/src/model-meta-generator.ts
(1 hunks)packages/server/src/api/rest/index.ts
(1 hunks)packages/server/src/api/rpc/index.ts
(1 hunks)packages/server/src/nestjs/interfaces/api-handler-options.interface.ts
(1 hunks)packages/testtools/src/db.ts
(1 hunks)packages/testtools/src/schema.ts
(1 hunks)tests/integration/tests/schema/petstore.zmodel
(3 hunks)tests/integration/tests/schema/refactor-pg.zmodel
(5 hunks)tests/integration/tests/schema/todo-pg.zmodel
(1 hunks)tests/integration/tests/schema/todo.zmodel
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: dependency-review
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: OSSAR-Scan
🔇 Additional comments (40)
packages/testtools/src/db.ts (1)
10-12
: Only whitespace formatting changes
The reformatting of thePool
constructor object removes trailing spaces and consolidates lines without altering behavior.packages/testtools/src/schema.ts (1)
21-21
: Remove extra space in JSDoc opening tag
This is a trivial formatting cleanup with no impact on functionality.packages/ide/jetbrains/build.gradle.kts (1)
88-88
: Clean up extraneous blank lines in changelog introduction
Whitespace-only change for consistent formatting.Also applies to: 90-90
tests/integration/tests/schema/petstore.zmodel (1)
18-18
: Remove trailing whitespace
Whitespace cleanup only; no schema or logic changes.Also applies to: 21-21, 37-37, 52-52
packages/server/src/nestjs/interfaces/api-handler-options.interface.ts (1)
8-8
: Remove unnecessary trailing spaces in comment
Minor formatting correction; no change to interface.tests/integration/tests/schema/todo.zmodel (1)
117-117
: Remove trailing whitespace from comment
Formatting cleanup only; logic unchanged.tests/integration/tests/schema/refactor-pg.zmodel (1)
13-13
: Whitespace clean-up acknowledgedOnly trailing blank lines were removed. No functional impact.
Also applies to: 33-33, 36-36, 63-63, 79-79, 88-88
tests/integration/tests/schema/todo-pg.zmodel (1)
106-106
: Trailing-space removed in comment – all goodpackages/schema/tests/schema/all-features.zmodel (1)
136-136
: Minor formatting change confirmedComment whitespace and EOF newline tweaks are fine.
Also applies to: 190-190
packages/language/src/zmodel.langium (1)
167-167
: Grammar file whitespace tidy-up looks safeWhitespace only; grammar semantics unchanged.
Also applies to: 196-196, 211-211
packages/schema/tests/schema/todo.zmodel (1)
126-128
: Whitespace-only clean-up looks goodTrailing-space removal keeps diffs tidy and avoids noisy churn in future commits.
packages/runtime/src/cross/utils.ts (1)
1-1
: Consolidated helper import acknowledgedSwitching to the internal helper module removes an external dependency and standardises utility usage. 👍
packages/runtime/src/cross/query-analyzer.ts (1)
2-3
: Helper import path updated correctlyImport now references the local aggregation module, aligning with the dependency cleanup effort.
packages/runtime/src/cross/model-meta.ts (1)
1-1
: ImportlowerCaseFirst
from internal helpers
The import has been correctly switched to the consolidated local-helpers module, removing the external dependency.packages/runtime/src/cross/clone.ts (1)
1-1
: ImportisPlainObject
from internal helpers
The change properly uses the new local-helpers module forisPlainObject
, maintaining existing clone logic.packages/schema/src/plugins/enhancer/enhance/checker-type-generator.ts (1)
3-3
: SwitchlowerCaseFirst
import to internal helper alias
The import path update aligns with the new centralized helper package and removes the previous external dependency.packages/schema/src/telemetry.ts (1)
3-3
: Use internalsleep
helper instead of external package
The import correctly points to the local-helpers module forsleep
, consolidating dependencies as intended.packages/plugins/swr/src/runtime/index.ts (1)
10-10
: UpdatelowerCaseFirst
import to internal helper
This aligns the SWR runtime code with the consolidated helpers, removing reliance on the external package.packages/sdk/src/dmmf-helpers/aggregate-helpers.ts (1)
1-1
: Consolidate utility import forupperCaseFirst
Switched from the externalupper-case-first
package to our internal helpers to reduce dependencies.packages/runtime/src/enhancements/node/delegate.ts (1)
17-17
: Use internal helpers forisPlainObject
andlowerCaseFirst
Importing from../../local-helpers
centralizes these utilities. Please confirm the path resolves correctly.packages/schema/src/plugins/zod/utils/schema-gen.ts (1)
14-14
: ImportupperCaseFirst
from centralized helpers
This aligns with the PR’s goal of removing deprecated external dependencies.packages/server/src/api/rpc/index.ts (1)
10-10
: SwitchupperCaseFirst
import to internal module
Reducing external dep footprint by using the consolidated helper.packages/schema/src/plugins/zod/index.ts (1)
2-2
: Replace externalinvariant
with internal implementation
Importinginvariant
from our helpers ensures consistency across the codebase.packages/schema/src/plugins/enhancer/policy/policy-guard-generator.ts (1)
34-34
: Consolidated import to local-helpers
Import oflowerCaseFirst
has been updated to the centralized helper module, removing dependency on the external package. This aligns with the PR objective of standardizing utilities across the codebase.packages/sdk/src/model-meta-generator.ts (1)
20-20
: Use centralized helper module
Replaced the externallowerCaseFirst
import with the internal local-helpers module to unify utility imports and eliminate an external dependency.packages/plugins/swr/tests/react-hooks.test.tsx (1)
10-10
: Unified utility import in tests
Switching to the internal helper forlowerCaseFirst
ensures tests remain consistent with the refactoring and removes reliance on the deprecated external package.packages/schema/src/plugins/zod/generator.ts (1)
29-29
: CentralizedupperCaseFirst
import
Updating the import to use the consolidated local-helpers module removes the deprecated external dependency and maintains import consistency.packages/schema/src/plugins/zod/transformer.ts (1)
15-15
: Import relocation looks correct but double-check package linkageThe path switch from the external
upper-case-first
package to the monorepo helper (@zenstackhq/runtime/local-helpers
) compiles fine here.
Just make sure thatpackages/schema
declares@zenstackhq/runtime
as a dependency/peer-dependency; otherwise consumers of theschema
package could face a missing module error when the helper gets resolved at runtime.packages/runtime/src/enhancements/node/policy/handler.ts (1)
18-18
: Verify helper implementation parityYou swapped
tiny-invariant
,lower-case-first
, andupper-case-first
with the local helper versions.
Two quick checks before merging:
The local
invariant
helper MUST support the same call-signature used below (both the 1-arg and 2-arg variants – see lines ~826 and ~1795) and throw anError
object; otherwise diagnostic behaviour will change silently.The relative path
../../../local-helpers
resolves topackages/runtime/src/local-helpers.ts
. Confirm that this file is emitted to the same sub-path in the published package so downstream bundlers don’t break.Everything else in this file remains untouched, so a green build will confirm the swap.
packages/plugins/trpc/src/utils.ts (1)
2-2
: Consistent helper import – good moveMoving to the consolidated
local-helpers
module keeps the dependency graph slimmer and improves tree-shaking. No further action needed here.packages/plugins/trpc/src/client-helper/index.ts (1)
3-3
:✅ Verification successful
Ensure no legacy imports remain across the repo
lowerCaseFirst
/upperCaseFirst
now come from@zenstackhq/runtime/local-helpers
. Please verify that all other files were updated accordingly so we can actually drop the externallower-case-first
/upper-case-first
packages frompackage.json
.
🏁 Script executed:
#!/bin/bash # Search the whole repo for any remaining direct imports of the removed packages rg -n $'from [\'"](?:lower-case-first|upper-case-first|change-case|tiny-invariant|is-plain-object|sleep-promise)[\'"]'Length of output: 123
🏁 Script executed:
#!/bin/bash # Re-run simplified search for legacy package names anywhere in the codebase for pkg in lower-case-first upper-case-first change-case tiny-invariant is-plain-object sleep-promise; do echo "Searching for occurrences of '$pkg':" rg -n "$pkg" doneLength of output: 1743
All legacy imports have been replaced
I re-searched the entire codebase for any direct references to the old packages (lower-case-first
,upper-case-first
,change-case
,tiny-invariant
,is-plain-object
,sleep-promise
) and only found their exports inpackages/runtime/src/local-helpers/index.ts
(i.e. local files), with no remaining imports from the external packages. You can safely remove thelower-case-first
andupper-case-first
(and any other unused) dependencies frompackage.json
.packages/plugins/swr/src/generator.ts (1)
15-15
: ConfirmparamCase
behavioural parityThe new internal
paramCase
must mirrorchange-case
’s behaviour (e.g. Unicode handling, many consecutive upper-case letters, etc.).
Please add/extend unit tests forparamCase
to avoid subtle API regressions.packages/schema/src/plugins/enhancer/enhance/index.ts (1)
30-30
: Import consolidation is correctThe
upperCaseFirst
import has been updated to the new internal helper module, aligning with the local-helpers refactoring. No issues detected.packages/plugins/trpc/src/generator.ts (1)
15-15
: Consolidated helper importsThe combined import of
lowerCaseFirst
andupperCaseFirst
from@zenstackhq/runtime/local-helpers
is correct and matches usage within this file.packages/plugins/openapi/src/rpc-generator.ts (1)
14-14
: Consolidated helper importsThe
lowerCaseFirst
,upperCaseFirst
, andinvariant
imports have been correctly consolidated from the internallocal-helpers
module.packages/plugins/openapi/src/rest-generator.ts (1)
29-29
:✅ Verification successful
Confirm
local-helpers
re-exports are 1-for-1 compatible with the removed libsThe file now relies on
@zenstackhq/runtime/local-helpers
forinvariant
andlowerCaseFirst
.
Please double-check that:
invariant
is exported as a named function (not a default) and preserves the signature oftiny-invariant
.lowerCaseFirst
behaves identically to the previouslower-case-first
package (handles empty strings, non-alpha input, etc.).
🏁 Script executed:
#!/usr/bin/env bash # Ensure helper re-exports exist and are named exports ast-grep --pattern $'export function invariant($_) { $$$ }' $(fd local-helpers | head -n 1) ast-grep --pattern $'export function lowerCaseFirst($_) { $$$ }' $(fd local-helpers | head -n 1)Length of output: 544
🏁 Script executed:
#!/usr/bin/env bash # Locate the definition or re-export of invariant in local-helpers rg -R "export.*invariant" -n packages/runtime/src/local-helpers rg -R "tiny-invariant" -n packages/runtime/src/local-helpersLength of output: 936
🏁 Script executed:
#!/usr/bin/env bash # List helper files find packages/runtime/src/local-helpers -maxdepth 1 -type f # Search for any import/export of invariant rg -n "invariant" packages/runtime/src/local-helpers # Search for tiny-invariant usage rg -n "tiny-invariant" packages/runtime/src/local-helpersLength of output: 768
No changes needed for helper re-exports
Verified that:
invariant
is a named export inpackages/runtime/src/local-helpers/tiny-invariant.ts
and is re-exported inpackages/runtime/src/local-helpers/index.ts
, preserving the originaltiny-invariant
signature.lowerCaseFirst(input: string)
inpackages/runtime/src/local-helpers/lower-case-first.ts
behaves identically to the previouslower-case-first
package (empty strings yield''
, non-alphabetic first characters are unchanged).packages/server/src/api/rest/index.ts (1)
13-13
:❓ Verification inconclusive
Behavioural parity check for
paramCase
,lowerCaseFirst
,upperCaseFirst
The helpers are now sourced from the internal bundle. Make sure:
paramCase('SomeValue')
still yieldssome-value
(was implemented bychange-case
).- Unicode / non-ASCII handling is unchanged (edge cases often differ between libraries).
- Tree-shaking doesn’t accidentally drop these funcs in browser builds.
🏁 Script executed:
#!/usr/bin/env bash # Quick parity smoke-test against the old implementation node - <<'JS' import { paramCase } from '@zenstackhq/runtime/local-helpers'; console.log(paramCase('SomeValue')); // expect 'some-value' JSLength of output: 1024
🏁 Script executed:
#!/usr/bin/env bash # Locate and inspect the local-helpers implementation to verify parity file=$(fd local-helpers.ts -t f | head -n 1) if [[ -z "$file" ]]; then echo "local-helpers.ts not found" exit 1 fi echo "Inspecting: $file" sed -n '1,200p' "$file"Length of output: 336
🏁 Script executed:
#!/usr/bin/env bash echo "Inspecting local-helpers index and implementations..." # Show exports in the index sed -n '1,200p' packages/runtime/src/local-helpers/index.ts # Show each helper’s implementation for file in packages/runtime/src/local-helpers/*.ts; do if [[ "$file" != *"/index.ts" ]]; then echo "----- $file -----" sed -n '1,200p' "$file" fi doneLength of output: 4586
Verify helper parity and Unicode handling
In
packages/server/src/api/rest/index.ts
(line 13):import { lowerCaseFirst, upperCaseFirst, paramCase } from '@zenstackhq/runtime/local-helpers';• Confirm that
paramCase('SomeValue')
still yields"some-value"
•lowerCaseFirst
andupperCaseFirst
remain simple ASCII‐only routines
• Unicode edge cases: newparamCase
uses/[^A-Z0-9]+/gi
to strip separators, so non-ASCII characters (e.g. accented letters, emojis) will be dropped—add tests like:paramCase('Éclair') // expected? 'éclair' vs. '' or 'clair' paramCase('foo😊bar') // expected? 'foo-bar' vs. 'foo😊bar'• Tree-shaking should work out-of-the-box with these named ESM exports, but verify in your browser bundle
packages/plugins/tanstack-query/src/generator.ts (1)
16-16
: Confirm secondary entry-point resolution for@zenstackhq/runtime/local-helpers
.The new import pulls from a sub-path that didn’t previously exist. Please double-check that:
- the path is exported in
packages/runtime/package.json#exports
, and- TS/Node module-resolution settings in every consumer project allow sub-path imports.
Otherwise downstream builds may fail with “module not found”.
packages/runtime/src/local-helpers/index.ts (1)
1-6
: Re-export layer looks good.All helper utilities are funnelled through a single barrel file, improving DX and tree-shaking. ✅
packages/schema/src/plugins/prisma/schema-generator.ts (1)
48-51
: Import refactor looks correct.Swapping
lower-case-first
for the local helper reduces external deps without changing behaviour. No further action needed.
@ymc9 Hey. Should you check it? 👀 |
Absolutely! Will finish reviewing it asap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @DoctorFTB , thanks for making this clean up and my apologies for the delay. Please check the review comments attached. Thanks!
Btw, just curious, on what aspect does having more dependencies hurt you? NPM installation slowness or bundling time? |
Both, and also the large Docker image size (we have a layer with full set of node_modules for cache) :( |
FYI, I'm also preparing a replacement for "traverse" library, I can push changes here (but I need some time to implement them) or I can make another PR with changes |
Got it. Thanks for the explanation. Maybe we can get this PR merged first? I'm planning a release today or tomorrow. |
Yes, do it! Don't worry, I can make one more PR without any problems :) |
Replaced dependencies:
replace-in-file - most of the functionality is not used, its 15 lines code
change-case - most of the functionality is not used, v4 (currently used in project) depends on 12 more libraries, used many libraries inside (change-case -> param-case -> dot-case -> no-case -> lower-case), its 15 lines code
lower-case-first - deprecated
upper-case-first - deprecated
tiny-invariant - small library
is-plain-object - small library
sleep-promise - small library
jest-fetch-mock - unused
ts-node - unused (calle one once via npx)
About packages:
Packages: +16 -189
Move dependencies "decimal.js-light", "superjson" and "uuid" from dependencies to devDependencies in runtime, cuz used only for build
Remove spaces on empty lines or before next line.
Feel free to ask questions and discuss :)
P.S. Code was not tested locally. I got stuck after tests ate 150 GB of disk space.