@modern-js/sandpack-react 2.35.1 → 2.37.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/index.js +30 -17
- package/dist/cjs/templates/common.js +24 -7
- package/dist/cjs/templates/index.js +24 -7
- package/dist/cjs/templates/module.js +27 -10
- package/dist/cjs/templates/mwa.js +27 -10
- package/dist/esm/index.js +7 -4
- package/dist/esm/templates/common.js +4 -1
- package/dist/esm/templates/index.js +4 -1
- package/dist/esm/templates/module.js +5 -2
- package/dist/esm/templates/mwa.js +98 -3
- package/dist/esm-node/index.js +4 -1
- package/dist/esm-node/templates/common.js +4 -1
- package/dist/esm-node/templates/index.js +4 -1
- package/dist/esm-node/templates/module.js +5 -2
- package/dist/esm-node/templates/mwa.js +5 -2
- package/package.json +10 -10
- package/scripts/template.ts +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 });
|
|
9
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var src_exports = {};
|
|
20
|
+
__export(src_exports, {
|
|
21
|
+
default: () => ModernSandpack
|
|
10
22
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
module.exports = __toCommonJS(src_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_sandpack_react = require("@codesandbox/sandpack-react");
|
|
26
|
+
var import_templates = require("./templates");
|
|
14
27
|
function fileterFiles(files, removeFiles) {
|
|
15
28
|
if (removeFiles.length === 0) {
|
|
16
29
|
return files;
|
|
@@ -25,12 +38,12 @@ function fileterFiles(files, removeFiles) {
|
|
|
25
38
|
}
|
|
26
39
|
function ModernSandpack(props) {
|
|
27
40
|
const { template, customSetup = {}, files: customFiles = {}, removeFiles = [], options = {}, initialCollapsedFolder = [], activeFile = "src/routes/page.tsx", theme = "light" } = props;
|
|
28
|
-
const initFiles =
|
|
41
|
+
const initFiles = import_templates.ModernTemplates[template];
|
|
29
42
|
const files = {
|
|
30
43
|
...fileterFiles(initFiles, removeFiles),
|
|
31
44
|
...fileterFiles(customFiles, removeFiles)
|
|
32
45
|
};
|
|
33
|
-
return /* @__PURE__ */ (0,
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sandpack_react.SandpackProvider, {
|
|
34
47
|
theme,
|
|
35
48
|
customSetup: {
|
|
36
49
|
environment: "node",
|
|
@@ -42,9 +55,9 @@ function ModernSandpack(props) {
|
|
|
42
55
|
visibleFiles: Object.keys(customFiles).filter((file) => !removeFiles.includes(file)),
|
|
43
56
|
...options
|
|
44
57
|
},
|
|
45
|
-
children: /* @__PURE__ */ (0,
|
|
58
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sandpack_react.SandpackLayout, {
|
|
46
59
|
children: [
|
|
47
|
-
/* @__PURE__ */ (0,
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sandpack_react.SandpackFileExplorer, {
|
|
48
61
|
autoHiddenFiles: true,
|
|
49
62
|
initialCollapsedFolder: [
|
|
50
63
|
"/.husky/",
|
|
@@ -53,19 +66,19 @@ function ModernSandpack(props) {
|
|
|
53
66
|
...initialCollapsedFolder
|
|
54
67
|
]
|
|
55
68
|
}),
|
|
56
|
-
/* @__PURE__ */ (0,
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sandpack_react.SandpackCodeEditor, {
|
|
57
70
|
showLineNumbers: true,
|
|
58
71
|
showInlineErrors: true,
|
|
59
72
|
readOnly: true,
|
|
60
73
|
showTabs: false
|
|
61
74
|
}),
|
|
62
|
-
/* @__PURE__ */ (0,
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
63
76
|
style: {
|
|
64
77
|
position: "absolute",
|
|
65
78
|
right: "5px",
|
|
66
79
|
bottom: "5px"
|
|
67
80
|
},
|
|
68
|
-
children: /* @__PURE__ */ (0,
|
|
81
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sandpack_react.OpenInCodeSandboxButton, {})
|
|
69
82
|
})
|
|
70
83
|
]
|
|
71
84
|
})
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 });
|
|
9
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var common_exports = {};
|
|
20
|
+
__export(common_exports, {
|
|
21
|
+
commonFiles: () => commonFiles
|
|
10
22
|
});
|
|
23
|
+
module.exports = __toCommonJS(common_exports);
|
|
11
24
|
const commonFiles = {
|
|
12
25
|
".codesandbox/environment.json": '{\n "nodeVersion": 18\n}\n',
|
|
13
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',
|
|
14
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.eslintcache\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",
|
|
15
28
|
".npmrc": "strict-peer-dependencies=false\n"
|
|
16
29
|
};
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
commonFiles
|
|
33
|
+
});
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 });
|
|
9
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var templates_exports = {};
|
|
20
|
+
__export(templates_exports, {
|
|
21
|
+
ModernTemplates: () => ModernTemplates
|
|
10
22
|
});
|
|
23
|
+
module.exports = __toCommonJS(templates_exports);
|
|
11
24
|
const { ModuleFiles } = require("./module");
|
|
12
25
|
const { MWAFiles } = require("./mwa");
|
|
13
26
|
const ModernTemplates = {
|
|
14
27
|
"web-app": MWAFiles,
|
|
15
28
|
"npm-module": ModuleFiles
|
|
16
29
|
};
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
ModernTemplates
|
|
33
|
+
});
|
|
@@ -1,23 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 });
|
|
9
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
|
|
10
22
|
});
|
|
11
|
-
|
|
23
|
+
module.exports = __toCommonJS(module_exports);
|
|
24
|
+
var import_common = require("./common");
|
|
12
25
|
const ModuleFiles = {
|
|
13
|
-
...
|
|
26
|
+
...import_common.commonFiles,
|
|
14
27
|
...{
|
|
15
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.eslintcache\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\n.eslintrc.js\n.eslintrc\ntsconfig.json\nCHANGELOG.md\n\n**/*/api/typings/auto-generated\n",
|
|
16
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\nRun test cases:\n\n```bash\npnpm test\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",
|
|
17
|
-
"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 && husky install",\n "dev": "modern dev",\n "build": "modern build",\n "build:watch": "modern build -w",\n "reset": "rimraf ./**/node_modules",\n "lint": "modern lint",\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,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {},\n "peerDependencies": {},\n "devDependencies": {\n "@modern-js/module-tools": "2.
|
|
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 && husky install",\n "dev": "modern dev",\n "build": "modern build",\n "build:watch": "modern build -w",\n "reset": "rimraf ./**/node_modules",\n "lint": "modern lint",\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,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {},\n "peerDependencies": {},\n "devDependencies": {\n "@modern-js/module-tools": "2.36.0",\n "@modern-js/eslint-config": "2.36.0",\n "@modern-js/tsconfig":"2.36.0",\n "@modern-js-app/eslint-config": "2.36.0",\n "typescript": "~5.0.4",\n "@types/jest": "~29.2.4",\n "@types/node": "~16.11.7",\n "@types/react": "~18.0.26",\n "rimraf": "~3.0.2",\n "lint-staged": "~13.1.0",\n "prettier": "~2.8.1",\n "husky": "~8.0.1"\n },\n "sideEffects": [],\n "publishConfig": {\n "access": "public",\n "registry": "https://registry.npmjs.org/"\n }\n}\n',
|
|
18
31
|
"src/index.ts": "export default function () {\n return 'hello world';\n}\n",
|
|
19
32
|
"modern.config.ts": "import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n});\n",
|
|
20
33
|
"tsconfig.json": '{\n "extends": "@modern-js/tsconfig/base",\n "declaration": true,\n "compilerOptions": {\n "baseUrl": "./",\n "paths": {\n "@/*": ["./src/*"]\n },\n "isolatedModules": true\n },\n "include": ["src"],\n "exclude": ["**/node_modules"]\n}\n',
|
|
21
34
|
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/module-tools/types' />\n/// <reference types='@modern-js/plugin-testing/types' />\n"
|
|
22
35
|
}
|
|
23
36
|
};
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
ModuleFiles
|
|
40
|
+
});
|
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 });
|
|
9
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var mwa_exports = {};
|
|
20
|
+
__export(mwa_exports, {
|
|
21
|
+
MWAFiles: () => MWAFiles
|
|
10
22
|
});
|
|
11
|
-
|
|
23
|
+
module.exports = __toCommonJS(mwa_exports);
|
|
24
|
+
var import_common = require("./common");
|
|
12
25
|
const MWAFiles = {
|
|
13
|
-
...
|
|
26
|
+
...import_common.commonFiles,
|
|
14
27
|
...{
|
|
15
28
|
".browserslistrc": "chrome >= 51\nedge >= 15\nfirefox >= 54\nsafari >= 10\nios_saf >= 10\n",
|
|
16
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",
|
|
17
|
-
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "reset": "npx rimraf ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "modern lint",\n "prepare": "husky install",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {\n "@modern-js/runtime": "2.
|
|
30
|
+
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "reset": "npx rimraf ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "modern lint",\n "prepare": "husky install",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {\n "@modern-js/runtime": "2.36.0",\n "react": "~18.2.0",\n "react-dom": "~18.2.0"\n },\n "devDependencies": {\n "@modern-js/app-tools": "2.36.0",\n "@modern-js/eslint-config": "2.36.0",\n "@modern-js/tsconfig":"2.36.0",\n "@modern-js-app/eslint-config": "2.36.0",\n "typescript": "~5.0.4",\n "@types/jest": "~29.2.4",\n "@types/node": "~16.11.7",\n "@types/react": "~18.0.26",\n "@types/react-dom": "~18.0.10",\n "lint-staged": "~13.1.0",\n "prettier": "~2.8.1",\n "husky": "~8.0.1",\n "rimraf": "~3.0.2"\n }\n}\n',
|
|
18
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: [appTools()],\n});\n",
|
|
19
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',
|
|
20
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",
|
|
@@ -115,3 +128,7 @@ export default Index;
|
|
|
115
128
|
`
|
|
116
129
|
}
|
|
117
130
|
};
|
|
131
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
132
|
+
0 && (module.exports = {
|
|
133
|
+
MWAFiles
|
|
134
|
+
});
|
package/dist/esm/index.js
CHANGED
|
@@ -15,18 +15,18 @@ function fileterFiles(files, removeFiles) {
|
|
|
15
15
|
});
|
|
16
16
|
return result;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
function ModernSandpack(props) {
|
|
19
19
|
var template = props.template, _props_customSetup = props.customSetup, customSetup = _props_customSetup === void 0 ? {} : _props_customSetup, tmp = props.files, customFiles = tmp === void 0 ? {} : tmp, _props_removeFiles = props.removeFiles, removeFiles = _props_removeFiles === void 0 ? [] : _props_removeFiles, _props_options = props.options, options = _props_options === void 0 ? {} : _props_options, _props_initialCollapsedFolder = props.initialCollapsedFolder, initialCollapsedFolder = _props_initialCollapsedFolder === void 0 ? [] : _props_initialCollapsedFolder, _props_activeFile = props.activeFile, activeFile = _props_activeFile === void 0 ? "src/routes/page.tsx" : _props_activeFile, _props_theme = props.theme, theme = _props_theme === void 0 ? "light" : _props_theme;
|
|
20
20
|
var initFiles = ModernTemplates[template];
|
|
21
21
|
var files = _object_spread({}, fileterFiles(initFiles, removeFiles), fileterFiles(customFiles, removeFiles));
|
|
22
22
|
return /* @__PURE__ */ _jsx(SandpackProvider, {
|
|
23
|
-
theme
|
|
23
|
+
theme,
|
|
24
24
|
customSetup: _object_spread({
|
|
25
25
|
environment: "node"
|
|
26
26
|
}, customSetup),
|
|
27
|
-
files
|
|
27
|
+
files,
|
|
28
28
|
options: _object_spread({
|
|
29
|
-
activeFile
|
|
29
|
+
activeFile,
|
|
30
30
|
visibleFiles: Object.keys(customFiles).filter(function(file) {
|
|
31
31
|
return !removeFiles.includes(file);
|
|
32
32
|
})
|
|
@@ -59,3 +59,6 @@ export default function ModernSandpack(props) {
|
|
|
59
59
|
})
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
+
export {
|
|
63
|
+
ModernSandpack as default
|
|
64
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
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
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.eslintcache\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
5
|
".npmrc": "strict-peer-dependencies=false\n"
|
|
6
6
|
};
|
|
7
|
+
export {
|
|
8
|
+
commonFiles
|
|
9
|
+
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { commonFiles } from "./common";
|
|
3
|
-
|
|
3
|
+
var ModuleFiles = _object_spread({}, commonFiles, {
|
|
4
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.eslintcache\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\n.eslintrc.js\n.eslintrc\ntsconfig.json\nCHANGELOG.md\n\n**/*/api/typings/auto-generated\n",
|
|
5
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\nRun test cases:\n\n```bash\npnpm test\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 && husky install",\n "dev": "modern dev",\n "build": "modern build",\n "build:watch": "modern build -w",\n "reset": "rimraf ./**/node_modules",\n "lint": "modern lint",\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,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {},\n "peerDependencies": {},\n "devDependencies": {\n "@modern-js/module-tools": "2.
|
|
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 && husky install",\n "dev": "modern dev",\n "build": "modern build",\n "build:watch": "modern build -w",\n "reset": "rimraf ./**/node_modules",\n "lint": "modern lint",\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,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {},\n "peerDependencies": {},\n "devDependencies": {\n "@modern-js/module-tools": "2.36.0",\n "@modern-js/eslint-config": "2.36.0",\n "@modern-js/tsconfig":"2.36.0",\n "@modern-js-app/eslint-config": "2.36.0",\n "typescript": "~5.0.4",\n "@types/jest": "~29.2.4",\n "@types/node": "~16.11.7",\n "@types/react": "~18.0.26",\n "rimraf": "~3.0.2",\n "lint-staged": "~13.1.0",\n "prettier": "~2.8.1",\n "husky": "~8.0.1"\n },\n "sideEffects": [],\n "publishConfig": {\n "access": "public",\n "registry": "https://registry.npmjs.org/"\n }\n}\n',
|
|
7
7
|
"src/index.ts": "export default function () {\n return 'hello world';\n}\n",
|
|
8
8
|
"modern.config.ts": "import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n});\n",
|
|
9
9
|
"tsconfig.json": '{\n "extends": "@modern-js/tsconfig/base",\n "declaration": true,\n "compilerOptions": {\n "baseUrl": "./",\n "paths": {\n "@/*": ["./src/*"]\n },\n "isolatedModules": true\n },\n "include": ["src"],\n "exclude": ["**/node_modules"]\n}\n',
|
|
10
10
|
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/module-tools/types' />\n/// <reference types='@modern-js/plugin-testing/types' />\n"
|
|
11
11
|
});
|
|
12
|
+
export {
|
|
13
|
+
ModuleFiles
|
|
14
|
+
};
|
|
@@ -1,13 +1,108 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
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",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "modern lint",\n "prepare": "husky install",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {\n "@modern-js/runtime": "2.
|
|
6
|
+
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "reset": "npx rimraf ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "modern lint",\n "prepare": "husky install",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {\n "@modern-js/runtime": "2.36.0",\n "react": "~18.2.0",\n "react-dom": "~18.2.0"\n },\n "devDependencies": {\n "@modern-js/app-tools": "2.36.0",\n "@modern-js/eslint-config": "2.36.0",\n "@modern-js/tsconfig":"2.36.0",\n "@modern-js-app/eslint-config": "2.36.0",\n "typescript": "~5.0.4",\n "@types/jest": "~29.2.4",\n "@types/node": "~16.11.7",\n "@types/react": "~18.0.26",\n "@types/react-dom": "~18.0.10",\n "lint-staged": "~13.1.0",\n "prettier": "~2.8.1",\n "husky": "~8.0.1",\n "rimraf": "~3.0.2"\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: [appTools()],\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",
|
|
10
10
|
"src/routes/index.css": "html,\nbody {\n padding: 0;\n margin: 0;\n font-family: PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, 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: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,\n Bitstream Vera Sans Mono, Courier New, 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",
|
|
11
11
|
"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",
|
|
12
|
-
"src/routes/page.tsx":
|
|
12
|
+
"src/routes/page.tsx": `import { Helmet } from '@modern-js/runtime/head';
|
|
13
|
+
import './index.css';
|
|
14
|
+
|
|
15
|
+
const Index = () => (
|
|
16
|
+
<div className="container-box">
|
|
17
|
+
<Helmet>
|
|
18
|
+
<link
|
|
19
|
+
rel="icon"
|
|
20
|
+
type="image/x-icon"
|
|
21
|
+
href="https://lf3-static.bytednsdoc.com/obj/eden-cn/uhbfnupenuhf/favicon.ico"
|
|
22
|
+
/>
|
|
23
|
+
</Helmet>
|
|
24
|
+
<main>
|
|
25
|
+
<div className="title">
|
|
26
|
+
Welcome to
|
|
27
|
+
<img
|
|
28
|
+
className="logo"
|
|
29
|
+
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/modern-js-logo.svg"
|
|
30
|
+
alt="Modern.js Logo"
|
|
31
|
+
/>
|
|
32
|
+
<p className="name">Modern.js</p>
|
|
33
|
+
</div>
|
|
34
|
+
<p className="description">
|
|
35
|
+
Get started by editing <code className="code">src/routes/page.tsx</code>
|
|
36
|
+
</p>
|
|
37
|
+
<div className="grid">
|
|
38
|
+
<a
|
|
39
|
+
href="https://modernjs.dev/guides/get-started/introduction.html"
|
|
40
|
+
target="_blank"
|
|
41
|
+
rel="noopener noreferrer"
|
|
42
|
+
className="card"
|
|
43
|
+
>
|
|
44
|
+
<h2>
|
|
45
|
+
Guide
|
|
46
|
+
<img
|
|
47
|
+
className="arrow-right"
|
|
48
|
+
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"
|
|
49
|
+
/>
|
|
50
|
+
</h2>
|
|
51
|
+
<p>Follow the guides to use all features of Modern.js.</p>
|
|
52
|
+
</a>
|
|
53
|
+
<a
|
|
54
|
+
href="https://modernjs.dev/tutorials/foundations/introduction.html"
|
|
55
|
+
target="_blank"
|
|
56
|
+
className="card"
|
|
57
|
+
rel="noreferrer"
|
|
58
|
+
>
|
|
59
|
+
<h2>
|
|
60
|
+
Tutorials
|
|
61
|
+
<img
|
|
62
|
+
className="arrow-right"
|
|
63
|
+
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"
|
|
64
|
+
/>
|
|
65
|
+
</h2>
|
|
66
|
+
<p>Learn to use Modern.js to create your first application.</p>
|
|
67
|
+
</a>
|
|
68
|
+
<a
|
|
69
|
+
href="https://modernjs.dev/configure/app/usage.html"
|
|
70
|
+
target="_blank"
|
|
71
|
+
className="card"
|
|
72
|
+
rel="noreferrer"
|
|
73
|
+
>
|
|
74
|
+
<h2>
|
|
75
|
+
Config
|
|
76
|
+
<img
|
|
77
|
+
className="arrow-right"
|
|
78
|
+
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"
|
|
79
|
+
/>
|
|
80
|
+
</h2>
|
|
81
|
+
<p>Find all configuration options provided by Modern.js.</p>
|
|
82
|
+
</a>
|
|
83
|
+
<a
|
|
84
|
+
href="https://github.com/web-infra-dev/modern.js"
|
|
85
|
+
target="_blank"
|
|
86
|
+
rel="noopener noreferrer"
|
|
87
|
+
className="card"
|
|
88
|
+
>
|
|
89
|
+
<h2>
|
|
90
|
+
Github
|
|
91
|
+
<img
|
|
92
|
+
className="arrow-right"
|
|
93
|
+
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/arrow-right.svg"
|
|
94
|
+
/>
|
|
95
|
+
</h2>
|
|
96
|
+
<p>View the source code of Github, feel free to contribute.</p>
|
|
97
|
+
</a>
|
|
98
|
+
</div>
|
|
99
|
+
</main>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
export default Index;
|
|
104
|
+
`
|
|
13
105
|
});
|
|
106
|
+
export {
|
|
107
|
+
MWAFiles
|
|
108
|
+
};
|
package/dist/esm-node/index.js
CHANGED
|
@@ -13,7 +13,7 @@ function fileterFiles(files, removeFiles) {
|
|
|
13
13
|
});
|
|
14
14
|
return result;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
function ModernSandpack(props) {
|
|
17
17
|
const { template, customSetup = {}, files: customFiles = {}, removeFiles = [], options = {}, initialCollapsedFolder = [], activeFile = "src/routes/page.tsx", theme = "light" } = props;
|
|
18
18
|
const initFiles = ModernTemplates[template];
|
|
19
19
|
const files = {
|
|
@@ -61,3 +61,6 @@ export default function ModernSandpack(props) {
|
|
|
61
61
|
})
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
+
export {
|
|
65
|
+
ModernSandpack as default
|
|
66
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
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
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.eslintcache\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
5
|
".npmrc": "strict-peer-dependencies=false\n"
|
|
6
6
|
};
|
|
7
|
+
export {
|
|
8
|
+
commonFiles
|
|
9
|
+
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { commonFiles } from "./common";
|
|
2
|
-
|
|
2
|
+
const ModuleFiles = {
|
|
3
3
|
...commonFiles,
|
|
4
4
|
...{
|
|
5
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.eslintcache\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\n.eslintrc.js\n.eslintrc\ntsconfig.json\nCHANGELOG.md\n\n**/*/api/typings/auto-generated\n",
|
|
6
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\nRun test cases:\n\n```bash\npnpm test\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 && husky install",\n "dev": "modern dev",\n "build": "modern build",\n "build:watch": "modern build -w",\n "reset": "rimraf ./**/node_modules",\n "lint": "modern lint",\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,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {},\n "peerDependencies": {},\n "devDependencies": {\n "@modern-js/module-tools": "2.
|
|
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 && husky install",\n "dev": "modern dev",\n "build": "modern build",\n "build:watch": "modern build -w",\n "reset": "rimraf ./**/node_modules",\n "lint": "modern lint",\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,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {},\n "peerDependencies": {},\n "devDependencies": {\n "@modern-js/module-tools": "2.36.0",\n "@modern-js/eslint-config": "2.36.0",\n "@modern-js/tsconfig":"2.36.0",\n "@modern-js-app/eslint-config": "2.36.0",\n "typescript": "~5.0.4",\n "@types/jest": "~29.2.4",\n "@types/node": "~16.11.7",\n "@types/react": "~18.0.26",\n "rimraf": "~3.0.2",\n "lint-staged": "~13.1.0",\n "prettier": "~2.8.1",\n "husky": "~8.0.1"\n },\n "sideEffects": [],\n "publishConfig": {\n "access": "public",\n "registry": "https://registry.npmjs.org/"\n }\n}\n',
|
|
8
8
|
"src/index.ts": "export default function () {\n return 'hello world';\n}\n",
|
|
9
9
|
"modern.config.ts": "import { moduleTools, defineConfig } from '@modern-js/module-tools';\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildPreset: 'npm-library',\n});\n",
|
|
10
10
|
"tsconfig.json": '{\n "extends": "@modern-js/tsconfig/base",\n "declaration": true,\n "compilerOptions": {\n "baseUrl": "./",\n "paths": {\n "@/*": ["./src/*"]\n },\n "isolatedModules": true\n },\n "include": ["src"],\n "exclude": ["**/node_modules"]\n}\n',
|
|
11
11
|
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/module-tools/types' />\n/// <reference types='@modern-js/plugin-testing/types' />\n"
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
+
export {
|
|
15
|
+
ModuleFiles
|
|
16
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { commonFiles } from "./common";
|
|
2
|
-
|
|
2
|
+
const MWAFiles = {
|
|
3
3
|
...commonFiles,
|
|
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",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "modern lint",\n "prepare": "husky install",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {\n "@modern-js/runtime": "2.
|
|
7
|
+
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "scripts": {\n "reset": "npx rimraf ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "start": "modern start",\n "serve": "modern serve",\n "new": "modern new",\n "lint": "modern lint",\n "prepare": "husky install",\n "upgrade": "modern upgrade"\n },\n "engines": {\n "node": ">=16.18.1"\n },\n "lint-staged": {\n "*.{js,jsx,ts,tsx,mjs,cjs}": [\n "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"\n ]\n },\n "eslintIgnore": [\n "node_modules/",\n "dist/"\n ],\n "dependencies": {\n "@modern-js/runtime": "2.36.0",\n "react": "~18.2.0",\n "react-dom": "~18.2.0"\n },\n "devDependencies": {\n "@modern-js/app-tools": "2.36.0",\n "@modern-js/eslint-config": "2.36.0",\n "@modern-js/tsconfig":"2.36.0",\n "@modern-js-app/eslint-config": "2.36.0",\n "typescript": "~5.0.4",\n "@types/jest": "~29.2.4",\n "@types/node": "~16.11.7",\n "@types/react": "~18.0.26",\n "@types/react-dom": "~18.0.10",\n "lint-staged": "~13.1.0",\n "prettier": "~2.8.1",\n "husky": "~8.0.1",\n "rimraf": "~3.0.2"\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: [appTools()],\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",
|
|
@@ -105,3 +105,6 @@ export default Index;
|
|
|
105
105
|
`
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
+
export {
|
|
109
|
+
MWAFiles
|
|
110
|
+
};
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.37.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
"@types/recursive-readdir": "^2.2.1",
|
|
48
48
|
"@types/react": "^18",
|
|
49
49
|
"@types/react-dom": "^18",
|
|
50
|
-
"@modern-js/
|
|
51
|
-
"@modern-js/
|
|
52
|
-
"@modern-js/generator
|
|
53
|
-
"@modern-js/generator
|
|
54
|
-
"@modern-js/utils": "2.
|
|
55
|
-
"@modern-js/
|
|
56
|
-
"@modern-js/
|
|
57
|
-
"@scripts/build": "2.
|
|
58
|
-
"@scripts/jest-config": "2.
|
|
50
|
+
"@modern-js/base-generator": "3.2.4",
|
|
51
|
+
"@modern-js/mwa-generator": "3.2.4",
|
|
52
|
+
"@modern-js/module-generator": "3.2.4",
|
|
53
|
+
"@modern-js/entry-generator": "3.2.4",
|
|
54
|
+
"@modern-js/generator-utils": "3.2.4",
|
|
55
|
+
"@modern-js/generator-common": "3.2.4",
|
|
56
|
+
"@modern-js/utils": "2.37.0",
|
|
57
|
+
"@scripts/build": "2.37.0",
|
|
58
|
+
"@scripts/jest-config": "2.37.0"
|
|
59
59
|
},
|
|
60
60
|
"sideEffects": false,
|
|
61
61
|
"publishConfig": {
|