Skip to content
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

rollup fix #1527

Merged
merged 5 commits into from
Mar 4, 2025
Merged

rollup fix #1527

merged 5 commits into from
Mar 4, 2025

Conversation

ryoppippi
Copy link
Contributor

  • modify rollup config to generate submodules in esm format
  • add .js prefix to @samchon/openapi because in esm we need to add extension when we import scripts

Copy link

socket-security bot commented Mar 1, 2025

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] Transitive: environment, filesystem +27 576 kB stevenbenisek
npm/[email protected] None 0 21.6 kB septh
npm/[email protected] Transitive: filesystem +2 130 kB

View full report↗︎

Copy link

pkg-pr-new bot commented Mar 1, 2025

Open in Stackblitz

npm i https://pkg.pr.new/typia@1527

commit: 641b5bf

@ryoppippi ryoppippi force-pushed the feature/rollup-fix branch from 33a6082 to b0d1717 Compare March 1, 2025 22:36
@ryoppippi ryoppippi marked this pull request as draft March 1, 2025 22:51
@ryoppippi
Copy link
Contributor Author

@samchon I'l| write @samchon/openapi fix rollup pluigin

Resolves import issues with @samchon/openapi by automatically adding
.mjs extension to import statements and external module resolution.
This ensures proper module loading in ESM environments.
@ryoppippi ryoppippi marked this pull request as ready for review March 1, 2025 22:58
@ryoppippi
Copy link
Contributor Author

fixed! Please check the output file using @samchon/openapi like lib/programmers/llm/LlmPrarmetersProgrammer.mjs

const ext = `mjs`;
const nodeModulesDir = `node_modules`;
if (chunkInfo.name.includes(nodeModulesDir)) {
throw new Error(`Invalid chunk name: ${chunkInfo.name}`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all dependencies are now external.

Comment on lines +27 to +45
{
name: "add-js-to-samchon-openapi",
renderChunk(code) {
return code.replace(/import (.+) from "(.+)"/g, (m, m1, m2) => {
if(m2.startWith('@samchon/openapi/lib')) {
return `import ${m1} from "${m2}.mjs"`
}
return m;
})
},
resolveId(id) {
if (id.startsWith("@samchon/openapi/lib")) {
return {
id: id + ".mjs",
external: true,
}
}
},
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert @samchon/openapi/lib/~~ to @samchon/openapi/lib/~~.mjs

@ryoppippi
Copy link
Contributor Author

@samchon this resolves esm modules so please check it

Copy link
Owner

@samchon samchon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, I will merge first, and would test at the next 3.0.1 patch update

@samchon samchon merged commit 35c9910 into samchon:master Mar 4, 2025
10 checks passed
@ryoppippi ryoppippi deleted the feature/rollup-fix branch March 5, 2025 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants