@bleedingdev/modern-js-sandpack-react 3.2.0-ultramodern.12 → 3.2.0-ultramodern.121
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 +2 -0
- package/dist/cjs/index.js +9 -5
- package/dist/cjs/templates/common.js +14 -10
- package/dist/cjs/templates/index.js +12 -8
- package/dist/cjs/templates/mwa.js +17 -27
- package/dist/esm/templates/common.mjs +2 -2
- package/dist/esm/templates/mwa.mjs +8 -22
- package/dist/esm-node/templates/common.mjs +2 -2
- package/dist/esm-node/templates/mwa.mjs +8 -22
- package/dist/types/templates/common.d.ts +1 -1
- package/dist/types/templates/mwa.d.ts +2 -16
- package/package.json +10 -10
- package/scripts/mwa-template/.browserslistrc +4 -0
- package/scripts/mwa-template/.gitignore.handlebars +30 -0
- package/scripts/mwa-template/.nvmrc +2 -0
- package/scripts/mwa-template/README.md +32 -0
- package/scripts/mwa-template/biome.json.handlebars +37 -0
- package/scripts/mwa-template/package.json.handlebars +27 -0
- package/scripts/template.mts +101 -5
package/CHANGELOG.md
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -23,13 +27,13 @@ var __webpack_require__ = {};
|
|
|
23
27
|
})();
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
commonFiles: ()=>commonFiles
|
|
28
|
-
});
|
|
29
30
|
const commonFiles = {
|
|
30
|
-
".codesandbox/
|
|
31
|
-
".codesandbox/
|
|
31
|
+
".codesandbox/environment.json": "{\n \"nodeVersion\": 18\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 start\",\n \"runAtStart\": true,\n \"restartOn\": {\n \"files\": [\"pnpm-lock.yaml\"]\n }\n }\n }\n}\n"
|
|
32
33
|
};
|
|
34
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
35
|
+
commonFiles: commonFiles
|
|
36
|
+
});
|
|
33
37
|
exports.commonFiles = __webpack_exports__.commonFiles;
|
|
34
38
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
35
39
|
"commonFiles"
|
|
@@ -15,11 +15,15 @@ function __webpack_require__(moduleId) {
|
|
|
15
15
|
return module.exports;
|
|
16
16
|
}
|
|
17
17
|
(()=>{
|
|
18
|
-
__webpack_require__.d = (exports1,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
19
|
+
var define = (defs, kind)=>{
|
|
20
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
[kind]: defs[key]
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
define(getters, "get");
|
|
26
|
+
define(values, "value");
|
|
23
27
|
};
|
|
24
28
|
})();
|
|
25
29
|
(()=>{
|
|
@@ -38,13 +42,13 @@ function __webpack_require__(moduleId) {
|
|
|
38
42
|
var __webpack_exports__ = {};
|
|
39
43
|
(()=>{
|
|
40
44
|
__webpack_require__.r(__webpack_exports__);
|
|
41
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
42
|
-
ModernTemplates: ()=>ModernTemplates
|
|
43
|
-
});
|
|
44
45
|
const { MWAFiles } = __webpack_require__("./mwa");
|
|
45
46
|
const ModernTemplates = {
|
|
46
47
|
'web-app': MWAFiles
|
|
47
48
|
};
|
|
49
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
50
|
+
ModernTemplates: ModernTemplates
|
|
51
|
+
});
|
|
48
52
|
})();
|
|
49
53
|
exports.ModernTemplates = __webpack_exports__.ModernTemplates;
|
|
50
54
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -32,29 +36,15 @@ const MWAFiles = {
|
|
|
32
36
|
".browserslistrc": "chrome >= 87\nedge >= 88\nfirefox >= 78\nsafari >= 14\n",
|
|
33
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",
|
|
34
38
|
".npmrc": "strict-peer-dependencies=false\n",
|
|
35
|
-
"
|
|
36
|
-
"modern.config.ts": "
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "type": "module",\n "scripts": {\n "reset": "npx rimraf node_modules ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "serve": "modern serve",\n "typecheck": "node -e \\"const fs = require(\'node:fs\'); const { execFileSync, spawnSync } = require(\'node:child_process\'); const bin = execFileSync(\'effect-tsgo\', [\'get-exe-path\'], { encoding: \'utf8\' }).trim(); if (process.platform !== \'win32\') fs.chmodSync(bin, 0o755); const result = spawnSync(bin, [\'--noEmit\', \'-p\', \'tsconfig.json\'], { stdio: \'inherit\' }); process.exit(result.status ?? 1);\\"",\n "i18n:check": "node ./scripts/check-i18n-strings.mjs",\n "skills:install": "node ./scripts/bootstrap-agent-skills.mjs",\n "skills:check": "node ./scripts/bootstrap-agent-skills.mjs --check",\n "ultramodern:check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm i18n:check && pnpm skills:check && node ./scripts/validate-ultramodern.mjs",\n "format": "oxfmt .",\n "format:check": "oxfmt --check .",\n "lint": "oxlint .",\n "lint:fix": "oxlint . --fix",\n "prepare": "simple-git-hooks"\n },\n "dependencies": {\n "@modern-js/plugin-i18n": "",\n "@modern-js/runtime": "",\n "i18next": "26.2.0",\n "react": "^19.2.3",\n "react-dom": "^19.2.0",\n "react-i18next": "17.0.8"\n },\n "devDependencies": {\n "@effect/tsgo": "0.7.3",\n "@modern-js/app-tools": "",\n "@modern-js/tsconfig": "",\n "@types/node": "^20",\n "@types/react": "^19.1.8",\n "@types/react-dom": "^19.1.6",\n "@typescript/native-preview": "7.0.0-dev.20260518.1",\n "lint-staged": "~15.4.0",\n "oxfmt": "0.50.0",\n "oxlint": "1.65.0",\n "rimraf": "^6.0.1",\n "simple-git-hooks": "^2.11.1",\n "ultracite": "7.7.0"\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "oxfmt --write",\n "oxlint --fix"\n ]\n },\n "engines": {\n "node": ">=20"\n }\n}\n',
|
|
40
|
-
"postcss.config.mjs": "",
|
|
41
|
-
"tailwind.config.ts": "",
|
|
42
|
-
"tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"target\": \"ESNext\",\n \"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n \"module\": \"preserve\",\n \"moduleResolution\": \"Bundler\",\n \"moduleDetection\": \"force\",\n \"isolatedModules\": true,\n \"verbatimModuleSyntax\": true,\n \"noEmit\": true,\n \"allowJs\": true,\n \"resolveJsonModule\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true,\n \"strict\": true,\n \"noUncheckedIndexedAccess\": true,\n \"exactOptionalPropertyTypes\": true,\n \"noImplicitOverride\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@api/*\": [\"./api/*\"],\n \"@shared/*\": [\"./shared/*\"]\n },\n \"rootDir\": \".\",\n \"plugins\": [\n {\n \"name\": \"@effect/language-service\",\n \"diagnostics\": true,\n \"includeSuggestionsInTsc\": true,\n \"ignoreEffectSuggestionsInTscExitCode\": false,\n \"ignoreEffectWarningsInTscExitCode\": false,\n \"ignoreEffectErrorsInTscExitCode\": false,\n \"skipDisabledOptimization\": true,\n \"diagnosticSeverity\": {\n \"anyUnknownInErrorContext\": \"error\",\n \"classSelfMismatch\": \"error\",\n \"duplicatePackage\": \"error\",\n \"effectFnImplicitAny\": \"error\",\n \"floatingEffect\": \"error\",\n \"genericEffectServices\": \"error\",\n \"missingEffectContext\": \"error\",\n \"missingEffectError\": \"error\",\n \"missingLayerContext\": \"error\",\n \"missingReturnYieldStar\": \"error\",\n \"missingStarInYieldEffectGen\": \"error\",\n \"nonObjectEffectServiceType\": \"error\",\n \"outdatedApi\": \"error\",\n \"overriddenSchemaConstructor\": \"error\",\n \"catchUnfailableEffect\": \"error\",\n \"effectFnIife\": \"error\",\n \"effectGenUsesAdapter\": \"error\",\n \"effectInFailure\": \"error\",\n \"effectInVoidSuccess\": \"error\",\n \"globalErrorInEffectCatch\": \"error\",\n \"globalErrorInEffectFailure\": \"error\",\n \"layerMergeAllWithDependencies\": \"error\",\n \"lazyPromiseInEffectSync\": \"error\",\n \"leakingRequirements\": \"error\",\n \"multipleEffectProvide\": \"error\",\n \"returnEffectInGen\": \"error\",\n \"runEffectInsideEffect\": \"error\",\n \"schemaSyncInEffect\": \"error\",\n \"scopeInLayerEffect\": \"error\",\n \"strictEffectProvide\": \"error\",\n \"tryCatchInEffectGen\": \"error\",\n \"unknownInEffectCatch\": \"error\",\n \"asyncFunction\": \"error\",\n \"cryptoRandomUUID\": \"error\",\n \"cryptoRandomUUIDInEffect\": \"error\",\n \"extendsNativeError\": \"error\",\n \"globalConsole\": \"error\",\n \"globalConsoleInEffect\": \"error\",\n \"globalDate\": \"error\",\n \"globalDateInEffect\": \"error\",\n \"globalFetch\": \"error\",\n \"globalFetchInEffect\": \"error\",\n \"globalRandom\": \"error\",\n \"globalRandomInEffect\": \"error\",\n \"globalTimers\": \"error\",\n \"globalTimersInEffect\": \"error\",\n \"instanceOfSchema\": \"error\",\n \"newPromise\": \"error\",\n \"nodeBuiltinImport\": \"error\",\n \"preferSchemaOverJson\": \"error\",\n \"processEnv\": \"error\",\n \"processEnvInEffect\": \"error\",\n \"unsafeEffectTypeAssertion\": \"error\",\n \"catchAllToMapError\": \"error\",\n \"deterministicKeys\": \"error\",\n \"effectDoNotation\": \"error\",\n \"effectFnOpportunity\": \"error\",\n \"effectMapFlatten\": \"error\",\n \"effectMapVoid\": \"error\",\n \"effectSucceedWithVoid\": \"error\",\n \"missedPipeableOpportunity\": \"error\",\n \"missingEffectServiceDependency\": \"error\",\n \"nestedEffectGenYield\": \"error\",\n \"redundantSchemaTagIdentifier\": \"error\",\n \"schemaStructWithTag\": \"error\",\n \"schemaUnionOfLiterals\": \"error\",\n \"serviceNotAsClass\": \"error\",\n \"strictBooleanExpressions\": \"error\",\n \"unnecessaryArrowBlock\": \"error\",\n \"unnecessaryEffectGen\": \"error\",\n \"unnecessaryFailYieldableError\": \"error\",\n \"unnecessaryPipe\": \"error\",\n \"unnecessaryPipeChain\": \"error\"\n }\n }\n ]\n },\n \"include\": [\"src\", \"api\", \"shared\", \"config\", \"modern.config.ts\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
|
|
43
|
-
".agents/skills-lock.json": "{\n \"schemaVersion\": 2,\n \"installDir\": \".agents/skills\",\n \"sources\": [\n {\n \"id\": \"techsiocz-private\",\n \"visibility\": \"private\",\n \"repository\": \"https://github.com/TechsioCZ/skills\",\n \"install\": \"clone-if-authorized\",\n \"baseline\": [\n {\n \"name\": \"plan-graph\",\n \"reason\": \"Build and validate DAGs from .plan.md files\"\n },\n {\n \"name\": \"dag\",\n \"reason\": \"Inspect current plan frontiers and blocked lanes\"\n },\n {\n \"name\": \"subagent-graph\",\n \"reason\": \"Design dependency-aware multi-agent launch graphs\"\n },\n {\n \"name\": \"helm\",\n \"reason\": \"Steer already-running multi-agent work\"\n },\n {\n \"name\": \"debugger-mode\",\n \"reason\": \"Run hypothesis-driven debugging with runtime evidence\"\n }\n ]\n }\n ]\n}\n",
|
|
44
|
-
"scripts/bootstrap-agent-skills.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst lockPath = path.join(root, '.agents/skills-lock.json');\nconst checkOnly = process.argv.includes('--check');\nconst force = process.argv.includes('--force');\n\nconst readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8'));\n\nconst run = (command, args, options = {}) =>\n execFileSync(command, args, {\n cwd: options.cwd ?? root,\n encoding: 'utf-8',\n stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],\n });\n\nconst cloneSource = (source, targetDir) => {\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1'], {\n stdio: 'inherit',\n });\n } catch {\n run('git', ['clone', '--depth', '1', source.repository, targetDir], {\n stdio: 'inherit',\n });\n }\n};\n\nconst resolveSkillDir = (sourceRoot, skillName) => {\n const candidates = [\n path.join(sourceRoot, skillName),\n path.join(sourceRoot, 'skills', skillName),\n path.join(sourceRoot, 'skills', 'engineering', skillName),\n path.join(sourceRoot, 'skills', 'productivity', skillName),\n ];\n return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'SKILL.md')));\n};\n\nif (!fs.existsSync(lockPath)) {\n console.error('Missing .agents/skills-lock.json');\n process.exit(1);\n}\n\nconst lock = readJson(lockPath);\nconst installDir = path.join(root, lock.installDir ?? '.agents/skills');\nconst privateSources = (lock.sources ?? []).filter(\n (source) => source.install === 'clone-if-authorized',\n);\n\nif (checkOnly) {\n const missing = privateSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n if (missing.length > 0) {\n console.warn(\n `Private skills not installed: ${missing.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Agent skills are installed.');\n }\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\n\nfor (const source of privateSources) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n cloneSource(source, tempDir);\n for (const skill of source.baseline ?? []) {\n const sourceSkillDir = resolveSkillDir(tempDir, skill.name);\n if (!sourceSkillDir) {\n throw new Error(`Skill ${skill.name} not found in ${source.repository}`);\n }\n const targetSkillDir = path.join(installDir, skill.name);\n if (fs.existsSync(targetSkillDir)) {\n if (!force) {\n console.log(`Skipping existing ${skill.name}`);\n continue;\n }\n fs.rmSync(targetSkillDir, { force: true, recursive: true });\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n fs.rmSync(tempDir, { force: true, recursive: true });\n }\n}\n",
|
|
45
|
-
"scripts/check-i18n-strings.mjs": "import fs from 'node:fs';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst scanRoots = ['src'].map((scanRoot) => path.join(root, scanRoot));\nconst ignoredDirectories = new Set(['.modern', '.modernjs', 'dist', 'node_modules']);\nconst visibleAttributePattern =\n /\\s(?:aria-label|alt|placeholder|title)=[\"']([^\"']*[A-Za-z][^\"']*)[\"']/gu;\nconst jsxTextPattern = />([^<>{}]*[A-Za-z][^<>{}]*)</gu;\n\nconst collectFiles = (directory) => {\n if (!fs.existsSync(directory)) {\n return [];\n }\n\n const files = [];\n for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {\n if (entry.isDirectory()) {\n if (!ignoredDirectories.has(entry.name)) {\n files.push(...collectFiles(path.join(directory, entry.name)));\n }\n continue;\n }\n\n if (entry.isFile() && /\\.(jsx|tsx)$/u.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n files.push(path.join(directory, entry.name));\n }\n }\n return files;\n};\n\nconst lineNumberForIndex = (content, index) => content.slice(0, index).split('\\n').length;\nconst isIgnoredLine = (content, index) => {\n const lineStart = content.lastIndexOf('\\n', index) + 1;\n const lineEnd = content.indexOf('\\n', index);\n const currentLineEnd = lineEnd === -1 ? content.length : lineEnd;\n const previousLineStart = content.lastIndexOf('\\n', Math.max(0, lineStart - 2)) + 1;\n const nextLineEnd = content.indexOf('\\n', currentLineEnd + 1);\n const context = content.slice(\n previousLineStart,\n nextLineEnd === -1 ? content.length : nextLineEnd,\n );\n return /i18n-ignore/u.test(context);\n};\n\nconst violations = [];\nfor (const filePath of scanRoots.flatMap(collectFiles)) {\n const content = fs.readFileSync(filePath, 'utf-8');\n for (const match of content.matchAll(visibleAttributePattern)) {\n if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: match[1].trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const text = match[1].replaceAll(/\\s+/gu, ' ').trim();\n if (text && !isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text,\n });\n }\n }\n}\n\nif (violations.length > 0) {\n console.error('Hardcoded user-visible JSX strings found. Move copy to locale JSON files.');\n for (const violation of violations) {\n console.error(\n `${path.relative(root, violation.filePath)}:${violation.line} ${JSON.stringify(\n violation.text,\n )}`,\n );\n }\n process.exit(1);\n}\n\nconsole.log('No hardcoded user-visible JSX strings found.');\n",
|
|
46
|
-
"scripts/validate-ultramodern.mjs": "import fs from 'node:fs';\nimport path from 'node:path';\n\nconst configPath = path.resolve(process.cwd(), 'modern.config.ts');\nconst templateManifestPath = path.resolve(process.cwd(), '.modernjs/mv-template-manifest.json');\n\nif (!fs.existsSync(configPath)) {\n console.error('modern.config.ts not found');\n process.exit(1);\n}\n\nconst content = fs.readFileSync(configPath, 'utf-8');\nconst requiredTokens = [\n 'presetUltramodern(',\n 'appTools()',\n 'enableModuleFederationSSR',\n 'enableBffRequestId',\n 'enableTelemetryExporters',\n 'i18nPlugin(',\n];\nconst missing = requiredTokens.filter((token) => !content.includes(token));\n\nif (missing.length > 0) {\n console.error(`Ultramodern contract check failed. Missing tokens: ${missing.join(', ')}`);\n process.exit(1);\n}\n\nif (!fs.existsSync(templateManifestPath)) {\n console.error('.modernjs/mv-template-manifest.json not found');\n process.exit(1);\n}\n\nconst templateManifest = JSON.parse(fs.readFileSync(templateManifestPath, 'utf-8'));\nconst requiredDeniedPaths = [\n '.git/**',\n '.github/**',\n '.npmrc',\n '.yarnrc',\n '.env',\n '.env.*',\n 'node_modules/**',\n 'dist/**',\n];\nconst requiredPostMaterialization = [\n 'ultramodern-contract-check',\n 'dependency-install-with-lifecycle-deny',\n 'template-manifest-retained',\n];\nconst requiredPaths = [\n 'AGENTS.md',\n '.agents/skills-lock.json',\n 'oxlint.config.ts',\n 'oxfmt.config.ts',\n 'scripts/bootstrap-agent-skills.mjs',\n 'scripts/check-i18n-strings.mjs',\n 'config/public/locales/en/translation.json',\n 'config/public/locales/cs/translation.json',\n];\nconst manifestErrors = [];\n\nfor (const requiredPath of requiredPaths) {\n if (!fs.existsSync(path.resolve(process.cwd(), requiredPath))) {\n console.error(`${requiredPath} not found`);\n process.exit(1);\n }\n}\n\nif (templateManifest.schemaVersion !== 1) {\n manifestErrors.push('schemaVersion');\n}\n\nif (templateManifest.source?.type !== 'builtin') {\n manifestErrors.push('source.type');\n}\n\nif (\n !Array.isArray(templateManifest.integrity?.checksums) ||\n !templateManifest.integrity.checksums.some(\n (checksum) =>\n checksum.algorithm === 'sha256' &&\n checksum.scope === 'source-tree' &&\n /^[0-9a-f]{64}$/u.test(checksum.value),\n )\n) {\n manifestErrors.push('integrity.checksums[source-tree]');\n}\n\nfor (const deniedPath of requiredDeniedPaths) {\n if (!templateManifest.materialization?.deniedPaths?.includes(deniedPath)) {\n manifestErrors.push(`materialization.deniedPaths:${deniedPath}`);\n }\n}\n\nif (templateManifest.lifecyclePolicy?.denyByDefault !== true) {\n manifestErrors.push('lifecyclePolicy.denyByDefault');\n}\n\nfor (const token of requiredPostMaterialization) {\n if (!templateManifest.validation?.postMaterializationValidation?.includes(token)) {\n manifestErrors.push(`validation.postMaterializationValidation:${token}`);\n }\n}\n\nif (manifestErrors.length > 0) {\n console.error(\n `Ultramodern template manifest check failed. Invalid fields: ${manifestErrors.join(', ')}`,\n );\n process.exit(1);\n}\n\nconst packageJson = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), 'package.json'), 'utf-8'),\n);\nconst unresolvedTemplateMarker = String.fromCodePoint(123, 123);\nif (JSON.stringify(packageJson).includes(unresolvedTemplateMarker)) {\n console.error('package.json contains unresolved template markers');\n process.exit(1);\n}\nconst skillsLock = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.agents/skills-lock.json'), 'utf-8'),\n);\nconst requiredScripts = {\n format: 'oxfmt .',\n 'format:check': 'oxfmt --check .',\n 'i18n:check': 'node ./scripts/check-i18n-strings.mjs',\n lint: 'oxlint .',\n 'lint:fix': 'oxlint . --fix',\n 'skills:check': 'node ./scripts/bootstrap-agent-skills.mjs --check',\n 'skills:install': 'node ./scripts/bootstrap-agent-skills.mjs',\n};\n\nfor (const [scriptName, scriptCommand] of Object.entries(requiredScripts)) {\n if (packageJson.scripts?.[scriptName] !== scriptCommand) {\n console.error(`Missing or invalid package script: ${scriptName}`);\n process.exit(1);\n }\n}\n\nif (\n !packageJson.scripts?.typecheck?.includes('effect-tsgo') ||\n !packageJson.scripts.typecheck.includes('get-exe-path')\n) {\n console.error('typecheck must use effect-tsgo as the TypeScript checker');\n process.exit(1);\n}\n\nfor (const dependency of ['@modern-js/plugin-i18n', 'i18next', 'react-i18next']) {\n if (!packageJson.dependencies?.[dependency]) {\n console.error(`Missing dependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nfor (const dependency of [\n '@effect/tsgo',\n '@typescript/native-preview',\n 'oxlint',\n 'oxfmt',\n 'ultracite',\n]) {\n if (!packageJson.devDependencies?.[dependency]) {\n console.error(`Missing devDependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nconst privateSource = skillsLock.sources?.find(\n (source) => source.repository === 'https://github.com/TechsioCZ/skills',\n);\nconst privateSkills = new Set(privateSource?.baseline?.map((skill) => skill.name));\nfor (const skillName of ['plan-graph', 'dag', 'subagent-graph', 'helm', 'debugger-mode']) {\n if (!privateSkills.has(skillName)) {\n console.error(`Missing private skill allowlist entry: ${skillName}`);\n process.exit(1);\n }\n}\n\nconsole.log('Ultramodern contract check passed.');\n",
|
|
47
|
-
".github/workflows/ultramodern-gates.yml": "name: Ultramodern Gates\n\non:\n push:\n pull_request:\n\njobs:\n ultramodern-gates:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n uses: actions/checkout@v4\n\n - name: Setup pnpm\n uses: pnpm/action-setup@v4\n\n - name: Setup Node.js\n uses: actions/setup-node@v4\n with:\n node-version: 20\n cache: pnpm\n\n - name: Install Dependencies\n run: pnpm install\n\n - name: Validate Ultramodern Contract\n run: pnpm run ultramodern:check\n\n - name: Build\n run: pnpm run build\n",
|
|
48
|
-
"api/effect/index.ts": "\n",
|
|
49
|
-
"api/lambda/hello.ts": "",
|
|
50
|
-
"shared/effect/api.ts": "\n",
|
|
39
|
+
"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',
|
|
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",
|
|
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 "lint": "biome check"\n },\n "engines": {\n "node": ">=20"\n },\n "dependencies": {\n "@modern-js/runtime": "3.2.1",\n "react": "^19.2.3",\n "react-dom": "^19.2.0"\n },\n "devDependencies": {\n "@modern-js/app-tools": "3.2.1",\n "@modern-js/tsconfig": "3.2.1",\n "@biomejs/biome": "1.9.4",\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 \"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",
|
|
51
43
|
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n",
|
|
52
|
-
"src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\
|
|
53
|
-
"src/routes/index.css": "html,\nbody {\n padding: 0;\n margin: 0;\n font-family
|
|
54
|
-
"src/routes/layout.tsx": "import { Outlet } from '@modern-js/runtime/';\n\nexport default function Layout() {\n return (\n <div>\n <Outlet />\n </div>\n );\n}\n",
|
|
55
|
-
"src/routes/page.tsx": 'import { Helmet } from \'@modern-js/runtime/head\';\nimport
|
|
56
|
-
"config/public/locales/cs/translation.json": '{\n "home": {\n "bff": {\n "response": "Odpoved Effect HttpApi:"\n },\n "cards": {\n "bff": {\n "body": "Pouzivej Effect jako hlavni BFF cestu, Hono nech jako explicitni zalozni volbu.",\n "title": "BFF + Effect"\n },\n "config": {\n "body": "Upravuj vygenerovane vychozi hodnoty v modern.config.ts.",\n "title": "Konfigurace presetUltramodern"\n },\n "gates": {\n "body": "Starter obsahuje PR workflow pro ultramodern:check a build.",\n "title": "Ultramodern kontroly"\n },\n "guide": {\n "body": "Projdi si verejny preset pripraveny pro MV, TanStack a Effect.",\n "title": "UltraModern.js pruvodce"\n }\n },\n "description": {\n "afterConfig": ", udrzuj",\n "afterPreset": "profil. Zacni v",\n "end": "zelene a lad vygenerovany preset jen tam, kde aplikace potrebuje mekci cestu.",\n "intro": "Tento starter prinasi verejny"\n },\n "language": {\n "cs": "Cestina",\n "en": "Anglictina",\n "switcher": "Jazyk"\n },\n "logoAlt": "Logo UltraModern.js",\n "name": "presetUltramodern",\n "title": "UltraModern.js 3.0"\n }\n}\n',
|
|
57
|
-
"config/public/locales/en/translation.json": '{\n "home": {\n "bff": {\n "response": "Effect HttpApi response:"\n },\n "cards": {\n "bff": {\n "body": "Keep Effect as the preferred BFF lane while Hono stays an explicit fallback.",\n "title": "BFF + Effect"\n },\n "config": {\n "body": "Tune the generated defaults in modern.config.ts.",\n "title": "Configure presetUltramodern"\n },\n "gates": {\n "body": "The starter includes a PR workflow for ultramodern:check and build.",\n "title": "Ultramodern Gates"\n },\n "guide": {\n "body": "Review the MV-first, TanStack-ready, Effect-ready public preset.",\n "title": "UltraModern.js Guide"\n }\n },\n "description": {\n "afterConfig": ", keep",\n "afterPreset": "profile. Start in",\n "end": "green, and tune the generated preset only where your app needs a softer lane.",\n "intro": "This starter ships the public"\n },\n "language": {\n "cs": "Czech",\n "en": "English",\n "switcher": "Language"\n },\n "logoAlt": "UltraModern.js Logo",\n "name": "presetUltramodern",\n "title": "UltraModern.js 3.0"\n }\n}\n'
|
|
44
|
+
"src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\n\nexport default defineRuntimeConfig({});\n",
|
|
45
|
+
"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:\n 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",
|
|
46
|
+
"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",
|
|
47
|
+
"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'
|
|
58
48
|
};
|
|
59
49
|
exports.MWAFiles = __webpack_exports__.MWAFiles;
|
|
60
50
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const commonFiles = {
|
|
2
|
-
".codesandbox/
|
|
3
|
-
".codesandbox/
|
|
2
|
+
".codesandbox/environment.json": "{\n \"nodeVersion\": 18\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 start\",\n \"runAtStart\": true,\n \"restartOn\": {\n \"files\": [\"pnpm-lock.yaml\"]\n }\n }\n }\n}\n"
|
|
4
4
|
};
|
|
5
5
|
export { commonFiles };
|
|
@@ -4,28 +4,14 @@ 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
|
-
"
|
|
8
|
-
"modern.config.ts": "
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "type": "module",\n "scripts": {\n "reset": "npx rimraf node_modules ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "serve": "modern serve",\n "typecheck": "node -e \\"const fs = require(\'node:fs\'); const { execFileSync, spawnSync } = require(\'node:child_process\'); const bin = execFileSync(\'effect-tsgo\', [\'get-exe-path\'], { encoding: \'utf8\' }).trim(); if (process.platform !== \'win32\') fs.chmodSync(bin, 0o755); const result = spawnSync(bin, [\'--noEmit\', \'-p\', \'tsconfig.json\'], { stdio: \'inherit\' }); process.exit(result.status ?? 1);\\"",\n "i18n:check": "node ./scripts/check-i18n-strings.mjs",\n "skills:install": "node ./scripts/bootstrap-agent-skills.mjs",\n "skills:check": "node ./scripts/bootstrap-agent-skills.mjs --check",\n "ultramodern:check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm i18n:check && pnpm skills:check && node ./scripts/validate-ultramodern.mjs",\n "format": "oxfmt .",\n "format:check": "oxfmt --check .",\n "lint": "oxlint .",\n "lint:fix": "oxlint . --fix",\n "prepare": "simple-git-hooks"\n },\n "dependencies": {\n "@modern-js/plugin-i18n": "",\n "@modern-js/runtime": "",\n "i18next": "26.2.0",\n "react": "^19.2.3",\n "react-dom": "^19.2.0",\n "react-i18next": "17.0.8"\n },\n "devDependencies": {\n "@effect/tsgo": "0.7.3",\n "@modern-js/app-tools": "",\n "@modern-js/tsconfig": "",\n "@types/node": "^20",\n "@types/react": "^19.1.8",\n "@types/react-dom": "^19.1.6",\n "@typescript/native-preview": "7.0.0-dev.20260518.1",\n "lint-staged": "~15.4.0",\n "oxfmt": "0.50.0",\n "oxlint": "1.65.0",\n "rimraf": "^6.0.1",\n "simple-git-hooks": "^2.11.1",\n "ultracite": "7.7.0"\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "oxfmt --write",\n "oxlint --fix"\n ]\n },\n "engines": {\n "node": ">=20"\n }\n}\n',
|
|
12
|
-
"postcss.config.mjs": "",
|
|
13
|
-
"tailwind.config.ts": "",
|
|
14
|
-
"tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"target\": \"ESNext\",\n \"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n \"module\": \"preserve\",\n \"moduleResolution\": \"Bundler\",\n \"moduleDetection\": \"force\",\n \"isolatedModules\": true,\n \"verbatimModuleSyntax\": true,\n \"noEmit\": true,\n \"allowJs\": true,\n \"resolveJsonModule\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true,\n \"strict\": true,\n \"noUncheckedIndexedAccess\": true,\n \"exactOptionalPropertyTypes\": true,\n \"noImplicitOverride\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@api/*\": [\"./api/*\"],\n \"@shared/*\": [\"./shared/*\"]\n },\n \"rootDir\": \".\",\n \"plugins\": [\n {\n \"name\": \"@effect/language-service\",\n \"diagnostics\": true,\n \"includeSuggestionsInTsc\": true,\n \"ignoreEffectSuggestionsInTscExitCode\": false,\n \"ignoreEffectWarningsInTscExitCode\": false,\n \"ignoreEffectErrorsInTscExitCode\": false,\n \"skipDisabledOptimization\": true,\n \"diagnosticSeverity\": {\n \"anyUnknownInErrorContext\": \"error\",\n \"classSelfMismatch\": \"error\",\n \"duplicatePackage\": \"error\",\n \"effectFnImplicitAny\": \"error\",\n \"floatingEffect\": \"error\",\n \"genericEffectServices\": \"error\",\n \"missingEffectContext\": \"error\",\n \"missingEffectError\": \"error\",\n \"missingLayerContext\": \"error\",\n \"missingReturnYieldStar\": \"error\",\n \"missingStarInYieldEffectGen\": \"error\",\n \"nonObjectEffectServiceType\": \"error\",\n \"outdatedApi\": \"error\",\n \"overriddenSchemaConstructor\": \"error\",\n \"catchUnfailableEffect\": \"error\",\n \"effectFnIife\": \"error\",\n \"effectGenUsesAdapter\": \"error\",\n \"effectInFailure\": \"error\",\n \"effectInVoidSuccess\": \"error\",\n \"globalErrorInEffectCatch\": \"error\",\n \"globalErrorInEffectFailure\": \"error\",\n \"layerMergeAllWithDependencies\": \"error\",\n \"lazyPromiseInEffectSync\": \"error\",\n \"leakingRequirements\": \"error\",\n \"multipleEffectProvide\": \"error\",\n \"returnEffectInGen\": \"error\",\n \"runEffectInsideEffect\": \"error\",\n \"schemaSyncInEffect\": \"error\",\n \"scopeInLayerEffect\": \"error\",\n \"strictEffectProvide\": \"error\",\n \"tryCatchInEffectGen\": \"error\",\n \"unknownInEffectCatch\": \"error\",\n \"asyncFunction\": \"error\",\n \"cryptoRandomUUID\": \"error\",\n \"cryptoRandomUUIDInEffect\": \"error\",\n \"extendsNativeError\": \"error\",\n \"globalConsole\": \"error\",\n \"globalConsoleInEffect\": \"error\",\n \"globalDate\": \"error\",\n \"globalDateInEffect\": \"error\",\n \"globalFetch\": \"error\",\n \"globalFetchInEffect\": \"error\",\n \"globalRandom\": \"error\",\n \"globalRandomInEffect\": \"error\",\n \"globalTimers\": \"error\",\n \"globalTimersInEffect\": \"error\",\n \"instanceOfSchema\": \"error\",\n \"newPromise\": \"error\",\n \"nodeBuiltinImport\": \"error\",\n \"preferSchemaOverJson\": \"error\",\n \"processEnv\": \"error\",\n \"processEnvInEffect\": \"error\",\n \"unsafeEffectTypeAssertion\": \"error\",\n \"catchAllToMapError\": \"error\",\n \"deterministicKeys\": \"error\",\n \"effectDoNotation\": \"error\",\n \"effectFnOpportunity\": \"error\",\n \"effectMapFlatten\": \"error\",\n \"effectMapVoid\": \"error\",\n \"effectSucceedWithVoid\": \"error\",\n \"missedPipeableOpportunity\": \"error\",\n \"missingEffectServiceDependency\": \"error\",\n \"nestedEffectGenYield\": \"error\",\n \"redundantSchemaTagIdentifier\": \"error\",\n \"schemaStructWithTag\": \"error\",\n \"schemaUnionOfLiterals\": \"error\",\n \"serviceNotAsClass\": \"error\",\n \"strictBooleanExpressions\": \"error\",\n \"unnecessaryArrowBlock\": \"error\",\n \"unnecessaryEffectGen\": \"error\",\n \"unnecessaryFailYieldableError\": \"error\",\n \"unnecessaryPipe\": \"error\",\n \"unnecessaryPipeChain\": \"error\"\n }\n }\n ]\n },\n \"include\": [\"src\", \"api\", \"shared\", \"config\", \"modern.config.ts\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
|
|
15
|
-
".agents/skills-lock.json": "{\n \"schemaVersion\": 2,\n \"installDir\": \".agents/skills\",\n \"sources\": [\n {\n \"id\": \"techsiocz-private\",\n \"visibility\": \"private\",\n \"repository\": \"https://github.com/TechsioCZ/skills\",\n \"install\": \"clone-if-authorized\",\n \"baseline\": [\n {\n \"name\": \"plan-graph\",\n \"reason\": \"Build and validate DAGs from .plan.md files\"\n },\n {\n \"name\": \"dag\",\n \"reason\": \"Inspect current plan frontiers and blocked lanes\"\n },\n {\n \"name\": \"subagent-graph\",\n \"reason\": \"Design dependency-aware multi-agent launch graphs\"\n },\n {\n \"name\": \"helm\",\n \"reason\": \"Steer already-running multi-agent work\"\n },\n {\n \"name\": \"debugger-mode\",\n \"reason\": \"Run hypothesis-driven debugging with runtime evidence\"\n }\n ]\n }\n ]\n}\n",
|
|
16
|
-
"scripts/bootstrap-agent-skills.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst lockPath = path.join(root, '.agents/skills-lock.json');\nconst checkOnly = process.argv.includes('--check');\nconst force = process.argv.includes('--force');\n\nconst readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8'));\n\nconst run = (command, args, options = {}) =>\n execFileSync(command, args, {\n cwd: options.cwd ?? root,\n encoding: 'utf-8',\n stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],\n });\n\nconst cloneSource = (source, targetDir) => {\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1'], {\n stdio: 'inherit',\n });\n } catch {\n run('git', ['clone', '--depth', '1', source.repository, targetDir], {\n stdio: 'inherit',\n });\n }\n};\n\nconst resolveSkillDir = (sourceRoot, skillName) => {\n const candidates = [\n path.join(sourceRoot, skillName),\n path.join(sourceRoot, 'skills', skillName),\n path.join(sourceRoot, 'skills', 'engineering', skillName),\n path.join(sourceRoot, 'skills', 'productivity', skillName),\n ];\n return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'SKILL.md')));\n};\n\nif (!fs.existsSync(lockPath)) {\n console.error('Missing .agents/skills-lock.json');\n process.exit(1);\n}\n\nconst lock = readJson(lockPath);\nconst installDir = path.join(root, lock.installDir ?? '.agents/skills');\nconst privateSources = (lock.sources ?? []).filter(\n (source) => source.install === 'clone-if-authorized',\n);\n\nif (checkOnly) {\n const missing = privateSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n if (missing.length > 0) {\n console.warn(\n `Private skills not installed: ${missing.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Agent skills are installed.');\n }\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\n\nfor (const source of privateSources) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n cloneSource(source, tempDir);\n for (const skill of source.baseline ?? []) {\n const sourceSkillDir = resolveSkillDir(tempDir, skill.name);\n if (!sourceSkillDir) {\n throw new Error(`Skill ${skill.name} not found in ${source.repository}`);\n }\n const targetSkillDir = path.join(installDir, skill.name);\n if (fs.existsSync(targetSkillDir)) {\n if (!force) {\n console.log(`Skipping existing ${skill.name}`);\n continue;\n }\n fs.rmSync(targetSkillDir, { force: true, recursive: true });\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n fs.rmSync(tempDir, { force: true, recursive: true });\n }\n}\n",
|
|
17
|
-
"scripts/check-i18n-strings.mjs": "import fs from 'node:fs';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst scanRoots = ['src'].map((scanRoot) => path.join(root, scanRoot));\nconst ignoredDirectories = new Set(['.modern', '.modernjs', 'dist', 'node_modules']);\nconst visibleAttributePattern =\n /\\s(?:aria-label|alt|placeholder|title)=[\"']([^\"']*[A-Za-z][^\"']*)[\"']/gu;\nconst jsxTextPattern = />([^<>{}]*[A-Za-z][^<>{}]*)</gu;\n\nconst collectFiles = (directory) => {\n if (!fs.existsSync(directory)) {\n return [];\n }\n\n const files = [];\n for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {\n if (entry.isDirectory()) {\n if (!ignoredDirectories.has(entry.name)) {\n files.push(...collectFiles(path.join(directory, entry.name)));\n }\n continue;\n }\n\n if (entry.isFile() && /\\.(jsx|tsx)$/u.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n files.push(path.join(directory, entry.name));\n }\n }\n return files;\n};\n\nconst lineNumberForIndex = (content, index) => content.slice(0, index).split('\\n').length;\nconst isIgnoredLine = (content, index) => {\n const lineStart = content.lastIndexOf('\\n', index) + 1;\n const lineEnd = content.indexOf('\\n', index);\n const currentLineEnd = lineEnd === -1 ? content.length : lineEnd;\n const previousLineStart = content.lastIndexOf('\\n', Math.max(0, lineStart - 2)) + 1;\n const nextLineEnd = content.indexOf('\\n', currentLineEnd + 1);\n const context = content.slice(\n previousLineStart,\n nextLineEnd === -1 ? content.length : nextLineEnd,\n );\n return /i18n-ignore/u.test(context);\n};\n\nconst violations = [];\nfor (const filePath of scanRoots.flatMap(collectFiles)) {\n const content = fs.readFileSync(filePath, 'utf-8');\n for (const match of content.matchAll(visibleAttributePattern)) {\n if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: match[1].trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const text = match[1].replaceAll(/\\s+/gu, ' ').trim();\n if (text && !isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text,\n });\n }\n }\n}\n\nif (violations.length > 0) {\n console.error('Hardcoded user-visible JSX strings found. Move copy to locale JSON files.');\n for (const violation of violations) {\n console.error(\n `${path.relative(root, violation.filePath)}:${violation.line} ${JSON.stringify(\n violation.text,\n )}`,\n );\n }\n process.exit(1);\n}\n\nconsole.log('No hardcoded user-visible JSX strings found.');\n",
|
|
18
|
-
"scripts/validate-ultramodern.mjs": "import fs from 'node:fs';\nimport path from 'node:path';\n\nconst configPath = path.resolve(process.cwd(), 'modern.config.ts');\nconst templateManifestPath = path.resolve(process.cwd(), '.modernjs/mv-template-manifest.json');\n\nif (!fs.existsSync(configPath)) {\n console.error('modern.config.ts not found');\n process.exit(1);\n}\n\nconst content = fs.readFileSync(configPath, 'utf-8');\nconst requiredTokens = [\n 'presetUltramodern(',\n 'appTools()',\n 'enableModuleFederationSSR',\n 'enableBffRequestId',\n 'enableTelemetryExporters',\n 'i18nPlugin(',\n];\nconst missing = requiredTokens.filter((token) => !content.includes(token));\n\nif (missing.length > 0) {\n console.error(`Ultramodern contract check failed. Missing tokens: ${missing.join(', ')}`);\n process.exit(1);\n}\n\nif (!fs.existsSync(templateManifestPath)) {\n console.error('.modernjs/mv-template-manifest.json not found');\n process.exit(1);\n}\n\nconst templateManifest = JSON.parse(fs.readFileSync(templateManifestPath, 'utf-8'));\nconst requiredDeniedPaths = [\n '.git/**',\n '.github/**',\n '.npmrc',\n '.yarnrc',\n '.env',\n '.env.*',\n 'node_modules/**',\n 'dist/**',\n];\nconst requiredPostMaterialization = [\n 'ultramodern-contract-check',\n 'dependency-install-with-lifecycle-deny',\n 'template-manifest-retained',\n];\nconst requiredPaths = [\n 'AGENTS.md',\n '.agents/skills-lock.json',\n 'oxlint.config.ts',\n 'oxfmt.config.ts',\n 'scripts/bootstrap-agent-skills.mjs',\n 'scripts/check-i18n-strings.mjs',\n 'config/public/locales/en/translation.json',\n 'config/public/locales/cs/translation.json',\n];\nconst manifestErrors = [];\n\nfor (const requiredPath of requiredPaths) {\n if (!fs.existsSync(path.resolve(process.cwd(), requiredPath))) {\n console.error(`${requiredPath} not found`);\n process.exit(1);\n }\n}\n\nif (templateManifest.schemaVersion !== 1) {\n manifestErrors.push('schemaVersion');\n}\n\nif (templateManifest.source?.type !== 'builtin') {\n manifestErrors.push('source.type');\n}\n\nif (\n !Array.isArray(templateManifest.integrity?.checksums) ||\n !templateManifest.integrity.checksums.some(\n (checksum) =>\n checksum.algorithm === 'sha256' &&\n checksum.scope === 'source-tree' &&\n /^[0-9a-f]{64}$/u.test(checksum.value),\n )\n) {\n manifestErrors.push('integrity.checksums[source-tree]');\n}\n\nfor (const deniedPath of requiredDeniedPaths) {\n if (!templateManifest.materialization?.deniedPaths?.includes(deniedPath)) {\n manifestErrors.push(`materialization.deniedPaths:${deniedPath}`);\n }\n}\n\nif (templateManifest.lifecyclePolicy?.denyByDefault !== true) {\n manifestErrors.push('lifecyclePolicy.denyByDefault');\n}\n\nfor (const token of requiredPostMaterialization) {\n if (!templateManifest.validation?.postMaterializationValidation?.includes(token)) {\n manifestErrors.push(`validation.postMaterializationValidation:${token}`);\n }\n}\n\nif (manifestErrors.length > 0) {\n console.error(\n `Ultramodern template manifest check failed. Invalid fields: ${manifestErrors.join(', ')}`,\n );\n process.exit(1);\n}\n\nconst packageJson = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), 'package.json'), 'utf-8'),\n);\nconst unresolvedTemplateMarker = String.fromCodePoint(123, 123);\nif (JSON.stringify(packageJson).includes(unresolvedTemplateMarker)) {\n console.error('package.json contains unresolved template markers');\n process.exit(1);\n}\nconst skillsLock = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.agents/skills-lock.json'), 'utf-8'),\n);\nconst requiredScripts = {\n format: 'oxfmt .',\n 'format:check': 'oxfmt --check .',\n 'i18n:check': 'node ./scripts/check-i18n-strings.mjs',\n lint: 'oxlint .',\n 'lint:fix': 'oxlint . --fix',\n 'skills:check': 'node ./scripts/bootstrap-agent-skills.mjs --check',\n 'skills:install': 'node ./scripts/bootstrap-agent-skills.mjs',\n};\n\nfor (const [scriptName, scriptCommand] of Object.entries(requiredScripts)) {\n if (packageJson.scripts?.[scriptName] !== scriptCommand) {\n console.error(`Missing or invalid package script: ${scriptName}`);\n process.exit(1);\n }\n}\n\nif (\n !packageJson.scripts?.typecheck?.includes('effect-tsgo') ||\n !packageJson.scripts.typecheck.includes('get-exe-path')\n) {\n console.error('typecheck must use effect-tsgo as the TypeScript checker');\n process.exit(1);\n}\n\nfor (const dependency of ['@modern-js/plugin-i18n', 'i18next', 'react-i18next']) {\n if (!packageJson.dependencies?.[dependency]) {\n console.error(`Missing dependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nfor (const dependency of [\n '@effect/tsgo',\n '@typescript/native-preview',\n 'oxlint',\n 'oxfmt',\n 'ultracite',\n]) {\n if (!packageJson.devDependencies?.[dependency]) {\n console.error(`Missing devDependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nconst privateSource = skillsLock.sources?.find(\n (source) => source.repository === 'https://github.com/TechsioCZ/skills',\n);\nconst privateSkills = new Set(privateSource?.baseline?.map((skill) => skill.name));\nfor (const skillName of ['plan-graph', 'dag', 'subagent-graph', 'helm', 'debugger-mode']) {\n if (!privateSkills.has(skillName)) {\n console.error(`Missing private skill allowlist entry: ${skillName}`);\n process.exit(1);\n }\n}\n\nconsole.log('Ultramodern contract check passed.');\n",
|
|
19
|
-
".github/workflows/ultramodern-gates.yml": "name: Ultramodern Gates\n\non:\n push:\n pull_request:\n\njobs:\n ultramodern-gates:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n uses: actions/checkout@v4\n\n - name: Setup pnpm\n uses: pnpm/action-setup@v4\n\n - name: Setup Node.js\n uses: actions/setup-node@v4\n with:\n node-version: 20\n cache: pnpm\n\n - name: Install Dependencies\n run: pnpm install\n\n - name: Validate Ultramodern Contract\n run: pnpm run ultramodern:check\n\n - name: Build\n run: pnpm run build\n",
|
|
20
|
-
"api/effect/index.ts": "\n",
|
|
21
|
-
"api/lambda/hello.ts": "",
|
|
22
|
-
"shared/effect/api.ts": "\n",
|
|
7
|
+
"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
|
+
"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",
|
|
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 "lint": "biome check"\n },\n "engines": {\n "node": ">=20"\n },\n "dependencies": {\n "@modern-js/runtime": "3.2.1",\n "react": "^19.2.3",\n "react-dom": "^19.2.0"\n },\n "devDependencies": {\n "@modern-js/app-tools": "3.2.1",\n "@modern-js/tsconfig": "3.2.1",\n "@biomejs/biome": "1.9.4",\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 \"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",
|
|
23
11
|
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n",
|
|
24
|
-
"src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\
|
|
25
|
-
"src/routes/index.css": "html,\nbody {\n padding: 0;\n margin: 0;\n font-family
|
|
26
|
-
"src/routes/layout.tsx": "import { Outlet } from '@modern-js/runtime/';\n\nexport default function Layout() {\n return (\n <div>\n <Outlet />\n </div>\n );\n}\n",
|
|
27
|
-
"src/routes/page.tsx": 'import { Helmet } from \'@modern-js/runtime/head\';\nimport
|
|
28
|
-
"config/public/locales/cs/translation.json": '{\n "home": {\n "bff": {\n "response": "Odpoved Effect HttpApi:"\n },\n "cards": {\n "bff": {\n "body": "Pouzivej Effect jako hlavni BFF cestu, Hono nech jako explicitni zalozni volbu.",\n "title": "BFF + Effect"\n },\n "config": {\n "body": "Upravuj vygenerovane vychozi hodnoty v modern.config.ts.",\n "title": "Konfigurace presetUltramodern"\n },\n "gates": {\n "body": "Starter obsahuje PR workflow pro ultramodern:check a build.",\n "title": "Ultramodern kontroly"\n },\n "guide": {\n "body": "Projdi si verejny preset pripraveny pro MV, TanStack a Effect.",\n "title": "UltraModern.js pruvodce"\n }\n },\n "description": {\n "afterConfig": ", udrzuj",\n "afterPreset": "profil. Zacni v",\n "end": "zelene a lad vygenerovany preset jen tam, kde aplikace potrebuje mekci cestu.",\n "intro": "Tento starter prinasi verejny"\n },\n "language": {\n "cs": "Cestina",\n "en": "Anglictina",\n "switcher": "Jazyk"\n },\n "logoAlt": "Logo UltraModern.js",\n "name": "presetUltramodern",\n "title": "UltraModern.js 3.0"\n }\n}\n',
|
|
29
|
-
"config/public/locales/en/translation.json": '{\n "home": {\n "bff": {\n "response": "Effect HttpApi response:"\n },\n "cards": {\n "bff": {\n "body": "Keep Effect as the preferred BFF lane while Hono stays an explicit fallback.",\n "title": "BFF + Effect"\n },\n "config": {\n "body": "Tune the generated defaults in modern.config.ts.",\n "title": "Configure presetUltramodern"\n },\n "gates": {\n "body": "The starter includes a PR workflow for ultramodern:check and build.",\n "title": "Ultramodern Gates"\n },\n "guide": {\n "body": "Review the MV-first, TanStack-ready, Effect-ready public preset.",\n "title": "UltraModern.js Guide"\n }\n },\n "description": {\n "afterConfig": ", keep",\n "afterPreset": "profile. Start in",\n "end": "green, and tune the generated preset only where your app needs a softer lane.",\n "intro": "This starter ships the public"\n },\n "language": {\n "cs": "Czech",\n "en": "English",\n "switcher": "Language"\n },\n "logoAlt": "UltraModern.js Logo",\n "name": "presetUltramodern",\n "title": "UltraModern.js 3.0"\n }\n}\n'
|
|
12
|
+
"src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\n\nexport default defineRuntimeConfig({});\n",
|
|
13
|
+
"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:\n 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",
|
|
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",
|
|
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'
|
|
30
16
|
};
|
|
31
17
|
export { MWAFiles };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
const commonFiles = {
|
|
3
|
-
".codesandbox/
|
|
4
|
-
".codesandbox/
|
|
3
|
+
".codesandbox/environment.json": "{\n \"nodeVersion\": 18\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 start\",\n \"runAtStart\": true,\n \"restartOn\": {\n \"files\": [\"pnpm-lock.yaml\"]\n }\n }\n }\n}\n"
|
|
5
5
|
};
|
|
6
6
|
export { commonFiles };
|
|
@@ -5,28 +5,14 @@ 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
|
-
"
|
|
9
|
-
"modern.config.ts": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"package.json": '{\n "name": "modern-app",\n "version": "0.1.0",\n "type": "module",\n "scripts": {\n "reset": "npx rimraf node_modules ./**/node_modules",\n "dev": "modern dev",\n "build": "modern build",\n "serve": "modern serve",\n "typecheck": "node -e \\"const fs = require(\'node:fs\'); const { execFileSync, spawnSync } = require(\'node:child_process\'); const bin = execFileSync(\'effect-tsgo\', [\'get-exe-path\'], { encoding: \'utf8\' }).trim(); if (process.platform !== \'win32\') fs.chmodSync(bin, 0o755); const result = spawnSync(bin, [\'--noEmit\', \'-p\', \'tsconfig.json\'], { stdio: \'inherit\' }); process.exit(result.status ?? 1);\\"",\n "i18n:check": "node ./scripts/check-i18n-strings.mjs",\n "skills:install": "node ./scripts/bootstrap-agent-skills.mjs",\n "skills:check": "node ./scripts/bootstrap-agent-skills.mjs --check",\n "ultramodern:check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm i18n:check && pnpm skills:check && node ./scripts/validate-ultramodern.mjs",\n "format": "oxfmt .",\n "format:check": "oxfmt --check .",\n "lint": "oxlint .",\n "lint:fix": "oxlint . --fix",\n "prepare": "simple-git-hooks"\n },\n "dependencies": {\n "@modern-js/plugin-i18n": "",\n "@modern-js/runtime": "",\n "i18next": "26.2.0",\n "react": "^19.2.3",\n "react-dom": "^19.2.0",\n "react-i18next": "17.0.8"\n },\n "devDependencies": {\n "@effect/tsgo": "0.7.3",\n "@modern-js/app-tools": "",\n "@modern-js/tsconfig": "",\n "@types/node": "^20",\n "@types/react": "^19.1.8",\n "@types/react-dom": "^19.1.6",\n "@typescript/native-preview": "7.0.0-dev.20260518.1",\n "lint-staged": "~15.4.0",\n "oxfmt": "0.50.0",\n "oxlint": "1.65.0",\n "rimraf": "^6.0.1",\n "simple-git-hooks": "^2.11.1",\n "ultracite": "7.7.0"\n },\n "simple-git-hooks": {\n "pre-commit": "npx lint-staged"\n },\n "lint-staged": {\n "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [\n "oxfmt --write",\n "oxlint --fix"\n ]\n },\n "engines": {\n "node": ">=20"\n }\n}\n',
|
|
13
|
-
"postcss.config.mjs": "",
|
|
14
|
-
"tailwind.config.ts": "",
|
|
15
|
-
"tsconfig.json": "{\n \"extends\": \"@modern-js/tsconfig/base\",\n \"compilerOptions\": {\n \"declaration\": false,\n \"jsx\": \"preserve\",\n \"target\": \"ESNext\",\n \"lib\": [\"ESNext\", \"DOM\", \"DOM.Iterable\"],\n \"module\": \"preserve\",\n \"moduleResolution\": \"Bundler\",\n \"moduleDetection\": \"force\",\n \"isolatedModules\": true,\n \"verbatimModuleSyntax\": true,\n \"noEmit\": true,\n \"allowJs\": true,\n \"resolveJsonModule\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true,\n \"strict\": true,\n \"noUncheckedIndexedAccess\": true,\n \"exactOptionalPropertyTypes\": true,\n \"noImplicitOverride\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"paths\": {\n \"@/*\": [\"./src/*\"],\n \"@api/*\": [\"./api/*\"],\n \"@shared/*\": [\"./shared/*\"]\n },\n \"rootDir\": \".\",\n \"plugins\": [\n {\n \"name\": \"@effect/language-service\",\n \"diagnostics\": true,\n \"includeSuggestionsInTsc\": true,\n \"ignoreEffectSuggestionsInTscExitCode\": false,\n \"ignoreEffectWarningsInTscExitCode\": false,\n \"ignoreEffectErrorsInTscExitCode\": false,\n \"skipDisabledOptimization\": true,\n \"diagnosticSeverity\": {\n \"anyUnknownInErrorContext\": \"error\",\n \"classSelfMismatch\": \"error\",\n \"duplicatePackage\": \"error\",\n \"effectFnImplicitAny\": \"error\",\n \"floatingEffect\": \"error\",\n \"genericEffectServices\": \"error\",\n \"missingEffectContext\": \"error\",\n \"missingEffectError\": \"error\",\n \"missingLayerContext\": \"error\",\n \"missingReturnYieldStar\": \"error\",\n \"missingStarInYieldEffectGen\": \"error\",\n \"nonObjectEffectServiceType\": \"error\",\n \"outdatedApi\": \"error\",\n \"overriddenSchemaConstructor\": \"error\",\n \"catchUnfailableEffect\": \"error\",\n \"effectFnIife\": \"error\",\n \"effectGenUsesAdapter\": \"error\",\n \"effectInFailure\": \"error\",\n \"effectInVoidSuccess\": \"error\",\n \"globalErrorInEffectCatch\": \"error\",\n \"globalErrorInEffectFailure\": \"error\",\n \"layerMergeAllWithDependencies\": \"error\",\n \"lazyPromiseInEffectSync\": \"error\",\n \"leakingRequirements\": \"error\",\n \"multipleEffectProvide\": \"error\",\n \"returnEffectInGen\": \"error\",\n \"runEffectInsideEffect\": \"error\",\n \"schemaSyncInEffect\": \"error\",\n \"scopeInLayerEffect\": \"error\",\n \"strictEffectProvide\": \"error\",\n \"tryCatchInEffectGen\": \"error\",\n \"unknownInEffectCatch\": \"error\",\n \"asyncFunction\": \"error\",\n \"cryptoRandomUUID\": \"error\",\n \"cryptoRandomUUIDInEffect\": \"error\",\n \"extendsNativeError\": \"error\",\n \"globalConsole\": \"error\",\n \"globalConsoleInEffect\": \"error\",\n \"globalDate\": \"error\",\n \"globalDateInEffect\": \"error\",\n \"globalFetch\": \"error\",\n \"globalFetchInEffect\": \"error\",\n \"globalRandom\": \"error\",\n \"globalRandomInEffect\": \"error\",\n \"globalTimers\": \"error\",\n \"globalTimersInEffect\": \"error\",\n \"instanceOfSchema\": \"error\",\n \"newPromise\": \"error\",\n \"nodeBuiltinImport\": \"error\",\n \"preferSchemaOverJson\": \"error\",\n \"processEnv\": \"error\",\n \"processEnvInEffect\": \"error\",\n \"unsafeEffectTypeAssertion\": \"error\",\n \"catchAllToMapError\": \"error\",\n \"deterministicKeys\": \"error\",\n \"effectDoNotation\": \"error\",\n \"effectFnOpportunity\": \"error\",\n \"effectMapFlatten\": \"error\",\n \"effectMapVoid\": \"error\",\n \"effectSucceedWithVoid\": \"error\",\n \"missedPipeableOpportunity\": \"error\",\n \"missingEffectServiceDependency\": \"error\",\n \"nestedEffectGenYield\": \"error\",\n \"redundantSchemaTagIdentifier\": \"error\",\n \"schemaStructWithTag\": \"error\",\n \"schemaUnionOfLiterals\": \"error\",\n \"serviceNotAsClass\": \"error\",\n \"strictBooleanExpressions\": \"error\",\n \"unnecessaryArrowBlock\": \"error\",\n \"unnecessaryEffectGen\": \"error\",\n \"unnecessaryFailYieldableError\": \"error\",\n \"unnecessaryPipe\": \"error\",\n \"unnecessaryPipeChain\": \"error\"\n }\n }\n ]\n },\n \"include\": [\"src\", \"api\", \"shared\", \"config\", \"modern.config.ts\"],\n \"exclude\": [\"**/node_modules\"]\n}\n",
|
|
16
|
-
".agents/skills-lock.json": "{\n \"schemaVersion\": 2,\n \"installDir\": \".agents/skills\",\n \"sources\": [\n {\n \"id\": \"techsiocz-private\",\n \"visibility\": \"private\",\n \"repository\": \"https://github.com/TechsioCZ/skills\",\n \"install\": \"clone-if-authorized\",\n \"baseline\": [\n {\n \"name\": \"plan-graph\",\n \"reason\": \"Build and validate DAGs from .plan.md files\"\n },\n {\n \"name\": \"dag\",\n \"reason\": \"Inspect current plan frontiers and blocked lanes\"\n },\n {\n \"name\": \"subagent-graph\",\n \"reason\": \"Design dependency-aware multi-agent launch graphs\"\n },\n {\n \"name\": \"helm\",\n \"reason\": \"Steer already-running multi-agent work\"\n },\n {\n \"name\": \"debugger-mode\",\n \"reason\": \"Run hypothesis-driven debugging with runtime evidence\"\n }\n ]\n }\n ]\n}\n",
|
|
17
|
-
"scripts/bootstrap-agent-skills.mjs": "import { execFileSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst lockPath = path.join(root, '.agents/skills-lock.json');\nconst checkOnly = process.argv.includes('--check');\nconst force = process.argv.includes('--force');\n\nconst readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8'));\n\nconst run = (command, args, options = {}) =>\n execFileSync(command, args, {\n cwd: options.cwd ?? root,\n encoding: 'utf-8',\n stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],\n });\n\nconst cloneSource = (source, targetDir) => {\n const repo = source.repository.replace(/^https:\\/\\/github.com\\//u, '');\n try {\n run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1'], {\n stdio: 'inherit',\n });\n } catch {\n run('git', ['clone', '--depth', '1', source.repository, targetDir], {\n stdio: 'inherit',\n });\n }\n};\n\nconst resolveSkillDir = (sourceRoot, skillName) => {\n const candidates = [\n path.join(sourceRoot, skillName),\n path.join(sourceRoot, 'skills', skillName),\n path.join(sourceRoot, 'skills', 'engineering', skillName),\n path.join(sourceRoot, 'skills', 'productivity', skillName),\n ];\n return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'SKILL.md')));\n};\n\nif (!fs.existsSync(lockPath)) {\n console.error('Missing .agents/skills-lock.json');\n process.exit(1);\n}\n\nconst lock = readJson(lockPath);\nconst installDir = path.join(root, lock.installDir ?? '.agents/skills');\nconst privateSources = (lock.sources ?? []).filter(\n (source) => source.install === 'clone-if-authorized',\n);\n\nif (checkOnly) {\n const missing = privateSources.flatMap((source) =>\n (source.baseline ?? [])\n .map((skill) => skill.name)\n .filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),\n );\n if (missing.length > 0) {\n console.warn(\n `Private skills not installed: ${missing.join(', ')}. Run pnpm skills:install if you have access.`,\n );\n } else {\n console.log('Agent skills are installed.');\n }\n process.exit(0);\n}\n\nfs.mkdirSync(installDir, { recursive: true });\n\nfor (const source of privateSources) {\n const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));\n try {\n cloneSource(source, tempDir);\n for (const skill of source.baseline ?? []) {\n const sourceSkillDir = resolveSkillDir(tempDir, skill.name);\n if (!sourceSkillDir) {\n throw new Error(`Skill ${skill.name} not found in ${source.repository}`);\n }\n const targetSkillDir = path.join(installDir, skill.name);\n if (fs.existsSync(targetSkillDir)) {\n if (!force) {\n console.log(`Skipping existing ${skill.name}`);\n continue;\n }\n fs.rmSync(targetSkillDir, { force: true, recursive: true });\n }\n fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });\n console.log(`Installed ${skill.name}`);\n }\n } finally {\n fs.rmSync(tempDir, { force: true, recursive: true });\n }\n}\n",
|
|
18
|
-
"scripts/check-i18n-strings.mjs": "import fs from 'node:fs';\nimport path from 'node:path';\n\nconst root = process.cwd();\nconst scanRoots = ['src'].map((scanRoot) => path.join(root, scanRoot));\nconst ignoredDirectories = new Set(['.modern', '.modernjs', 'dist', 'node_modules']);\nconst visibleAttributePattern =\n /\\s(?:aria-label|alt|placeholder|title)=[\"']([^\"']*[A-Za-z][^\"']*)[\"']/gu;\nconst jsxTextPattern = />([^<>{}]*[A-Za-z][^<>{}]*)</gu;\n\nconst collectFiles = (directory) => {\n if (!fs.existsSync(directory)) {\n return [];\n }\n\n const files = [];\n for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {\n if (entry.isDirectory()) {\n if (!ignoredDirectories.has(entry.name)) {\n files.push(...collectFiles(path.join(directory, entry.name)));\n }\n continue;\n }\n\n if (entry.isFile() && /\\.(jsx|tsx)$/u.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n files.push(path.join(directory, entry.name));\n }\n }\n return files;\n};\n\nconst lineNumberForIndex = (content, index) => content.slice(0, index).split('\\n').length;\nconst isIgnoredLine = (content, index) => {\n const lineStart = content.lastIndexOf('\\n', index) + 1;\n const lineEnd = content.indexOf('\\n', index);\n const currentLineEnd = lineEnd === -1 ? content.length : lineEnd;\n const previousLineStart = content.lastIndexOf('\\n', Math.max(0, lineStart - 2)) + 1;\n const nextLineEnd = content.indexOf('\\n', currentLineEnd + 1);\n const context = content.slice(\n previousLineStart,\n nextLineEnd === -1 ? content.length : nextLineEnd,\n );\n return /i18n-ignore/u.test(context);\n};\n\nconst violations = [];\nfor (const filePath of scanRoots.flatMap(collectFiles)) {\n const content = fs.readFileSync(filePath, 'utf-8');\n for (const match of content.matchAll(visibleAttributePattern)) {\n if (!isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text: match[1].trim(),\n });\n }\n }\n\n for (const match of content.matchAll(jsxTextPattern)) {\n const text = match[1].replaceAll(/\\s+/gu, ' ').trim();\n if (text && !isIgnoredLine(content, match.index ?? 0)) {\n violations.push({\n filePath,\n line: lineNumberForIndex(content, match.index ?? 0),\n text,\n });\n }\n }\n}\n\nif (violations.length > 0) {\n console.error('Hardcoded user-visible JSX strings found. Move copy to locale JSON files.');\n for (const violation of violations) {\n console.error(\n `${path.relative(root, violation.filePath)}:${violation.line} ${JSON.stringify(\n violation.text,\n )}`,\n );\n }\n process.exit(1);\n}\n\nconsole.log('No hardcoded user-visible JSX strings found.');\n",
|
|
19
|
-
"scripts/validate-ultramodern.mjs": "import fs from 'node:fs';\nimport path from 'node:path';\n\nconst configPath = path.resolve(process.cwd(), 'modern.config.ts');\nconst templateManifestPath = path.resolve(process.cwd(), '.modernjs/mv-template-manifest.json');\n\nif (!fs.existsSync(configPath)) {\n console.error('modern.config.ts not found');\n process.exit(1);\n}\n\nconst content = fs.readFileSync(configPath, 'utf-8');\nconst requiredTokens = [\n 'presetUltramodern(',\n 'appTools()',\n 'enableModuleFederationSSR',\n 'enableBffRequestId',\n 'enableTelemetryExporters',\n 'i18nPlugin(',\n];\nconst missing = requiredTokens.filter((token) => !content.includes(token));\n\nif (missing.length > 0) {\n console.error(`Ultramodern contract check failed. Missing tokens: ${missing.join(', ')}`);\n process.exit(1);\n}\n\nif (!fs.existsSync(templateManifestPath)) {\n console.error('.modernjs/mv-template-manifest.json not found');\n process.exit(1);\n}\n\nconst templateManifest = JSON.parse(fs.readFileSync(templateManifestPath, 'utf-8'));\nconst requiredDeniedPaths = [\n '.git/**',\n '.github/**',\n '.npmrc',\n '.yarnrc',\n '.env',\n '.env.*',\n 'node_modules/**',\n 'dist/**',\n];\nconst requiredPostMaterialization = [\n 'ultramodern-contract-check',\n 'dependency-install-with-lifecycle-deny',\n 'template-manifest-retained',\n];\nconst requiredPaths = [\n 'AGENTS.md',\n '.agents/skills-lock.json',\n 'oxlint.config.ts',\n 'oxfmt.config.ts',\n 'scripts/bootstrap-agent-skills.mjs',\n 'scripts/check-i18n-strings.mjs',\n 'config/public/locales/en/translation.json',\n 'config/public/locales/cs/translation.json',\n];\nconst manifestErrors = [];\n\nfor (const requiredPath of requiredPaths) {\n if (!fs.existsSync(path.resolve(process.cwd(), requiredPath))) {\n console.error(`${requiredPath} not found`);\n process.exit(1);\n }\n}\n\nif (templateManifest.schemaVersion !== 1) {\n manifestErrors.push('schemaVersion');\n}\n\nif (templateManifest.source?.type !== 'builtin') {\n manifestErrors.push('source.type');\n}\n\nif (\n !Array.isArray(templateManifest.integrity?.checksums) ||\n !templateManifest.integrity.checksums.some(\n (checksum) =>\n checksum.algorithm === 'sha256' &&\n checksum.scope === 'source-tree' &&\n /^[0-9a-f]{64}$/u.test(checksum.value),\n )\n) {\n manifestErrors.push('integrity.checksums[source-tree]');\n}\n\nfor (const deniedPath of requiredDeniedPaths) {\n if (!templateManifest.materialization?.deniedPaths?.includes(deniedPath)) {\n manifestErrors.push(`materialization.deniedPaths:${deniedPath}`);\n }\n}\n\nif (templateManifest.lifecyclePolicy?.denyByDefault !== true) {\n manifestErrors.push('lifecyclePolicy.denyByDefault');\n}\n\nfor (const token of requiredPostMaterialization) {\n if (!templateManifest.validation?.postMaterializationValidation?.includes(token)) {\n manifestErrors.push(`validation.postMaterializationValidation:${token}`);\n }\n}\n\nif (manifestErrors.length > 0) {\n console.error(\n `Ultramodern template manifest check failed. Invalid fields: ${manifestErrors.join(', ')}`,\n );\n process.exit(1);\n}\n\nconst packageJson = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), 'package.json'), 'utf-8'),\n);\nconst unresolvedTemplateMarker = String.fromCodePoint(123, 123);\nif (JSON.stringify(packageJson).includes(unresolvedTemplateMarker)) {\n console.error('package.json contains unresolved template markers');\n process.exit(1);\n}\nconst skillsLock = JSON.parse(\n fs.readFileSync(path.resolve(process.cwd(), '.agents/skills-lock.json'), 'utf-8'),\n);\nconst requiredScripts = {\n format: 'oxfmt .',\n 'format:check': 'oxfmt --check .',\n 'i18n:check': 'node ./scripts/check-i18n-strings.mjs',\n lint: 'oxlint .',\n 'lint:fix': 'oxlint . --fix',\n 'skills:check': 'node ./scripts/bootstrap-agent-skills.mjs --check',\n 'skills:install': 'node ./scripts/bootstrap-agent-skills.mjs',\n};\n\nfor (const [scriptName, scriptCommand] of Object.entries(requiredScripts)) {\n if (packageJson.scripts?.[scriptName] !== scriptCommand) {\n console.error(`Missing or invalid package script: ${scriptName}`);\n process.exit(1);\n }\n}\n\nif (\n !packageJson.scripts?.typecheck?.includes('effect-tsgo') ||\n !packageJson.scripts.typecheck.includes('get-exe-path')\n) {\n console.error('typecheck must use effect-tsgo as the TypeScript checker');\n process.exit(1);\n}\n\nfor (const dependency of ['@modern-js/plugin-i18n', 'i18next', 'react-i18next']) {\n if (!packageJson.dependencies?.[dependency]) {\n console.error(`Missing dependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nfor (const dependency of [\n '@effect/tsgo',\n '@typescript/native-preview',\n 'oxlint',\n 'oxfmt',\n 'ultracite',\n]) {\n if (!packageJson.devDependencies?.[dependency]) {\n console.error(`Missing devDependency: ${dependency}`);\n process.exit(1);\n }\n}\n\nconst privateSource = skillsLock.sources?.find(\n (source) => source.repository === 'https://github.com/TechsioCZ/skills',\n);\nconst privateSkills = new Set(privateSource?.baseline?.map((skill) => skill.name));\nfor (const skillName of ['plan-graph', 'dag', 'subagent-graph', 'helm', 'debugger-mode']) {\n if (!privateSkills.has(skillName)) {\n console.error(`Missing private skill allowlist entry: ${skillName}`);\n process.exit(1);\n }\n}\n\nconsole.log('Ultramodern contract check passed.');\n",
|
|
20
|
-
".github/workflows/ultramodern-gates.yml": "name: Ultramodern Gates\n\non:\n push:\n pull_request:\n\njobs:\n ultramodern-gates:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n uses: actions/checkout@v4\n\n - name: Setup pnpm\n uses: pnpm/action-setup@v4\n\n - name: Setup Node.js\n uses: actions/setup-node@v4\n with:\n node-version: 20\n cache: pnpm\n\n - name: Install Dependencies\n run: pnpm install\n\n - name: Validate Ultramodern Contract\n run: pnpm run ultramodern:check\n\n - name: Build\n run: pnpm run build\n",
|
|
21
|
-
"api/effect/index.ts": "\n",
|
|
22
|
-
"api/lambda/hello.ts": "",
|
|
23
|
-
"shared/effect/api.ts": "\n",
|
|
8
|
+
"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',
|
|
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",
|
|
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 "lint": "biome check"\n },\n "engines": {\n "node": ">=20"\n },\n "dependencies": {\n "@modern-js/runtime": "3.2.1",\n "react": "^19.2.3",\n "react-dom": "^19.2.0"\n },\n "devDependencies": {\n "@modern-js/app-tools": "3.2.1",\n "@modern-js/tsconfig": "3.2.1",\n "@biomejs/biome": "1.9.4",\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 \"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",
|
|
24
12
|
"src/modern-app-env.d.ts": "/// <reference types='@modern-js/app-tools/types' />\n",
|
|
25
|
-
"src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\
|
|
26
|
-
"src/routes/index.css": "html,\nbody {\n padding: 0;\n margin: 0;\n font-family
|
|
27
|
-
"src/routes/layout.tsx": "import { Outlet } from '@modern-js/runtime/';\n\nexport default function Layout() {\n return (\n <div>\n <Outlet />\n </div>\n );\n}\n",
|
|
28
|
-
"src/routes/page.tsx": 'import { Helmet } from \'@modern-js/runtime/head\';\nimport
|
|
29
|
-
"config/public/locales/cs/translation.json": '{\n "home": {\n "bff": {\n "response": "Odpoved Effect HttpApi:"\n },\n "cards": {\n "bff": {\n "body": "Pouzivej Effect jako hlavni BFF cestu, Hono nech jako explicitni zalozni volbu.",\n "title": "BFF + Effect"\n },\n "config": {\n "body": "Upravuj vygenerovane vychozi hodnoty v modern.config.ts.",\n "title": "Konfigurace presetUltramodern"\n },\n "gates": {\n "body": "Starter obsahuje PR workflow pro ultramodern:check a build.",\n "title": "Ultramodern kontroly"\n },\n "guide": {\n "body": "Projdi si verejny preset pripraveny pro MV, TanStack a Effect.",\n "title": "UltraModern.js pruvodce"\n }\n },\n "description": {\n "afterConfig": ", udrzuj",\n "afterPreset": "profil. Zacni v",\n "end": "zelene a lad vygenerovany preset jen tam, kde aplikace potrebuje mekci cestu.",\n "intro": "Tento starter prinasi verejny"\n },\n "language": {\n "cs": "Cestina",\n "en": "Anglictina",\n "switcher": "Jazyk"\n },\n "logoAlt": "Logo UltraModern.js",\n "name": "presetUltramodern",\n "title": "UltraModern.js 3.0"\n }\n}\n',
|
|
30
|
-
"config/public/locales/en/translation.json": '{\n "home": {\n "bff": {\n "response": "Effect HttpApi response:"\n },\n "cards": {\n "bff": {\n "body": "Keep Effect as the preferred BFF lane while Hono stays an explicit fallback.",\n "title": "BFF + Effect"\n },\n "config": {\n "body": "Tune the generated defaults in modern.config.ts.",\n "title": "Configure presetUltramodern"\n },\n "gates": {\n "body": "The starter includes a PR workflow for ultramodern:check and build.",\n "title": "Ultramodern Gates"\n },\n "guide": {\n "body": "Review the MV-first, TanStack-ready, Effect-ready public preset.",\n "title": "UltraModern.js Guide"\n }\n },\n "description": {\n "afterConfig": ", keep",\n "afterPreset": "profile. Start in",\n "end": "green, and tune the generated preset only where your app needs a softer lane.",\n "intro": "This starter ships the public"\n },\n "language": {\n "cs": "Czech",\n "en": "English",\n "switcher": "Language"\n },\n "logoAlt": "UltraModern.js Logo",\n "name": "presetUltramodern",\n "title": "UltraModern.js 3.0"\n }\n}\n'
|
|
13
|
+
"src/modern.runtime.ts": "import { defineRuntimeConfig } from '@modern-js/runtime';\n\nexport default defineRuntimeConfig({});\n",
|
|
14
|
+
"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:\n 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",
|
|
15
|
+
"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",
|
|
16
|
+
"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'
|
|
31
17
|
};
|
|
32
18
|
export { MWAFiles };
|
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
export declare const MWAFiles: {
|
|
2
|
-
".codesandbox/tasks.json": string;
|
|
3
2
|
".codesandbox/environment.json": string;
|
|
3
|
+
".codesandbox/tasks.json": string;
|
|
4
4
|
".browserslistrc": string;
|
|
5
5
|
".gitignore": string;
|
|
6
6
|
".npmrc": string;
|
|
7
|
-
"
|
|
7
|
+
"biome.json": string;
|
|
8
8
|
"modern.config.ts": string;
|
|
9
|
-
"oxfmt.config.ts": string;
|
|
10
|
-
"oxlint.config.ts": string;
|
|
11
9
|
"package.json": string;
|
|
12
|
-
"postcss.config.mjs": string;
|
|
13
|
-
"tailwind.config.ts": string;
|
|
14
10
|
"tsconfig.json": string;
|
|
15
|
-
".agents/skills-lock.json": string;
|
|
16
|
-
"scripts/bootstrap-agent-skills.mjs": string;
|
|
17
|
-
"scripts/check-i18n-strings.mjs": string;
|
|
18
|
-
"scripts/validate-ultramodern.mjs": string;
|
|
19
|
-
".github/workflows/ultramodern-gates.yml": string;
|
|
20
|
-
"api/effect/index.ts": string;
|
|
21
|
-
"api/lambda/hello.ts": string;
|
|
22
|
-
"shared/effect/api.ts": string;
|
|
23
11
|
"src/modern-app-env.d.ts": string;
|
|
24
12
|
"src/modern.runtime.ts": string;
|
|
25
13
|
"src/routes/index.css": string;
|
|
26
14
|
"src/routes/layout.tsx": string;
|
|
27
15
|
"src/routes/page.tsx": string;
|
|
28
|
-
"config/public/locales/cs/translation.json": string;
|
|
29
|
-
"config/public/locales/en/translation.json": string;
|
|
30
16
|
};
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/BleedingDev/ultramodern.js.git",
|
|
11
|
-
"directory": "packages/
|
|
11
|
+
"directory": "packages/toolkit/sandpack-react"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"keywords": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.2.0-ultramodern.
|
|
20
|
+
"version": "3.2.0-ultramodern.121",
|
|
21
21
|
"types": "./dist/types/index.d.ts",
|
|
22
22
|
"main": "./dist/cjs/index.js",
|
|
23
23
|
"module": "./dist/esm/index.mjs",
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@codesandbox/sandpack-react": "^2.20.0",
|
|
39
|
-
"@swc/helpers": "^0.5.
|
|
40
|
-
"react": "^19.2.
|
|
41
|
-
"react-dom": "^19.2.
|
|
39
|
+
"@swc/helpers": "^0.5.23",
|
|
40
|
+
"react": "^19.2.7",
|
|
41
|
+
"react-dom": "^19.2.7"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@rslib/core": "0.
|
|
45
|
-
"@types/node": "^25.
|
|
46
|
-
"@types/react": "^19.2.
|
|
44
|
+
"@rslib/core": "0.22.0",
|
|
45
|
+
"@types/node": "^25.9.3",
|
|
46
|
+
"@types/react": "^19.2.17",
|
|
47
47
|
"@types/react-dom": "^19.2.3",
|
|
48
48
|
"@types/recursive-readdir": "^2.2.4",
|
|
49
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
49
|
+
"@typescript/native-preview": "7.0.0-dev.20260610.1",
|
|
50
50
|
"recursive-readdir": "^2.2.3",
|
|
51
|
-
"@modern-js/create": "npm:@bleedingdev/modern-js-create@3.2.0-ultramodern.
|
|
51
|
+
"@modern-js/create": "npm:@bleedingdev/modern-js-create@3.2.0-ultramodern.121"
|
|
52
52
|
},
|
|
53
53
|
"sideEffects": false,
|
|
54
54
|
"publishConfig": {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
.env.local
|
|
6
|
+
.env.*.local
|
|
7
|
+
.history
|
|
8
|
+
*.log*
|
|
9
|
+
|
|
10
|
+
node_modules/
|
|
11
|
+
.yarn-integrity
|
|
12
|
+
.pnpm-store/
|
|
13
|
+
*.tsbuildinfo
|
|
14
|
+
.changeset/pre.json
|
|
15
|
+
|
|
16
|
+
dist/
|
|
17
|
+
coverage/
|
|
18
|
+
release/
|
|
19
|
+
output/
|
|
20
|
+
output_resource/
|
|
21
|
+
log/
|
|
22
|
+
|
|
23
|
+
.vscode/**/*
|
|
24
|
+
!.vscode/settings.json
|
|
25
|
+
!.vscode/extensions.json
|
|
26
|
+
.idea/
|
|
27
|
+
|
|
28
|
+
**/*/typings/auto-generated
|
|
29
|
+
|
|
30
|
+
modern.config.local.*
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Modern.js App
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Install the dependencies:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Get Started
|
|
12
|
+
|
|
13
|
+
Start the start server:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm start
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Build the app for production:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm build
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Preview the production build locally:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm serve
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For more information, see the [Modern.js documentation](https://modernjs.dev/en).
|
|
32
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"defaultBranch": "main",
|
|
6
|
+
"clientKind": "git",
|
|
7
|
+
"useIgnoreFile": true
|
|
8
|
+
},
|
|
9
|
+
"formatter": {
|
|
10
|
+
"enabled": true,
|
|
11
|
+
"indentStyle": "space"
|
|
12
|
+
},
|
|
13
|
+
"javascript": {
|
|
14
|
+
"formatter": {
|
|
15
|
+
"quoteStyle": "single",
|
|
16
|
+
"arrowParentheses": "asNeeded",
|
|
17
|
+
"jsxQuoteStyle": "double",
|
|
18
|
+
"lineWidth": 80
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"linter": {
|
|
22
|
+
"enabled": true,
|
|
23
|
+
"rules": {
|
|
24
|
+
"recommended": true,
|
|
25
|
+
"suspicious": {
|
|
26
|
+
"noDuplicateFontNames": "off"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"organizeImports": {
|
|
31
|
+
"enabled": true
|
|
32
|
+
},
|
|
33
|
+
"files": {
|
|
34
|
+
"ignoreUnknown": true,
|
|
35
|
+
"ignore": [".vscode/**/*", "node_modules/**/*", "dist/**/*"]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"dev": "modern dev",
|
|
6
|
+
"build": "modern build",
|
|
7
|
+
"serve": "modern serve"{{#unless isSubproject}},
|
|
8
|
+
"lint": "biome check"{{/unless}}
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=20"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@modern-js/runtime": "{{version}}",
|
|
15
|
+
"react": "^19.2.3",
|
|
16
|
+
"react-dom": "^19.2.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@modern-js/app-tools": "{{version}}",
|
|
20
|
+
"@modern-js/tsconfig": "{{version}}"{{#unless isSubproject}},
|
|
21
|
+
"@biomejs/biome": "1.9.4"{{/unless}},
|
|
22
|
+
"typescript": "~5.7.3",
|
|
23
|
+
"@types/node": "^20",
|
|
24
|
+
"@types/react": "^19.1.8",
|
|
25
|
+
"@types/react-dom": "^19.1.6"
|
|
26
|
+
}
|
|
27
|
+
}
|
package/scripts/template.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { fs } from '@modern-js/codesmith-utils/fs-extra';
|
|
1
|
+
import fs from 'node:fs';
|
|
3
2
|
import { createRequire } from 'module';
|
|
4
3
|
import path from 'path';
|
|
5
4
|
import recursive from 'recursive-readdir';
|
|
@@ -14,6 +13,80 @@ const IgnoreFiles = [
|
|
|
14
13
|
'README.md',
|
|
15
14
|
];
|
|
16
15
|
|
|
16
|
+
function renderTemplate(
|
|
17
|
+
template: string,
|
|
18
|
+
data: Record<string, unknown>,
|
|
19
|
+
): string {
|
|
20
|
+
type ConditionalKind = 'if' | 'unless';
|
|
21
|
+
const tagRegex = /\{\{(~?)(#if|#unless|\/if|\/unless)(?:\s+(\w+))?(~?)\}\}/g;
|
|
22
|
+
|
|
23
|
+
function renderConditionals(
|
|
24
|
+
startIndex: number,
|
|
25
|
+
expectedClose?: ConditionalKind,
|
|
26
|
+
): {
|
|
27
|
+
rendered: string;
|
|
28
|
+
nextIndex: number;
|
|
29
|
+
} {
|
|
30
|
+
let rendered = '';
|
|
31
|
+
let cursor = startIndex;
|
|
32
|
+
tagRegex.lastIndex = startIndex;
|
|
33
|
+
|
|
34
|
+
while (true) {
|
|
35
|
+
const match = tagRegex.exec(template);
|
|
36
|
+
if (!match) {
|
|
37
|
+
return {
|
|
38
|
+
rendered: rendered + template.slice(cursor),
|
|
39
|
+
nextIndex: template.length,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const [raw, , tag, condition, rightTrim] = match;
|
|
44
|
+
const tagIndex = match.index;
|
|
45
|
+
rendered += template.slice(cursor, tagIndex);
|
|
46
|
+
cursor = tagIndex + raw.length;
|
|
47
|
+
|
|
48
|
+
if (tag === '#if' || tag === '#unless') {
|
|
49
|
+
const kind: ConditionalKind = tag === '#if' ? 'if' : 'unless';
|
|
50
|
+
const innerResult = renderConditionals(cursor, kind);
|
|
51
|
+
cursor = innerResult.nextIndex;
|
|
52
|
+
tagRegex.lastIndex = cursor;
|
|
53
|
+
|
|
54
|
+
const conditionValue = Boolean(data[condition ?? '']);
|
|
55
|
+
const shouldInclude = kind === 'if' ? conditionValue : !conditionValue;
|
|
56
|
+
if (shouldInclude) {
|
|
57
|
+
rendered += innerResult.rendered;
|
|
58
|
+
}
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (tag === '/if' || tag === '/unless') {
|
|
63
|
+
const kind: ConditionalKind = tag === '/if' ? 'if' : 'unless';
|
|
64
|
+
if (expectedClose === kind) {
|
|
65
|
+
let nextIndex = cursor;
|
|
66
|
+
if (rightTrim === '~') {
|
|
67
|
+
const trailingWhitespace = /^\s*/u.exec(template.slice(nextIndex));
|
|
68
|
+
nextIndex += trailingWhitespace?.[0].length ?? 0;
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
rendered,
|
|
72
|
+
nextIndex,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
rendered += raw;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let result = renderConditionals(0).rendered;
|
|
81
|
+
const varRegex = /\{\{(\w+)\}\}/g;
|
|
82
|
+
result = result.replace(varRegex, (match, key) => {
|
|
83
|
+
const value = data[key];
|
|
84
|
+
return value !== undefined && value !== null ? String(value) : match;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
|
|
17
90
|
export async function handleTemplate(
|
|
18
91
|
templatePath: string,
|
|
19
92
|
data: Record<string, any> = {},
|
|
@@ -35,7 +108,7 @@ export async function handleTemplate(
|
|
|
35
108
|
`${routerPrefix}${file
|
|
36
109
|
.replace('.handlebars', fileExtra)
|
|
37
110
|
.replace('npmrc', '.npmrc')}`.replace('language', 'ts')
|
|
38
|
-
] =
|
|
111
|
+
] = renderTemplate(fs.readFileSync(filePath, 'utf-8'), data);
|
|
39
112
|
} else {
|
|
40
113
|
files[`${routerPrefix}${file}`] = `${fs.readFileSync(
|
|
41
114
|
filePath,
|
|
@@ -56,12 +129,35 @@ async function handleCodesandboxTemplate() {
|
|
|
56
129
|
return files;
|
|
57
130
|
}
|
|
58
131
|
|
|
132
|
+
function resolvePackageRoot(entryPath: string, packageName: string): string {
|
|
133
|
+
let directory = path.dirname(entryPath);
|
|
134
|
+
|
|
135
|
+
while (directory !== path.dirname(directory)) {
|
|
136
|
+
const packageJsonPath = path.join(directory, 'package.json');
|
|
137
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
138
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
139
|
+
if (packageJson.name === packageName) {
|
|
140
|
+
return directory;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
directory = path.dirname(directory);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
throw new Error(`Unable to resolve package root for ${packageName}.`);
|
|
147
|
+
}
|
|
148
|
+
|
|
59
149
|
async function handleCreateTemplate() {
|
|
60
150
|
const createPackageMainPath = require.resolve('@modern-js/create');
|
|
61
|
-
const createPackagePath =
|
|
151
|
+
const createPackagePath = resolvePackageRoot(
|
|
152
|
+
createPackageMainPath,
|
|
153
|
+
'@modern-js/create',
|
|
154
|
+
);
|
|
62
155
|
const createPackageJsonPath = path.join(createPackagePath, 'package.json');
|
|
63
156
|
|
|
64
|
-
|
|
157
|
+
// Vendored copy of the upstream single-app MWA template (the old
|
|
158
|
+
// @modern-js/create `template/` directory). The workspace-shell template
|
|
159
|
+
// cannot run inside a browser Sandpack/Nodebox environment.
|
|
160
|
+
const templateDir = path.join(import.meta.dirname, 'mwa-template');
|
|
65
161
|
|
|
66
162
|
const createPackageJson = JSON.parse(
|
|
67
163
|
fs.readFileSync(createPackageJsonPath, 'utf-8'),
|