@modern-js/sandpack-react 3.9.3 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/templates/common.js +2 -2
- package/dist/cjs/templates/mwa.js +4 -7
- package/dist/esm/templates/common.mjs +2 -2
- package/dist/esm/templates/mwa.mjs +4 -7
- package/dist/esm-node/templates/common.mjs +2 -2
- package/dist/esm-node/templates/mwa.mjs +4 -7
- package/dist/types/templates/index.d.ts +0 -3
- package/dist/types/templates/mwa.d.ts +0 -3
- package/package.json +6 -7
- package/rstack.config.mts +4 -0
- package/scripts/codesandbox/.codesandbox/environment.json +1 -1
- package/scripts/codesandbox/.codesandbox/tasks.json +1 -1
- package/scripts/template.ts +4 -1
- package/rslib.config.mts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @modern-js/sandpack-react
|
|
2
2
|
|
|
3
|
+
## 3.10.1
|
|
4
|
+
|
|
5
|
+
## 3.10.0
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- 00017a1: Generate only AGENTS.md for AI coding guidance. Stop creating or updating CLAUDE.md in project templates and the --agents-md-only command.
|
|
10
|
+
- 778f778: Use Rstack CLI for linting and formatting in new projects.
|
|
11
|
+
|
|
3
12
|
## 3.9.3
|
|
4
13
|
|
|
5
14
|
## 3.9.2
|
|
@@ -28,8 +28,8 @@ var __webpack_require__ = {};
|
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
30
|
const commonFiles = {
|
|
31
|
-
".codesandbox/environment.json": "{\n \"nodeVersion\":
|
|
32
|
-
".codesandbox/tasks.json": "{\n \"$schema\": \"https://codesandbox.io/schemas/tasks.json\",\n \"setupTasks\": [\n {\n \"name\": \"Installing Dependencies\",\n \"command\": \"pnpm install\"\n }\n ],\n \"tasks\": {\n \"start\": {\n \"name\": \"Application\",\n \"command\": \"pnpm run
|
|
31
|
+
".codesandbox/environment.json": "{\n \"nodeVersion\": 22\n}\n",
|
|
32
|
+
".codesandbox/tasks.json": "{\n \"$schema\": \"https://codesandbox.io/schemas/tasks.json\",\n \"setupTasks\": [\n {\n \"name\": \"Installing Dependencies\",\n \"command\": \"pnpm install\"\n }\n ],\n \"tasks\": {\n \"start\": {\n \"name\": \"Application\",\n \"command\": \"pnpm run dev\",\n \"runAtStart\": true,\n \"restartOn\": {\n \"files\": [\"pnpm-lock.yaml\"]\n }\n }\n }\n}\n"
|
|
33
33
|
};
|
|
34
34
|
__webpack_require__.d(__webpack_exports__, {}, {
|
|
35
35
|
commonFiles: commonFiles
|
|
@@ -36,15 +36,12 @@ const MWAFiles = {
|
|
|
36
36
|
".browserslistrc": "chrome >= 87\nedge >= 88\nfirefox >= 78\nsafari >= 14\n",
|
|
37
37
|
".gitignore": ".DS_Store\n\n.pnp\n.pnp.js\n.env.local\n.env.*.local\n.history\n*.log*\n\nnode_modules/\n.yarn-integrity\n.pnpm-store/\n*.tsbuildinfo\n.changeset/pre.json\n\ndist/\ncoverage/\nrelease/\noutput/\noutput_resource/\nlog/\n\n.vscode/**/*\n!.vscode/settings.json\n!.vscode/extensions.json\n.idea/\n\n**/*/typings/auto-generated\n\nmodern.config.local.*\n",
|
|
38
38
|
".npmrc": "strict-peer-dependencies=false\n",
|
|
39
|
-
"AGENTS.md": "<!-- BEGIN:modernjs-agent-rules -->\n\n# Modern.js: read the docs before you code\n\n> Documentation: **`node_modules/@modern-js/app-tools/docs/`**\n> Index: `node_modules/@modern-js/app-tools/docs/llms.txt` — start here when unsure which page to open\n\nThese docs ship inside the package, so they match the Modern.js\nversion this project installed exactly. Your training data is likely\noutdated — **treat them as the source of truth**, and do not answer\nfrom memory on Modern.js configuration, APIs or directory conventions.\n\n**🟢 Read the docs before you touch anything, except for:**\n\n- Writing ordinary React components (not route components)\n- Editing CSS or style files\n- Adding utility functions or business logic\n- Installing ordinary npm packages (unrelated to Modern.js)\n\n<!-- END:modernjs-agent-rules -->\n",
|
|
40
|
-
"CLAUDE.md": "@AGENTS.md\n",
|
|
41
|
-
"biome.json": '{\n "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",\n "vcs": {\n "enabled": true,\n "defaultBranch": "main",\n "clientKind": "git",\n "useIgnoreFile": true\n },\n "formatter": {\n "enabled": true,\n "indentStyle": "space"\n },\n "javascript": {\n "formatter": {\n "quoteStyle": "single",\n "arrowParentheses": "asNeeded",\n "jsxQuoteStyle": "double",\n "lineWidth": 80\n }\n },\n "linter": {\n "enabled": true,\n "rules": {\n "recommended": true,\n "suspicious": {\n "noDuplicateFontNames": "off"\n }\n }\n },\n "organizeImports": {\n "enabled": true\n },\n "files": {\n "ignoreUnknown": true,\n "ignore": [".vscode/**/*", "node_modules/**/*", "dist/**/*"]\n }\n}\n',
|
|
39
|
+
"AGENTS.md": "<!-- BEGIN:modernjs-agent-rules -->\n\n# Modern.js: read the docs before you code\n\n> Documentation: **`node_modules/@modern-js/app-tools/docs/`**\n> Index: `node_modules/@modern-js/app-tools/docs/llms.txt` — start here when unsure which page to open\n\nThese docs ship inside the package, so they match the Modern.js\nversion this project installed exactly. Your training data is likely\noutdated — **treat them as the source of truth**, and do not answer\nfrom memory on Modern.js configuration, APIs or directory conventions.\n\n**🟢 Read the docs before you touch anything, except for:**\n\n- Writing ordinary React components (not route components)\n- Editing CSS or style files\n- Adding utility functions or business logic\n- Installing ordinary npm packages (unrelated to Modern.js)\n\n<!-- END:modernjs-agent-rules -->\n\n# Rstack CLI\n\nThis project uses Rstack CLI as its JS toolchain:\n\n- Read the docs linked from `node_modules/rstack/docs/llms.txt` when needed\n- Online docs: https://rstack.rs/llms.txt\n- Run `rs -h` for CLI help\n",
|
|
42
40
|
"modern.config.ts": "import { appTools, defineConfig } from '@modern-js/app-tools';\n\n// https://modernjs.dev/en/configure/app/usage\nexport default defineConfig({\n plugins: [appTools()],\n});\n",
|
|
43
|
-
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "dev": "modern dev",\n "build": "modern build",\n "serve": "modern serve"
|
|
44
|
-
"tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"baseUrl\": \"./\",\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@shared/*\": [\"./shared/*\"]\n }\n },\n \"include\": [\"src\", \"shared\", \"config\", \"modern.config.ts\", \"server\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
|
|
45
|
-
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n",
|
|
41
|
+
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "dev": "modern dev",\n "build": "modern build",\n "serve": "modern serve"\n },\n "engines": {\n "node": "^22.18.0 || >=24.3.0"\n },\n "dependencies": {\n "@modern-js/runtime": "3.10.1",\n "react": "^19.2.3",\n "react-dom": "^19.2.0"\n },\n "devDependencies": {\n "@modern-js/app-tools": "3.10.1",\n "@modern-js/tsconfig": "3.10.1",\n "typescript": "~5.7.3",\n "@types/node": "^20",\n "@types/react": "^19.1.8",\n "@types/react-dom": "^19.1.6"\n }\n}\n',
|
|
42
|
+
"tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"types\": [\"@modern-js/app-tools/types\"],\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"baseUrl\": \"./\",\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@shared/*\": [\"./shared/*\"]\n }\n },\n \"include\": [\"src\", \"shared\", \"config\", \"modern.config.ts\", \"server\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
|
|
46
43
|
"src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\n\nexport default defineRuntimeConfig({});\n",
|
|
47
|
-
"src/routes/index.css": "html,\nbody {\n padding: 0;\n margin: 0;\n font-family
|
|
44
|
+
"src/routes/index.css": "html,\nbody {\n padding: 0;\n margin: 0;\n font-family:\n PingFang SC,\n Hiragino Sans GB,\n Microsoft YaHei,\n Arial,\n sans-serif;\n background: linear-gradient(to bottom, transparent, #fff) #eceeef;\n}\n\np {\n margin: 0;\n}\n\n* {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n box-sizing: border-box;\n}\n\n.container-box {\n min-height: 100vh;\n max-width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding-top: 10px;\n}\n\nmain {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.title {\n display: flex;\n margin: 4rem 0 4rem;\n align-items: center;\n font-size: 4rem;\n font-weight: 600;\n}\n\n.logo {\n width: 6rem;\n margin: 7px 0 0 1rem;\n}\n\n.name {\n color: #4ecaff;\n}\n\n.description {\n text-align: center;\n line-height: 1.5;\n font-size: 1.3rem;\n color: #1b3a42;\n margin-bottom: 5rem;\n}\n\n.code {\n background: #fafafa;\n border-radius: 12px;\n padding: 0.6rem 0.9rem;\n font-size: 1.05rem;\n font-family:\n Menlo,\n Monaco,\n Lucida Console,\n Liberation Mono,\n DejaVu Sans Mono,\n Bitstream Vera Sans Mono,\n Courier New,\n monospace;\n}\n\n.container-box .grid {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 1100px;\n margin-top: 3rem;\n}\n\n.card {\n padding: 1.5rem;\n display: flex;\n flex-direction: column;\n justify-content: center;\n height: 100px;\n color: inherit;\n text-decoration: none;\n transition: 0.15s ease;\n width: 45%;\n}\n\n.card:hover,\n.card:focus {\n transform: scale(1.05);\n}\n\n.card h2 {\n display: flex;\n align-items: center;\n font-size: 1.5rem;\n margin: 0;\n padding: 0;\n}\n\n.card p {\n opacity: 0.6;\n font-size: 0.9rem;\n line-height: 1.5;\n margin-top: 1rem;\n}\n\n.arrow-right {\n width: 1.3rem;\n margin-left: 0.5rem;\n margin-top: 3px;\n}\n",
|
|
48
45
|
"src/routes/layout.tsx": "import { Outlet } from '@modern-js/runtime/router';\n\nexport default function Layout() {\n return (\n <div>\n <Outlet />\n </div>\n );\n}\n",
|
|
49
46
|
"src/routes/page.tsx": 'import { Helmet } from \'@modern-js/runtime/head\';\nimport \'./index.css\';\n\nconst Index = () => (\n <div className="container-box">\n <Helmet>\n <link\n rel="icon"\n type="image/x-icon"\n href="https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/favicon.ico"\n />\n </Helmet>\n <main>\n <div className="title">\n Welcome to\n <img\n className="logo"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/modern-js-logo.svg"\n alt="Modern.js Logo"\n />\n <p className="name">Modern.js</p>\n </div>\n <p className="description">\n Get started by editing <code className="code">src/routes/page.tsx</code>\n </p>\n <div className="grid">\n <a\n href="https://modernjs.dev/guides/get-started/introduction.html"\n target="_blank"\n rel="noopener noreferrer"\n className="card"\n >\n <h2>\n Guide\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Guide"\n />\n </h2>\n <p>Follow the guides to use all features of Modern.js.</p>\n </a>\n <a\n href="https://modernjs.dev/tutorials/foundations/introduction.html"\n target="_blank"\n className="card"\n rel="noreferrer"\n >\n <h2>\n Tutorials\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Tutorials"\n />\n </h2>\n <p>Learn to use Modern.js to create your first application.</p>\n </a>\n <a\n href="https://modernjs.dev/configure/app/usage.html"\n target="_blank"\n className="card"\n rel="noreferrer"\n >\n <h2>\n Config\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Config"\n />\n </h2>\n <p>Find all configuration options provided by Modern.js.</p>\n </a>\n <a\n href="https://github.com/web-infra-dev/modern.js"\n target="_blank"\n rel="noopener noreferrer"\n className="card"\n >\n <h2>\n GitHub\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Github"\n />\n </h2>\n <p>View the source code on GitHub; feel free to contribute.</p>\n </a>\n </div>\n </main>\n </div>\n);\n\nexport default Index;\n'
|
|
50
47
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const commonFiles = {
|
|
2
|
-
".codesandbox/environment.json": "{\n \"nodeVersion\":
|
|
3
|
-
".codesandbox/tasks.json": "{\n \"$schema\": \"https://codesandbox.io/schemas/tasks.json\",\n \"setupTasks\": [\n {\n \"name\": \"Installing Dependencies\",\n \"command\": \"pnpm install\"\n }\n ],\n \"tasks\": {\n \"start\": {\n \"name\": \"Application\",\n \"command\": \"pnpm run
|
|
2
|
+
".codesandbox/environment.json": "{\n \"nodeVersion\": 22\n}\n",
|
|
3
|
+
".codesandbox/tasks.json": "{\n \"$schema\": \"https://codesandbox.io/schemas/tasks.json\",\n \"setupTasks\": [\n {\n \"name\": \"Installing Dependencies\",\n \"command\": \"pnpm install\"\n }\n ],\n \"tasks\": {\n \"start\": {\n \"name\": \"Application\",\n \"command\": \"pnpm run dev\",\n \"runAtStart\": true,\n \"restartOn\": {\n \"files\": [\"pnpm-lock.yaml\"]\n }\n }\n }\n}\n"
|
|
4
4
|
};
|
|
5
5
|
export { commonFiles };
|
|
@@ -4,15 +4,12 @@ const MWAFiles = {
|
|
|
4
4
|
".browserslistrc": "chrome >= 87\nedge >= 88\nfirefox >= 78\nsafari >= 14\n",
|
|
5
5
|
".gitignore": ".DS_Store\n\n.pnp\n.pnp.js\n.env.local\n.env.*.local\n.history\n*.log*\n\nnode_modules/\n.yarn-integrity\n.pnpm-store/\n*.tsbuildinfo\n.changeset/pre.json\n\ndist/\ncoverage/\nrelease/\noutput/\noutput_resource/\nlog/\n\n.vscode/**/*\n!.vscode/settings.json\n!.vscode/extensions.json\n.idea/\n\n**/*/typings/auto-generated\n\nmodern.config.local.*\n",
|
|
6
6
|
".npmrc": "strict-peer-dependencies=false\n",
|
|
7
|
-
"AGENTS.md": "<!-- BEGIN:modernjs-agent-rules -->\n\n# Modern.js: read the docs before you code\n\n> Documentation: **`node_modules/@modern-js/app-tools/docs/`**\n> Index: `node_modules/@modern-js/app-tools/docs/llms.txt` — start here when unsure which page to open\n\nThese docs ship inside the package, so they match the Modern.js\nversion this project installed exactly. Your training data is likely\noutdated — **treat them as the source of truth**, and do not answer\nfrom memory on Modern.js configuration, APIs or directory conventions.\n\n**🟢 Read the docs before you touch anything, except for:**\n\n- Writing ordinary React components (not route components)\n- Editing CSS or style files\n- Adding utility functions or business logic\n- Installing ordinary npm packages (unrelated to Modern.js)\n\n<!-- END:modernjs-agent-rules -->\n",
|
|
8
|
-
"CLAUDE.md": "@AGENTS.md\n",
|
|
9
|
-
"biome.json": '{\n "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",\n "vcs": {\n "enabled": true,\n "defaultBranch": "main",\n "clientKind": "git",\n "useIgnoreFile": true\n },\n "formatter": {\n "enabled": true,\n "indentStyle": "space"\n },\n "javascript": {\n "formatter": {\n "quoteStyle": "single",\n "arrowParentheses": "asNeeded",\n "jsxQuoteStyle": "double",\n "lineWidth": 80\n }\n },\n "linter": {\n "enabled": true,\n "rules": {\n "recommended": true,\n "suspicious": {\n "noDuplicateFontNames": "off"\n }\n }\n },\n "organizeImports": {\n "enabled": true\n },\n "files": {\n "ignoreUnknown": true,\n "ignore": [".vscode/**/*", "node_modules/**/*", "dist/**/*"]\n }\n}\n',
|
|
7
|
+
"AGENTS.md": "<!-- BEGIN:modernjs-agent-rules -->\n\n# Modern.js: read the docs before you code\n\n> Documentation: **`node_modules/@modern-js/app-tools/docs/`**\n> Index: `node_modules/@modern-js/app-tools/docs/llms.txt` — start here when unsure which page to open\n\nThese docs ship inside the package, so they match the Modern.js\nversion this project installed exactly. Your training data is likely\noutdated — **treat them as the source of truth**, and do not answer\nfrom memory on Modern.js configuration, APIs or directory conventions.\n\n**🟢 Read the docs before you touch anything, except for:**\n\n- Writing ordinary React components (not route components)\n- Editing CSS or style files\n- Adding utility functions or business logic\n- Installing ordinary npm packages (unrelated to Modern.js)\n\n<!-- END:modernjs-agent-rules -->\n\n# Rstack CLI\n\nThis project uses Rstack CLI as its JS toolchain:\n\n- Read the docs linked from `node_modules/rstack/docs/llms.txt` when needed\n- Online docs: https://rstack.rs/llms.txt\n- Run `rs -h` for CLI help\n",
|
|
10
8
|
"modern.config.ts": "import { appTools, defineConfig } from '@modern-js/app-tools';\n\n// https://modernjs.dev/en/configure/app/usage\nexport default defineConfig({\n plugins: [appTools()],\n});\n",
|
|
11
|
-
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "dev": "modern dev",\n "build": "modern build",\n "serve": "modern serve"
|
|
12
|
-
"tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"baseUrl\": \"./\",\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@shared/*\": [\"./shared/*\"]\n }\n },\n \"include\": [\"src\", \"shared\", \"config\", \"modern.config.ts\", \"server\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
|
|
13
|
-
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n",
|
|
9
|
+
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "dev": "modern dev",\n "build": "modern build",\n "serve": "modern serve"\n },\n "engines": {\n "node": "^22.18.0 || >=24.3.0"\n },\n "dependencies": {\n "@modern-js/runtime": "3.10.1",\n "react": "^19.2.3",\n "react-dom": "^19.2.0"\n },\n "devDependencies": {\n "@modern-js/app-tools": "3.10.1",\n "@modern-js/tsconfig": "3.10.1",\n "typescript": "~5.7.3",\n "@types/node": "^20",\n "@types/react": "^19.1.8",\n "@types/react-dom": "^19.1.6"\n }\n}\n',
|
|
10
|
+
"tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"types\": [\"@modern-js/app-tools/types\"],\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"baseUrl\": \"./\",\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@shared/*\": [\"./shared/*\"]\n }\n },\n \"include\": [\"src\", \"shared\", \"config\", \"modern.config.ts\", \"server\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
|
|
14
11
|
"src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\n\nexport default defineRuntimeConfig({});\n",
|
|
15
|
-
"src/routes/index.css": "html,\nbody {\n padding: 0;\n margin: 0;\n font-family
|
|
12
|
+
"src/routes/index.css": "html,\nbody {\n padding: 0;\n margin: 0;\n font-family:\n PingFang SC,\n Hiragino Sans GB,\n Microsoft YaHei,\n Arial,\n sans-serif;\n background: linear-gradient(to bottom, transparent, #fff) #eceeef;\n}\n\np {\n margin: 0;\n}\n\n* {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n box-sizing: border-box;\n}\n\n.container-box {\n min-height: 100vh;\n max-width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding-top: 10px;\n}\n\nmain {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.title {\n display: flex;\n margin: 4rem 0 4rem;\n align-items: center;\n font-size: 4rem;\n font-weight: 600;\n}\n\n.logo {\n width: 6rem;\n margin: 7px 0 0 1rem;\n}\n\n.name {\n color: #4ecaff;\n}\n\n.description {\n text-align: center;\n line-height: 1.5;\n font-size: 1.3rem;\n color: #1b3a42;\n margin-bottom: 5rem;\n}\n\n.code {\n background: #fafafa;\n border-radius: 12px;\n padding: 0.6rem 0.9rem;\n font-size: 1.05rem;\n font-family:\n Menlo,\n Monaco,\n Lucida Console,\n Liberation Mono,\n DejaVu Sans Mono,\n Bitstream Vera Sans Mono,\n Courier New,\n monospace;\n}\n\n.container-box .grid {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 1100px;\n margin-top: 3rem;\n}\n\n.card {\n padding: 1.5rem;\n display: flex;\n flex-direction: column;\n justify-content: center;\n height: 100px;\n color: inherit;\n text-decoration: none;\n transition: 0.15s ease;\n width: 45%;\n}\n\n.card:hover,\n.card:focus {\n transform: scale(1.05);\n}\n\n.card h2 {\n display: flex;\n align-items: center;\n font-size: 1.5rem;\n margin: 0;\n padding: 0;\n}\n\n.card p {\n opacity: 0.6;\n font-size: 0.9rem;\n line-height: 1.5;\n margin-top: 1rem;\n}\n\n.arrow-right {\n width: 1.3rem;\n margin-left: 0.5rem;\n margin-top: 3px;\n}\n",
|
|
16
13
|
"src/routes/layout.tsx": "import { Outlet } from '@modern-js/runtime/router';\n\nexport default function Layout() {\n return (\n <div>\n <Outlet />\n </div>\n );\n}\n",
|
|
17
14
|
"src/routes/page.tsx": 'import { Helmet } from \'@modern-js/runtime/head\';\nimport \'./index.css\';\n\nconst Index = () => (\n <div className="container-box">\n <Helmet>\n <link\n rel="icon"\n type="image/x-icon"\n href="https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/favicon.ico"\n />\n </Helmet>\n <main>\n <div className="title">\n Welcome to\n <img\n className="logo"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/modern-js-logo.svg"\n alt="Modern.js Logo"\n />\n <p className="name">Modern.js</p>\n </div>\n <p className="description">\n Get started by editing <code className="code">src/routes/page.tsx</code>\n </p>\n <div className="grid">\n <a\n href="https://modernjs.dev/guides/get-started/introduction.html"\n target="_blank"\n rel="noopener noreferrer"\n className="card"\n >\n <h2>\n Guide\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Guide"\n />\n </h2>\n <p>Follow the guides to use all features of Modern.js.</p>\n </a>\n <a\n href="https://modernjs.dev/tutorials/foundations/introduction.html"\n target="_blank"\n className="card"\n rel="noreferrer"\n >\n <h2>\n Tutorials\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Tutorials"\n />\n </h2>\n <p>Learn to use Modern.js to create your first application.</p>\n </a>\n <a\n href="https://modernjs.dev/configure/app/usage.html"\n target="_blank"\n className="card"\n rel="noreferrer"\n >\n <h2>\n Config\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Config"\n />\n </h2>\n <p>Find all configuration options provided by Modern.js.</p>\n </a>\n <a\n href="https://github.com/web-infra-dev/modern.js"\n target="_blank"\n rel="noopener noreferrer"\n className="card"\n >\n <h2>\n GitHub\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Github"\n />\n </h2>\n <p>View the source code on GitHub; feel free to contribute.</p>\n </a>\n </div>\n </main>\n </div>\n);\n\nexport default Index;\n'
|
|
18
15
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
const commonFiles = {
|
|
3
|
-
".codesandbox/environment.json": "{\n \"nodeVersion\":
|
|
4
|
-
".codesandbox/tasks.json": "{\n \"$schema\": \"https://codesandbox.io/schemas/tasks.json\",\n \"setupTasks\": [\n {\n \"name\": \"Installing Dependencies\",\n \"command\": \"pnpm install\"\n }\n ],\n \"tasks\": {\n \"start\": {\n \"name\": \"Application\",\n \"command\": \"pnpm run
|
|
3
|
+
".codesandbox/environment.json": "{\n \"nodeVersion\": 22\n}\n",
|
|
4
|
+
".codesandbox/tasks.json": "{\n \"$schema\": \"https://codesandbox.io/schemas/tasks.json\",\n \"setupTasks\": [\n {\n \"name\": \"Installing Dependencies\",\n \"command\": \"pnpm install\"\n }\n ],\n \"tasks\": {\n \"start\": {\n \"name\": \"Application\",\n \"command\": \"pnpm run dev\",\n \"runAtStart\": true,\n \"restartOn\": {\n \"files\": [\"pnpm-lock.yaml\"]\n }\n }\n }\n}\n"
|
|
5
5
|
};
|
|
6
6
|
export { commonFiles };
|
|
@@ -5,15 +5,12 @@ const MWAFiles = {
|
|
|
5
5
|
".browserslistrc": "chrome >= 87\nedge >= 88\nfirefox >= 78\nsafari >= 14\n",
|
|
6
6
|
".gitignore": ".DS_Store\n\n.pnp\n.pnp.js\n.env.local\n.env.*.local\n.history\n*.log*\n\nnode_modules/\n.yarn-integrity\n.pnpm-store/\n*.tsbuildinfo\n.changeset/pre.json\n\ndist/\ncoverage/\nrelease/\noutput/\noutput_resource/\nlog/\n\n.vscode/**/*\n!.vscode/settings.json\n!.vscode/extensions.json\n.idea/\n\n**/*/typings/auto-generated\n\nmodern.config.local.*\n",
|
|
7
7
|
".npmrc": "strict-peer-dependencies=false\n",
|
|
8
|
-
"AGENTS.md": "<!-- BEGIN:modernjs-agent-rules -->\n\n# Modern.js: read the docs before you code\n\n> Documentation: **`node_modules/@modern-js/app-tools/docs/`**\n> Index: `node_modules/@modern-js/app-tools/docs/llms.txt` — start here when unsure which page to open\n\nThese docs ship inside the package, so they match the Modern.js\nversion this project installed exactly. Your training data is likely\noutdated — **treat them as the source of truth**, and do not answer\nfrom memory on Modern.js configuration, APIs or directory conventions.\n\n**🟢 Read the docs before you touch anything, except for:**\n\n- Writing ordinary React components (not route components)\n- Editing CSS or style files\n- Adding utility functions or business logic\n- Installing ordinary npm packages (unrelated to Modern.js)\n\n<!-- END:modernjs-agent-rules -->\n",
|
|
9
|
-
"CLAUDE.md": "@AGENTS.md\n",
|
|
10
|
-
"biome.json": '{\n "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",\n "vcs": {\n "enabled": true,\n "defaultBranch": "main",\n "clientKind": "git",\n "useIgnoreFile": true\n },\n "formatter": {\n "enabled": true,\n "indentStyle": "space"\n },\n "javascript": {\n "formatter": {\n "quoteStyle": "single",\n "arrowParentheses": "asNeeded",\n "jsxQuoteStyle": "double",\n "lineWidth": 80\n }\n },\n "linter": {\n "enabled": true,\n "rules": {\n "recommended": true,\n "suspicious": {\n "noDuplicateFontNames": "off"\n }\n }\n },\n "organizeImports": {\n "enabled": true\n },\n "files": {\n "ignoreUnknown": true,\n "ignore": [".vscode/**/*", "node_modules/**/*", "dist/**/*"]\n }\n}\n',
|
|
8
|
+
"AGENTS.md": "<!-- BEGIN:modernjs-agent-rules -->\n\n# Modern.js: read the docs before you code\n\n> Documentation: **`node_modules/@modern-js/app-tools/docs/`**\n> Index: `node_modules/@modern-js/app-tools/docs/llms.txt` — start here when unsure which page to open\n\nThese docs ship inside the package, so they match the Modern.js\nversion this project installed exactly. Your training data is likely\noutdated — **treat them as the source of truth**, and do not answer\nfrom memory on Modern.js configuration, APIs or directory conventions.\n\n**🟢 Read the docs before you touch anything, except for:**\n\n- Writing ordinary React components (not route components)\n- Editing CSS or style files\n- Adding utility functions or business logic\n- Installing ordinary npm packages (unrelated to Modern.js)\n\n<!-- END:modernjs-agent-rules -->\n\n# Rstack CLI\n\nThis project uses Rstack CLI as its JS toolchain:\n\n- Read the docs linked from `node_modules/rstack/docs/llms.txt` when needed\n- Online docs: https://rstack.rs/llms.txt\n- Run `rs -h` for CLI help\n",
|
|
11
9
|
"modern.config.ts": "import { appTools, defineConfig } from '@modern-js/app-tools';\n\n// https://modernjs.dev/en/configure/app/usage\nexport default defineConfig({\n plugins: [appTools()],\n});\n",
|
|
12
|
-
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "dev": "modern dev",\n "build": "modern build",\n "serve": "modern serve"
|
|
13
|
-
"tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"baseUrl\": \"./\",\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@shared/*\": [\"./shared/*\"]\n }\n },\n \"include\": [\"src\", \"shared\", \"config\", \"modern.config.ts\", \"server\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
|
|
14
|
-
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n",
|
|
10
|
+
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "dev": "modern dev",\n "build": "modern build",\n "serve": "modern serve"\n },\n "engines": {\n "node": "^22.18.0 || >=24.3.0"\n },\n "dependencies": {\n "@modern-js/runtime": "3.10.1",\n "react": "^19.2.3",\n "react-dom": "^19.2.0"\n },\n "devDependencies": {\n "@modern-js/app-tools": "3.10.1",\n "@modern-js/tsconfig": "3.10.1",\n "typescript": "~5.7.3",\n "@types/node": "^20",\n "@types/react": "^19.1.8",\n "@types/react-dom": "^19.1.6"\n }\n}\n',
|
|
11
|
+
"tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"types\": [\"@modern-js/app-tools/types\"],\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"baseUrl\": \"./\",\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@shared/*\": [\"./shared/*\"]\n }\n },\n \"include\": [\"src\", \"shared\", \"config\", \"modern.config.ts\", \"server\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
|
|
15
12
|
"src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\n\nexport default defineRuntimeConfig({});\n",
|
|
16
|
-
"src/routes/index.css": "html,\nbody {\n padding: 0;\n margin: 0;\n font-family
|
|
13
|
+
"src/routes/index.css": "html,\nbody {\n padding: 0;\n margin: 0;\n font-family:\n PingFang SC,\n Hiragino Sans GB,\n Microsoft YaHei,\n Arial,\n sans-serif;\n background: linear-gradient(to bottom, transparent, #fff) #eceeef;\n}\n\np {\n margin: 0;\n}\n\n* {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n box-sizing: border-box;\n}\n\n.container-box {\n min-height: 100vh;\n max-width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding-top: 10px;\n}\n\nmain {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.title {\n display: flex;\n margin: 4rem 0 4rem;\n align-items: center;\n font-size: 4rem;\n font-weight: 600;\n}\n\n.logo {\n width: 6rem;\n margin: 7px 0 0 1rem;\n}\n\n.name {\n color: #4ecaff;\n}\n\n.description {\n text-align: center;\n line-height: 1.5;\n font-size: 1.3rem;\n color: #1b3a42;\n margin-bottom: 5rem;\n}\n\n.code {\n background: #fafafa;\n border-radius: 12px;\n padding: 0.6rem 0.9rem;\n font-size: 1.05rem;\n font-family:\n Menlo,\n Monaco,\n Lucida Console,\n Liberation Mono,\n DejaVu Sans Mono,\n Bitstream Vera Sans Mono,\n Courier New,\n monospace;\n}\n\n.container-box .grid {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 1100px;\n margin-top: 3rem;\n}\n\n.card {\n padding: 1.5rem;\n display: flex;\n flex-direction: column;\n justify-content: center;\n height: 100px;\n color: inherit;\n text-decoration: none;\n transition: 0.15s ease;\n width: 45%;\n}\n\n.card:hover,\n.card:focus {\n transform: scale(1.05);\n}\n\n.card h2 {\n display: flex;\n align-items: center;\n font-size: 1.5rem;\n margin: 0;\n padding: 0;\n}\n\n.card p {\n opacity: 0.6;\n font-size: 0.9rem;\n line-height: 1.5;\n margin-top: 1rem;\n}\n\n.arrow-right {\n width: 1.3rem;\n margin-left: 0.5rem;\n margin-top: 3px;\n}\n",
|
|
17
14
|
"src/routes/layout.tsx": "import { Outlet } from '@modern-js/runtime/router';\n\nexport default function Layout() {\n return (\n <div>\n <Outlet />\n </div>\n );\n}\n",
|
|
18
15
|
"src/routes/page.tsx": 'import { Helmet } from \'@modern-js/runtime/head\';\nimport \'./index.css\';\n\nconst Index = () => (\n <div className="container-box">\n <Helmet>\n <link\n rel="icon"\n type="image/x-icon"\n href="https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/favicon.ico"\n />\n </Helmet>\n <main>\n <div className="title">\n Welcome to\n <img\n className="logo"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/modern-js-logo.svg"\n alt="Modern.js Logo"\n />\n <p className="name">Modern.js</p>\n </div>\n <p className="description">\n Get started by editing <code className="code">src/routes/page.tsx</code>\n </p>\n <div className="grid">\n <a\n href="https://modernjs.dev/guides/get-started/introduction.html"\n target="_blank"\n rel="noopener noreferrer"\n className="card"\n >\n <h2>\n Guide\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Guide"\n />\n </h2>\n <p>Follow the guides to use all features of Modern.js.</p>\n </a>\n <a\n href="https://modernjs.dev/tutorials/foundations/introduction.html"\n target="_blank"\n className="card"\n rel="noreferrer"\n >\n <h2>\n Tutorials\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Tutorials"\n />\n </h2>\n <p>Learn to use Modern.js to create your first application.</p>\n </a>\n <a\n href="https://modernjs.dev/configure/app/usage.html"\n target="_blank"\n className="card"\n rel="noreferrer"\n >\n <h2>\n Config\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Config"\n />\n </h2>\n <p>Find all configuration options provided by Modern.js.</p>\n </a>\n <a\n href="https://github.com/web-infra-dev/modern.js"\n target="_blank"\n rel="noopener noreferrer"\n className="card"\n >\n <h2>\n GitHub\n <img\n className="arrow-right"\n src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"\n alt="Github"\n />\n </h2>\n <p>View the source code on GitHub; feel free to contribute.</p>\n </a>\n </div>\n </main>\n </div>\n);\n\nexport default Index;\n'
|
|
19
16
|
};
|
|
@@ -4,12 +4,9 @@ export declare const ModernTemplates: {
|
|
|
4
4
|
".gitignore": string;
|
|
5
5
|
".npmrc": string;
|
|
6
6
|
"AGENTS.md": string;
|
|
7
|
-
"CLAUDE.md": string;
|
|
8
|
-
"biome.json": string;
|
|
9
7
|
"modern.config.ts": string;
|
|
10
8
|
"package.json": string;
|
|
11
9
|
"tsconfig.json": string;
|
|
12
|
-
"src/modern-app-env.d.ts": string;
|
|
13
10
|
"src/modern.runtime.ts": string;
|
|
14
11
|
"src/routes/index.css": string;
|
|
15
12
|
"src/routes/layout.tsx": string;
|
|
@@ -3,12 +3,9 @@ export declare const MWAFiles: {
|
|
|
3
3
|
".gitignore": string;
|
|
4
4
|
".npmrc": string;
|
|
5
5
|
"AGENTS.md": string;
|
|
6
|
-
"CLAUDE.md": string;
|
|
7
|
-
"biome.json": string;
|
|
8
6
|
"modern.config.ts": string;
|
|
9
7
|
"package.json": string;
|
|
10
8
|
"tsconfig.json": string;
|
|
11
|
-
"src/modern-app-env.d.ts": string;
|
|
12
9
|
"src/modern.runtime.ts": string;
|
|
13
10
|
"src/routes/index.css": string;
|
|
14
11
|
"src/routes/layout.tsx": string;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.
|
|
18
|
+
"version": "3.10.1",
|
|
19
19
|
"types": "./dist/types/index.d.ts",
|
|
20
20
|
"main": "./dist/cjs/index.js",
|
|
21
21
|
"module": "./dist/esm/index.mjs",
|
|
@@ -35,13 +35,12 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@codesandbox/sandpack-react": "^2.20.0",
|
|
37
37
|
"@swc/helpers": "^0.5.17",
|
|
38
|
-
"react": "^19.
|
|
39
|
-
"react-dom": "^19.
|
|
38
|
+
"react": "^19.3.1",
|
|
39
|
+
"react-dom": "^19.3.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@modern-js/codesmith-api-handlebars": "2.6.9",
|
|
43
43
|
"@modern-js/codesmith-utils": "2.6.9",
|
|
44
|
-
"@rslib/core": "1.0.1",
|
|
45
44
|
"@types/node": "^20",
|
|
46
45
|
"@types/react": "^19.3.0",
|
|
47
46
|
"@types/react-dom": "^19.3.0",
|
|
@@ -49,7 +48,7 @@
|
|
|
49
48
|
"recursive-readdir": "^2.2.3",
|
|
50
49
|
"ts-node": "^10.9.2",
|
|
51
50
|
"typescript": "^5",
|
|
52
|
-
"@modern-js/create": "3.
|
|
51
|
+
"@modern-js/create": "3.10.1",
|
|
53
52
|
"@modern-js/rslib": "2.68.10"
|
|
54
53
|
},
|
|
55
54
|
"sideEffects": false,
|
|
@@ -58,8 +57,8 @@
|
|
|
58
57
|
"access": "public"
|
|
59
58
|
},
|
|
60
59
|
"scripts": {
|
|
61
|
-
"build": "ts-node scripts/template.ts &&
|
|
62
|
-
"dev": "
|
|
60
|
+
"build": "ts-node scripts/template.ts && rs lib",
|
|
61
|
+
"dev": "rs lib --watch",
|
|
63
62
|
"test": "rstest --passWithNoTests"
|
|
64
63
|
}
|
|
65
64
|
}
|
package/scripts/template.ts
CHANGED
|
@@ -7,8 +7,9 @@ const IgnoreFiles = [
|
|
|
7
7
|
'.nvmrc',
|
|
8
8
|
'.vscode/extensions.json',
|
|
9
9
|
'.vscode/settings.json',
|
|
10
|
-
'.
|
|
10
|
+
'.rstack/hooks/pre-commit',
|
|
11
11
|
'README.md',
|
|
12
|
+
'rstack.config.mts',
|
|
12
13
|
];
|
|
13
14
|
|
|
14
15
|
export async function handleTemplate(
|
|
@@ -68,6 +69,8 @@ async function handleCreateTemplate() {
|
|
|
68
69
|
const files = await handleTemplate(templateDir, {
|
|
69
70
|
packageName: 'modern-app',
|
|
70
71
|
version,
|
|
72
|
+
// Online demos omit repository-level linting and formatting tools.
|
|
73
|
+
isSubproject: true,
|
|
71
74
|
});
|
|
72
75
|
|
|
73
76
|
return files;
|
package/rslib.config.mts
DELETED