@modern-js/sandpack-react 2.60.6 → 2.61.0
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/dist/cjs/templates/common.js +1 -1
- package/dist/cjs/templates/index.js +1 -3
- package/dist/cjs/templates/mwa.js +1 -1
- package/dist/esm/templates/common.js +1 -1
- package/dist/esm/templates/index.js +1 -3
- package/dist/esm/templates/mwa.js +1 -1
- package/dist/esm-node/templates/common.js +1 -1
- package/dist/esm-node/templates/index.js +1 -3
- package/dist/esm-node/templates/mwa.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/templates/common.d.ts +1 -1
- package/dist/types/templates/index.d.ts +0 -1
- package/dist/types/templates/mwa.d.ts +1 -1
- package/package.json +8 -9
- package/scripts/template.ts +0 -34
- package/dist/cjs/templates/module.js +0 -40
- package/dist/esm/templates/module.js +0 -14
- package/dist/esm-node/templates/module.js +0 -16
- package/dist/types/templates/module.d.ts +0 -14
|
@@ -24,8 +24,8 @@ module.exports = __toCommonJS(common_exports);
|
|
|
24
24
|
const commonFiles = {
|
|
25
25
|
".codesandbox/environment.json": '{\n "nodeVersion": 18\n}\n',
|
|
26
26
|
".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 start",\n "runAtStart": true,\n "restartOn": {\n "files": ["pnpm-lock.yaml"]\n }\n }\n }\n}\n',
|
|
27
|
-
".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",
|
|
28
27
|
"biome.json": '{\n "$schema": "https://biomejs.dev/schemas/1.8.3/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 }\n },\n "organizeImports": {\n "enabled": true\n },\n "files": {\n "ignoreUnknown": true,\n "ignore": [".vscode/**/*", "node_modules/**/*", "dist/**/*"]\n }\n}\n',
|
|
28
|
+
".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",
|
|
29
29
|
".npmrc": "strict-peer-dependencies=false\n"
|
|
30
30
|
};
|
|
31
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -21,11 +21,9 @@ __export(templates_exports, {
|
|
|
21
21
|
ModernTemplates: () => ModernTemplates
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(templates_exports);
|
|
24
|
-
const { ModuleFiles } = require("./module");
|
|
25
24
|
const { MWAFiles } = require("./mwa");
|
|
26
25
|
const ModernTemplates = {
|
|
27
|
-
"web-app": MWAFiles
|
|
28
|
-
"npm-module": ModuleFiles
|
|
26
|
+
"web-app": MWAFiles
|
|
29
27
|
};
|
|
30
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
29
|
0 && (module.exports = {
|
|
@@ -27,7 +27,7 @@ const MWAFiles = {
|
|
|
27
27
|
...{
|
|
28
28
|
".browserslistrc": "chrome >= 51\nedge >= 15\nfirefox >= 54\nsafari >= 10\nios_saf >= 10\n",
|
|
29
29
|
"README.md": "# Modern.js App\n\n## Setup\n\nInstall the dependencies:\n\n```bash\npnpm install\n```\n\n## Get Started\n\nStart the dev server:\n\n```bash\npnpm dev\n```\n\nEnable optional features or add a new entry:\n\n```bash\npnpm new\n```\n\nBuild the app for production:\n\n```bash\npnpm build\n```\n\nPreview the production build locally:\n\n```bash\npnpm serve\n```\n\nFor more information, see the [Modern.js documentation](https://modernjs.dev/en).\n",
|
|
30
|
-
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "reset": "npx rimraf node_modules ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "biome check",\n "prepare": "simple-git-hooks",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "biome check --files-ignore-unknown=true"\n ]\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "dependencies": {\n "@modern-js/runtime": "2.60.
|
|
30
|
+
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "reset": "npx rimraf node_modules ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "biome check",\n "prepare": "simple-git-hooks",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "biome check --files-ignore-unknown=true"\n ]\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "dependencies": {\n "@modern-js/runtime": "2.60.6",\n "react": "^18.3.1",\n "react-dom": "^18.3.1"\n },\n "devDependencies": {\n "@modern-js/app-tools": "2.60.6",\n "@modern-js/tsconfig": "2.60.6",\n "@biomejs/biome": "1.8.3",\n "typescript": "~5.0.4",\n "@types/jest": "~29.2.4",\n "@types/node": "~18.11.9",\n "@types/react": "^18.3.11",\n "@types/react-dom": "~18.3.1",\n "lint-staged": "~13.1.0",\n "simple-git-hooks": "^2.11.1",\n "rimraf": "^6.0.1"\n }\n}\n',
|
|
31
31
|
"modern.config.ts": "import { appTools, defineConfig } from '@modern-js/app-tools';\n\n// https://modernjs.dev/en/configure/app/usage\nexport default defineConfig({\n runtime: {\n router: true,\n },\n plugins: [\n appTools({\n bundler: \n }),\n ],\n});\n",
|
|
32
32
|
"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"],\n "exclude": ["**/node_modules"]\n}\n',
|
|
33
33
|
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n/// <reference types='@modern-js/runtime/types' />\n/// <reference types='@modern-js/runtime/types/router' />\n",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var commonFiles = {
|
|
2
2
|
".codesandbox/environment.json": '{\n "nodeVersion": 18\n}\n',
|
|
3
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 start",\n "runAtStart": true,\n "restartOn": {\n "files": ["pnpm-lock.yaml"]\n }\n }\n }\n}\n',
|
|
4
|
-
".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",
|
|
5
4
|
"biome.json": '{\n "$schema": "https://biomejs.dev/schemas/1.8.3/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 }\n },\n "organizeImports": {\n "enabled": true\n },\n "files": {\n "ignoreUnknown": true,\n "ignore": [".vscode/**/*", "node_modules/**/*", "dist/**/*"]\n }\n}\n',
|
|
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
7
|
};
|
|
8
8
|
export {
|
|
@@ -3,7 +3,7 @@ import { commonFiles } from "./common";
|
|
|
3
3
|
var MWAFiles = _object_spread({}, commonFiles, {
|
|
4
4
|
".browserslistrc": "chrome >= 51\nedge >= 15\nfirefox >= 54\nsafari >= 10\nios_saf >= 10\n",
|
|
5
5
|
"README.md": "# Modern.js App\n\n## Setup\n\nInstall the dependencies:\n\n```bash\npnpm install\n```\n\n## Get Started\n\nStart the dev server:\n\n```bash\npnpm dev\n```\n\nEnable optional features or add a new entry:\n\n```bash\npnpm new\n```\n\nBuild the app for production:\n\n```bash\npnpm build\n```\n\nPreview the production build locally:\n\n```bash\npnpm serve\n```\n\nFor more information, see the [Modern.js documentation](https://modernjs.dev/en).\n",
|
|
6
|
-
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "reset": "npx rimraf node_modules ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "biome check",\n "prepare": "simple-git-hooks",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "biome check --files-ignore-unknown=true"\n ]\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "dependencies": {\n "@modern-js/runtime": "2.60.
|
|
6
|
+
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "reset": "npx rimraf node_modules ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "biome check",\n "prepare": "simple-git-hooks",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "biome check --files-ignore-unknown=true"\n ]\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "dependencies": {\n "@modern-js/runtime": "2.60.6",\n "react": "^18.3.1",\n "react-dom": "^18.3.1"\n },\n "devDependencies": {\n "@modern-js/app-tools": "2.60.6",\n "@modern-js/tsconfig": "2.60.6",\n "@biomejs/biome": "1.8.3",\n "typescript": "~5.0.4",\n "@types/jest": "~29.2.4",\n "@types/node": "~18.11.9",\n "@types/react": "^18.3.11",\n "@types/react-dom": "~18.3.1",\n "lint-staged": "~13.1.0",\n "simple-git-hooks": "^2.11.1",\n "rimraf": "^6.0.1"\n }\n}\n',
|
|
7
7
|
"modern.config.ts": "import { appTools, defineConfig } from '@modern-js/app-tools';\n\n// https://modernjs.dev/en/configure/app/usage\nexport default defineConfig({\n runtime: {\n router: true,\n },\n plugins: [\n appTools({\n bundler: \n }),\n ],\n});\n",
|
|
8
8
|
"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"],\n "exclude": ["**/node_modules"]\n}\n',
|
|
9
9
|
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n/// <reference types='@modern-js/runtime/types' />\n/// <reference types='@modern-js/runtime/types/router' />\n",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const commonFiles = {
|
|
2
2
|
".codesandbox/environment.json": '{\n "nodeVersion": 18\n}\n',
|
|
3
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 start",\n "runAtStart": true,\n "restartOn": {\n "files": ["pnpm-lock.yaml"]\n }\n }\n }\n}\n',
|
|
4
|
-
".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",
|
|
5
4
|
"biome.json": '{\n "$schema": "https://biomejs.dev/schemas/1.8.3/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 }\n },\n "organizeImports": {\n "enabled": true\n },\n "files": {\n "ignoreUnknown": true,\n "ignore": [".vscode/**/*", "node_modules/**/*", "dist/**/*"]\n }\n}\n',
|
|
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
7
|
};
|
|
8
8
|
export {
|
|
@@ -4,7 +4,7 @@ const MWAFiles = {
|
|
|
4
4
|
...{
|
|
5
5
|
".browserslistrc": "chrome >= 51\nedge >= 15\nfirefox >= 54\nsafari >= 10\nios_saf >= 10\n",
|
|
6
6
|
"README.md": "# Modern.js App\n\n## Setup\n\nInstall the dependencies:\n\n```bash\npnpm install\n```\n\n## Get Started\n\nStart the dev server:\n\n```bash\npnpm dev\n```\n\nEnable optional features or add a new entry:\n\n```bash\npnpm new\n```\n\nBuild the app for production:\n\n```bash\npnpm build\n```\n\nPreview the production build locally:\n\n```bash\npnpm serve\n```\n\nFor more information, see the [Modern.js documentation](https://modernjs.dev/en).\n",
|
|
7
|
-
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "reset": "npx rimraf node_modules ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "biome check",\n "prepare": "simple-git-hooks",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "biome check --files-ignore-unknown=true"\n ]\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "dependencies": {\n "@modern-js/runtime": "2.60.
|
|
7
|
+
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "reset": "npx rimraf node_modules ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "biome check",\n "prepare": "simple-git-hooks",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "biome check --files-ignore-unknown=true"\n ]\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "dependencies": {\n "@modern-js/runtime": "2.60.6",\n "react": "^18.3.1",\n "react-dom": "^18.3.1"\n },\n "devDependencies": {\n "@modern-js/app-tools": "2.60.6",\n "@modern-js/tsconfig": "2.60.6",\n "@biomejs/biome": "1.8.3",\n "typescript": "~5.0.4",\n "@types/jest": "~29.2.4",\n "@types/node": "~18.11.9",\n "@types/react": "^18.3.11",\n "@types/react-dom": "~18.3.1",\n "lint-staged": "~13.1.0",\n "simple-git-hooks": "^2.11.1",\n "rimraf": "^6.0.1"\n }\n}\n',
|
|
8
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 runtime: {\n router: true,\n },\n plugins: [\n appTools({\n bundler: \n }),\n ],\n});\n",
|
|
9
9
|
"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"],\n "exclude": ["**/node_modules"]\n}\n',
|
|
10
10
|
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n/// <reference types='@modern-js/runtime/types' />\n/// <reference types='@modern-js/runtime/types/router' />\n",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type SandpackFiles, type SandpackSetup, type SandpackThemeProp } from '@codesandbox/sandpack-react';
|
|
3
3
|
export type ModernSandpackProps = {
|
|
4
|
-
template: 'web-app'
|
|
4
|
+
template: 'web-app';
|
|
5
5
|
customSetup?: SandpackSetup;
|
|
6
6
|
files?: SandpackFiles;
|
|
7
7
|
removeFiles?: string[];
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.61.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -48,14 +48,13 @@
|
|
|
48
48
|
"recursive-readdir": "^2.2.3",
|
|
49
49
|
"ts-node": "^10.9.1",
|
|
50
50
|
"typescript": "^5",
|
|
51
|
-
"@modern-js/base-generator": "3.7.
|
|
52
|
-
"@modern-js/entry-generator": "3.7.
|
|
53
|
-
"@modern-js/generator-
|
|
54
|
-
"@modern-js/generator-
|
|
55
|
-
"@modern-js/
|
|
56
|
-
"@
|
|
57
|
-
"@scripts/jest-config": "2.
|
|
58
|
-
"@scripts/build": "2.60.6"
|
|
51
|
+
"@modern-js/base-generator": "3.7.3",
|
|
52
|
+
"@modern-js/entry-generator": "3.7.3",
|
|
53
|
+
"@modern-js/generator-common": "3.7.3",
|
|
54
|
+
"@modern-js/generator-utils": "3.7.3",
|
|
55
|
+
"@modern-js/mwa-generator": "3.7.3",
|
|
56
|
+
"@scripts/build": "2.61.0",
|
|
57
|
+
"@scripts/jest-config": "2.61.0"
|
|
59
58
|
},
|
|
60
59
|
"sideEffects": false,
|
|
61
60
|
"publishConfig": {
|
package/scripts/template.ts
CHANGED
|
@@ -102,28 +102,6 @@ async function handleMWATemplate() {
|
|
|
102
102
|
return files;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
async function handleModuleTemplate() {
|
|
106
|
-
const templateDir = path.join(
|
|
107
|
-
require.resolve('@modern-js/module-generator'),
|
|
108
|
-
'../../',
|
|
109
|
-
'templates',
|
|
110
|
-
);
|
|
111
|
-
const baseTemplate = path.join(templateDir, 'base-template');
|
|
112
|
-
const tsTemplate = path.join(templateDir, 'ts-template');
|
|
113
|
-
const modernVersion = await getModernVersion(Solution.Module);
|
|
114
|
-
const files = {
|
|
115
|
-
...(await handleTemplate(baseTemplate, {
|
|
116
|
-
name: 'modern-npm-module',
|
|
117
|
-
isMonorepoSubProject: false,
|
|
118
|
-
modernVersion,
|
|
119
|
-
isTs: true,
|
|
120
|
-
language: 'ts',
|
|
121
|
-
packageManager: 'pnpm',
|
|
122
|
-
})),
|
|
123
|
-
...(await handleTemplate(tsTemplate)),
|
|
124
|
-
};
|
|
125
|
-
return files;
|
|
126
|
-
}
|
|
127
105
|
async function main() {
|
|
128
106
|
const codesandboxFiles = await handleCodesandboxTemplate();
|
|
129
107
|
const baseFiles = await handleBaseTemplate();
|
|
@@ -142,18 +120,6 @@ async function main() {
|
|
|
142
120
|
export const MWAFiles = {
|
|
143
121
|
...commonFiles,
|
|
144
122
|
...${JSON.stringify(mwaFiles, null, 2)}
|
|
145
|
-
};`,
|
|
146
|
-
'utf-8',
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
const moduleFiles = await handleModuleTemplate();
|
|
150
|
-
fs.writeFileSync(
|
|
151
|
-
path.join(srcTemplatesDir, 'module.ts'),
|
|
152
|
-
`import { commonFiles } from './common';
|
|
153
|
-
|
|
154
|
-
export const ModuleFiles = {
|
|
155
|
-
...commonFiles,
|
|
156
|
-
...${JSON.stringify(moduleFiles, null, 2)}
|
|
157
123
|
};`,
|
|
158
124
|
'utf-8',
|
|
159
125
|
);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var module_exports = {};
|
|
20
|
-
__export(module_exports, {
|
|
21
|
-
ModuleFiles: () => ModuleFiles
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(module_exports);
|
|
24
|
-
var import_common = require("./common");
|
|
25
|
-
const ModuleFiles = {
|
|
26
|
-
...import_common.commonFiles,
|
|
27
|
-
...{
|
|
28
|
-
".npmignore": ".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*.tsbuildinfo\n\ncoverage/\nrelease/\noutput/\noutput_resource/\ntests/\n\n.vscode/**/*\n!.vscode/settings.json\n!.vscode/extensions.json\n.idea/\n\nsrc/\n\nmodern.config.*\njest.config.js\ntsconfig.json\nCHANGELOG.md\n\n**/*/api/typings/auto-generated\n",
|
|
29
|
-
"README.md": "# Modern.js Package\n\n## Setup\n\nInstall the dependencies:\n\n```bash\npnpm install\n```\n\n## Get Started\n\nRun and debug the module:\n\n```bash\npnpm dev\n```\n\nBuild the module for production:\n\n```bash\npnpm build\n```\n\nEnable optional features:\n\n```bash\npnpm new\n```\n\nOther commands:\n\n```bash\npnpm lint # Lint and fix source files\npnpm change # Add a new changeset\npnpm bump # Update version and changelog via changeset\npnpm release # Release the package\n```\n\nFor more information, see the [Modern.js Module documentation](https://modernjs.dev/module-tools/en).\n",
|
|
30
|
-
"package.json": '{\n "name": "modern-npm-module",\n "version": "0.1.0",\n "types": "./dist/types/index.d.ts",\n "main": "./dist/lib/index.js",\n "module": "./dist/es/index.js",\n "scripts": {\n "prepare": "modern build && simple-git-hooks",\n "dev": "modern dev",\n "build": "modern build",\n "build:watch": "modern build -w",\n "reset": "npx rimraf node_modules ./**/node_modules",\n "lint": "biome check",\n "change": "modern change",\n "bump": "modern bump",\n "pre": "modern pre",\n "change-status": "modern change-status",\n "gen-release-note": "modern gen-release-note",\n "release": "modern release",\n "new": "modern new",\n "upgrade": "modern upgrade"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "biome check --files-ignore-unknown=true"\n ]\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "dependencies": {},\n "peerDependencies": {},\n "devDependencies": {\n "@modern-js/module-tools": "2.60.5",\n "@biomejs/biome": "1.8.3",\n "typescript": "~5.0.4",\n "@types/node": "~18.11.9",\n "rimraf": "^6.0.1",\n "lint-staged": "~13.1.0",\n "simple-git-hooks": "^2.11.1"\n },\n "sideEffects": [],\n "publishConfig": {\n "access": "public",\n "registry": "https://registry.npmjs.org/"\n }\n}\n',
|
|
31
|
-
"src/index.ts": "export default function () {\n return 'hello world';\n}\n",
|
|
32
|
-
"modern.config.ts": "import { defineConfig, moduleTools } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n});\n",
|
|
33
|
-
"tsconfig.json": '{\n "compilerOptions": {\n "allowJs": true,\n "baseUrl": ".",\n "declaration": true,\n "emitDeclarationOnly": true,\n "esModuleInterop": true,\n "forceConsistentCasingInFileNames": true,\n "isolatedModules": true,\n "jsx": "preserve",\n "lib": ["DOM", "ESNext"],\n "moduleResolution": "node",\n "paths": {\n "@/*": ["./src/*"]\n },\n "resolveJsonModule": true,\n "rootDir": "src",\n "skipLibCheck": true,\n "strict": true\n },\n "exclude": ["**/node_modules"],\n "include": ["src"]\n}\n',
|
|
34
|
-
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/module-tools/types' />\n"
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
ModuleFiles
|
|
40
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
-
import { commonFiles } from "./common";
|
|
3
|
-
var ModuleFiles = _object_spread({}, commonFiles, {
|
|
4
|
-
".npmignore": ".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*.tsbuildinfo\n\ncoverage/\nrelease/\noutput/\noutput_resource/\ntests/\n\n.vscode/**/*\n!.vscode/settings.json\n!.vscode/extensions.json\n.idea/\n\nsrc/\n\nmodern.config.*\njest.config.js\ntsconfig.json\nCHANGELOG.md\n\n**/*/api/typings/auto-generated\n",
|
|
5
|
-
"README.md": "# Modern.js Package\n\n## Setup\n\nInstall the dependencies:\n\n```bash\npnpm install\n```\n\n## Get Started\n\nRun and debug the module:\n\n```bash\npnpm dev\n```\n\nBuild the module for production:\n\n```bash\npnpm build\n```\n\nEnable optional features:\n\n```bash\npnpm new\n```\n\nOther commands:\n\n```bash\npnpm lint # Lint and fix source files\npnpm change # Add a new changeset\npnpm bump # Update version and changelog via changeset\npnpm release # Release the package\n```\n\nFor more information, see the [Modern.js Module documentation](https://modernjs.dev/module-tools/en).\n",
|
|
6
|
-
"package.json": '{\n "name": "modern-npm-module",\n "version": "0.1.0",\n "types": "./dist/types/index.d.ts",\n "main": "./dist/lib/index.js",\n "module": "./dist/es/index.js",\n "scripts": {\n "prepare": "modern build && simple-git-hooks",\n "dev": "modern dev",\n "build": "modern build",\n "build:watch": "modern build -w",\n "reset": "npx rimraf node_modules ./**/node_modules",\n "lint": "biome check",\n "change": "modern change",\n "bump": "modern bump",\n "pre": "modern pre",\n "change-status": "modern change-status",\n "gen-release-note": "modern gen-release-note",\n "release": "modern release",\n "new": "modern new",\n "upgrade": "modern upgrade"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "biome check --files-ignore-unknown=true"\n ]\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "dependencies": {},\n "peerDependencies": {},\n "devDependencies": {\n "@modern-js/module-tools": "2.60.5",\n "@biomejs/biome": "1.8.3",\n "typescript": "~5.0.4",\n "@types/node": "~18.11.9",\n "rimraf": "^6.0.1",\n "lint-staged": "~13.1.0",\n "simple-git-hooks": "^2.11.1"\n },\n "sideEffects": [],\n "publishConfig": {\n "access": "public",\n "registry": "https://registry.npmjs.org/"\n }\n}\n',
|
|
7
|
-
"src/index.ts": "export default function () {\n return 'hello world';\n}\n",
|
|
8
|
-
"modern.config.ts": "import { defineConfig, moduleTools } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n});\n",
|
|
9
|
-
"tsconfig.json": '{\n "compilerOptions": {\n "allowJs": true,\n "baseUrl": ".",\n "declaration": true,\n "emitDeclarationOnly": true,\n "esModuleInterop": true,\n "forceConsistentCasingInFileNames": true,\n "isolatedModules": true,\n "jsx": "preserve",\n "lib": ["DOM", "ESNext"],\n "moduleResolution": "node",\n "paths": {\n "@/*": ["./src/*"]\n },\n "resolveJsonModule": true,\n "rootDir": "src",\n "skipLibCheck": true,\n "strict": true\n },\n "exclude": ["**/node_modules"],\n "include": ["src"]\n}\n',
|
|
10
|
-
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/module-tools/types' />\n"
|
|
11
|
-
});
|
|
12
|
-
export {
|
|
13
|
-
ModuleFiles
|
|
14
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { commonFiles } from "./common";
|
|
2
|
-
const ModuleFiles = {
|
|
3
|
-
...commonFiles,
|
|
4
|
-
...{
|
|
5
|
-
".npmignore": ".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*.tsbuildinfo\n\ncoverage/\nrelease/\noutput/\noutput_resource/\ntests/\n\n.vscode/**/*\n!.vscode/settings.json\n!.vscode/extensions.json\n.idea/\n\nsrc/\n\nmodern.config.*\njest.config.js\ntsconfig.json\nCHANGELOG.md\n\n**/*/api/typings/auto-generated\n",
|
|
6
|
-
"README.md": "# Modern.js Package\n\n## Setup\n\nInstall the dependencies:\n\n```bash\npnpm install\n```\n\n## Get Started\n\nRun and debug the module:\n\n```bash\npnpm dev\n```\n\nBuild the module for production:\n\n```bash\npnpm build\n```\n\nEnable optional features:\n\n```bash\npnpm new\n```\n\nOther commands:\n\n```bash\npnpm lint # Lint and fix source files\npnpm change # Add a new changeset\npnpm bump # Update version and changelog via changeset\npnpm release # Release the package\n```\n\nFor more information, see the [Modern.js Module documentation](https://modernjs.dev/module-tools/en).\n",
|
|
7
|
-
"package.json": '{\n "name": "modern-npm-module",\n "version": "0.1.0",\n "types": "./dist/types/index.d.ts",\n "main": "./dist/lib/index.js",\n "module": "./dist/es/index.js",\n "scripts": {\n "prepare": "modern build && simple-git-hooks",\n "dev": "modern dev",\n "build": "modern build",\n "build:watch": "modern build -w",\n "reset": "npx rimraf node_modules ./**/node_modules",\n "lint": "biome check",\n "change": "modern change",\n "bump": "modern bump",\n "pre": "modern pre",\n "change-status": "modern change-status",\n "gen-release-note": "modern gen-release-note",\n "release": "modern release",\n "new": "modern new",\n "upgrade": "modern upgrade"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "biome check --files-ignore-unknown=true"\n ]\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "dependencies": {},\n "peerDependencies": {},\n "devDependencies": {\n "@modern-js/module-tools": "2.60.5",\n "@biomejs/biome": "1.8.3",\n "typescript": "~5.0.4",\n "@types/node": "~18.11.9",\n "rimraf": "^6.0.1",\n "lint-staged": "~13.1.0",\n "simple-git-hooks": "^2.11.1"\n },\n "sideEffects": [],\n "publishConfig": {\n "access": "public",\n "registry": "https://registry.npmjs.org/"\n }\n}\n',
|
|
8
|
-
"src/index.ts": "export default function () {\n return 'hello world';\n}\n",
|
|
9
|
-
"modern.config.ts": "import { defineConfig, moduleTools } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n});\n",
|
|
10
|
-
"tsconfig.json": '{\n "compilerOptions": {\n "allowJs": true,\n "baseUrl": ".",\n "declaration": true,\n "emitDeclarationOnly": true,\n "esModuleInterop": true,\n "forceConsistentCasingInFileNames": true,\n "isolatedModules": true,\n "jsx": "preserve",\n "lib": ["DOM", "ESNext"],\n "moduleResolution": "node",\n "paths": {\n "@/*": ["./src/*"]\n },\n "resolveJsonModule": true,\n "rootDir": "src",\n "skipLibCheck": true,\n "strict": true\n },\n "exclude": ["**/node_modules"],\n "include": ["src"]\n}\n',
|
|
11
|
-
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/module-tools/types' />\n"
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
ModuleFiles
|
|
16
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const ModuleFiles: {
|
|
2
|
-
".npmignore": string;
|
|
3
|
-
"README.md": string;
|
|
4
|
-
"package.json": string;
|
|
5
|
-
"src/index.ts": string;
|
|
6
|
-
"modern.config.ts": string;
|
|
7
|
-
"tsconfig.json": string;
|
|
8
|
-
"src/modern-app-env.d.ts": string;
|
|
9
|
-
".codesandbox/environment.json": string;
|
|
10
|
-
".codesandbox/tasks.json": string;
|
|
11
|
-
".gitignore": string;
|
|
12
|
-
"biome.json": string;
|
|
13
|
-
".npmrc": string;
|
|
14
|
-
};
|