@bleedingdev/modern-js-create 3.4.0-ultramodern.12 → 3.4.0-ultramodern.14
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/README.md +13 -11
- package/dist/cjs/index.cjs +36 -3
- package/dist/cjs/locale/en.cjs +10 -0
- package/dist/cjs/locale/zh.cjs +10 -0
- package/dist/cjs/ultramodern-tooling/commands.cjs +185 -0
- package/dist/cjs/ultramodern-tooling/config.cjs +248 -0
- package/dist/cjs/ultramodern-workspace/add-vertical.cjs +64 -25
- package/dist/cjs/ultramodern-workspace/bridge-config.cjs +327 -0
- package/dist/cjs/ultramodern-workspace/codesmith.cjs +1 -0
- package/dist/cjs/ultramodern-workspace/contracts.cjs +119 -653
- package/dist/cjs/ultramodern-workspace/descriptors.cjs +4 -0
- package/dist/cjs/ultramodern-workspace/fs-io.cjs +117 -0
- package/dist/cjs/ultramodern-workspace/generation-result.cjs +1 -1
- package/dist/cjs/ultramodern-workspace/index.cjs +4 -0
- package/dist/cjs/ultramodern-workspace/mf-validation.cjs +572 -0
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +14 -0
- package/dist/cjs/ultramodern-workspace/package-json.cjs +26 -12
- package/dist/cjs/ultramodern-workspace/public-api.cjs +4 -0
- package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +74 -44
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +55 -15
- package/dist/esm/index.js +36 -3
- package/dist/esm/locale/en.js +10 -0
- package/dist/esm/locale/zh.js +10 -0
- package/dist/esm/ultramodern-tooling/commands.js +132 -0
- package/dist/esm/ultramodern-tooling/config.js +196 -0
- package/dist/esm/ultramodern-workspace/add-vertical.js +65 -29
- package/dist/esm/ultramodern-workspace/bridge-config.js +270 -0
- package/dist/esm/ultramodern-workspace/codesmith.js +1 -0
- package/dist/esm/ultramodern-workspace/contracts.js +122 -608
- package/dist/esm/ultramodern-workspace/descriptors.js +2 -1
- package/dist/esm/ultramodern-workspace/fs-io.js +116 -2
- package/dist/esm/ultramodern-workspace/generation-result.js +2 -2
- package/dist/esm/ultramodern-workspace/index.js +1 -0
- package/dist/esm/ultramodern-workspace/mf-validation.js +517 -0
- package/dist/esm/ultramodern-workspace/module-federation.js +14 -0
- package/dist/esm/ultramodern-workspace/package-json.js +26 -12
- package/dist/esm/ultramodern-workspace/public-api.js +1 -0
- package/dist/esm/ultramodern-workspace/workspace-scripts.js +75 -27
- package/dist/esm/ultramodern-workspace/write-workspace.js +56 -19
- package/dist/esm-node/index.js +36 -3
- package/dist/esm-node/locale/en.js +10 -0
- package/dist/esm-node/locale/zh.js +10 -0
- package/dist/esm-node/ultramodern-tooling/commands.js +133 -0
- package/dist/esm-node/ultramodern-tooling/config.js +197 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical.js +65 -29
- package/dist/esm-node/ultramodern-workspace/bridge-config.js +271 -0
- package/dist/esm-node/ultramodern-workspace/codesmith.js +1 -0
- package/dist/esm-node/ultramodern-workspace/contracts.js +122 -608
- package/dist/esm-node/ultramodern-workspace/descriptors.js +2 -1
- package/dist/esm-node/ultramodern-workspace/fs-io.js +116 -2
- package/dist/esm-node/ultramodern-workspace/generation-result.js +2 -2
- package/dist/esm-node/ultramodern-workspace/index.js +1 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation.js +518 -0
- package/dist/esm-node/ultramodern-workspace/module-federation.js +14 -0
- package/dist/esm-node/ultramodern-workspace/package-json.js +26 -12
- package/dist/esm-node/ultramodern-workspace/public-api.js +1 -0
- package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +75 -27
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +56 -19
- package/dist/types/locale/en.d.ts +10 -0
- package/dist/types/locale/index.d.ts +20 -0
- package/dist/types/locale/zh.d.ts +10 -0
- package/dist/types/ultramodern-tooling/commands.d.ts +1 -0
- package/dist/types/ultramodern-tooling/config.d.ts +43 -0
- package/dist/types/ultramodern-workspace/add-vertical.d.ts +5 -2
- package/dist/types/ultramodern-workspace/bridge-config.d.ts +64 -0
- package/dist/types/ultramodern-workspace/codesmith.d.ts +1 -0
- package/dist/types/ultramodern-workspace/contracts.d.ts +2 -17
- package/dist/types/ultramodern-workspace/descriptors.d.ts +1 -0
- package/dist/types/ultramodern-workspace/fs-io.d.ts +1 -0
- package/dist/types/ultramodern-workspace/index.d.ts +2 -0
- package/dist/types/ultramodern-workspace/mf-validation.d.ts +27 -0
- package/dist/types/ultramodern-workspace/package-json.d.ts +4 -3
- package/dist/types/ultramodern-workspace/public-api.d.ts +2 -0
- package/dist/types/ultramodern-workspace/types.d.ts +2 -0
- package/dist/types/ultramodern-workspace/workspace-scripts.d.ts +1 -7
- package/dist/types/ultramodern-workspace/write-workspace.d.ts +4 -2
- package/package.json +5 -3
- package/template-workspace/{.agents → .codex}/skills-lock.json +12 -12
- package/template-workspace/.gitignore.handlebars +3 -0
- package/template-workspace/AGENTS.md.handlebars +11 -5
- package/template-workspace/README.md.handlebars +15 -12
- package/template-workspace/oxfmt.config.ts +1 -0
- package/template-workspace/oxlint.config.ts +1 -0
- package/template-workspace/scripts/bootstrap-agent-skills.mjs +77 -67
- package/templates/workspace-scripts/assert-mf-types.mjs.handlebars +56 -3
- package/templates/workspace-scripts/generate-public-surface-assets.mjs +239 -4
- package/templates/workspace-scripts/proof-cloudflare-version.mjs +282 -4
- package/templates/workspace-scripts/ultramodern-performance-readiness.mjs +172 -1
- package/templates/workspace-scripts/ultramodern-typecheck.mjs +4 -2
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +783 -26
- /package/template-workspace/{.agents → .codex}/rstackjs-agent-skills-LICENSE +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsbuild-best-practices/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/command-map.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/common-analysis-patterns.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-common.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-rspack.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-webpack.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/rsdoctor-data-types.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rslib-best-practices/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rslib-modern-package/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-best-practices/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/references/bottlenecks.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/references/tracing-guide.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/scripts/analyze_trace.js +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rstest-best-practices/SKILL.md +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { packageName, toCamelCase, toEnvSegment, toKebabCase, toPascalCase } from "./naming.js";
|
|
2
2
|
const GENERATED_CONTRACT_PATH = '.modernjs/ultramodern-generated-contract.json';
|
|
3
|
+
const ULTRAMODERN_CONFIG_PATH = '.modernjs/ultramodern.json';
|
|
3
4
|
const shellApp = {
|
|
4
5
|
id: 'shell-super-app',
|
|
5
6
|
directory: 'apps/shell-super-app',
|
|
@@ -130,4 +131,4 @@ function createCloudflarePublicUrlEnv(app) {
|
|
|
130
131
|
function appI18nNamespace(app) {
|
|
131
132
|
return 'shell' === app.kind ? 'shell' : app.domain ?? app.id;
|
|
132
133
|
}
|
|
133
|
-
export { GENERATED_CONTRACT_PATH, appHasEffectApi, appI18nNamespace, createCloudflarePublicUrlEnv, createCloudflareWorkerName, createModuleFederationRemoteContracts, createNeutralOwnership, createRemoteManifestEnv, createShellHost, createVerticalDescriptor, effectApiPrefix, effectApiStem, remoteDependencyAlias, resolveRemoteRefs, sharedPackages, shellApp, verticalEffectApps, zephyrRemoteDependency };
|
|
134
|
+
export { GENERATED_CONTRACT_PATH, ULTRAMODERN_CONFIG_PATH, appHasEffectApi, appI18nNamespace, createCloudflarePublicUrlEnv, createCloudflareWorkerName, createModuleFederationRemoteContracts, createNeutralOwnership, createRemoteManifestEnv, createShellHost, createVerticalDescriptor, effectApiPrefix, effectApiStem, remoteDependencyAlias, resolveRemoteRefs, sharedPackages, shellApp, verticalEffectApps, zephyrRemoteDependency };
|
|
@@ -1,13 +1,47 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
1
2
|
import node_crypto from "node:crypto";
|
|
2
3
|
import node_fs from "node:fs";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
3
5
|
import node_path from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
7
|
import { resolveCreatePackageRoot } from "../create-package-root.js";
|
|
6
8
|
import { normalizePath } from "./naming.js";
|
|
7
9
|
const fs_io_dirname = node_path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const fs_io_require = createRequire(import.meta.url);
|
|
8
11
|
const createPackageRoot = resolveCreatePackageRoot(fs_io_dirname);
|
|
9
12
|
const workspaceTemplateDir = node_path.join(createPackageRoot, 'template-workspace');
|
|
10
13
|
const fileTemplatesDir = node_path.join(createPackageRoot, 'templates');
|
|
14
|
+
const preformatConfigDir = '.modern-js';
|
|
15
|
+
const preformatConfigPath = node_path.join(preformatConfigDir, 'ultramodern-preformat.oxfmt.config.mjs');
|
|
16
|
+
const workspaceOxfmtIgnorePatterns = [
|
|
17
|
+
'.agents',
|
|
18
|
+
'.codex/skills',
|
|
19
|
+
'.output',
|
|
20
|
+
'**/*.json',
|
|
21
|
+
'dist',
|
|
22
|
+
'node_modules',
|
|
23
|
+
'repos/**',
|
|
24
|
+
'.modern',
|
|
25
|
+
'.modernjs',
|
|
26
|
+
'**/modern-tanstack/**',
|
|
27
|
+
'**/routeTree.gen.*'
|
|
28
|
+
];
|
|
29
|
+
const formattableExtensions = new Set([
|
|
30
|
+
'.cjs',
|
|
31
|
+
'.cts',
|
|
32
|
+
'.js',
|
|
33
|
+
'.json',
|
|
34
|
+
'.jsonc',
|
|
35
|
+
'.jsx',
|
|
36
|
+
'.mjs',
|
|
37
|
+
'.mts',
|
|
38
|
+
'.md',
|
|
39
|
+
'.mdx',
|
|
40
|
+
'.ts',
|
|
41
|
+
'.tsx',
|
|
42
|
+
'.yaml',
|
|
43
|
+
'.yml'
|
|
44
|
+
]);
|
|
11
45
|
function readFileTemplate(relativePath) {
|
|
12
46
|
return node_fs.readFileSync(node_path.join(fileTemplatesDir, relativePath), 'utf-8');
|
|
13
47
|
}
|
|
@@ -43,6 +77,86 @@ function writeFileReplacing(targetDir, relativePath, content) {
|
|
|
43
77
|
function writeJson(targetDir, relativePath, value) {
|
|
44
78
|
writeFile(targetDir, relativePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
45
79
|
}
|
|
80
|
+
function formatGeneratedWorkspaceFiles(targetDir, relativePaths) {
|
|
81
|
+
const oxfmtBin = resolveOxfmtBin();
|
|
82
|
+
const oxfmtConfigPath = writePreformatConfig(targetDir);
|
|
83
|
+
const targets = void 0 === relativePaths ? [
|
|
84
|
+
targetDir,
|
|
85
|
+
`!${normalizePath(node_path.join(targetDir, 'repos'))}/**`
|
|
86
|
+
] : relativePaths.filter((relativePath)=>formattableExtensions.has(node_path.extname(relativePath))).map((relativePath)=>node_path.join(targetDir, relativePath));
|
|
87
|
+
if (0 === targets.length) return void removePreformatConfig(targetDir);
|
|
88
|
+
try {
|
|
89
|
+
const result = spawnSync(process.execPath, [
|
|
90
|
+
oxfmtBin,
|
|
91
|
+
'--config',
|
|
92
|
+
oxfmtConfigPath,
|
|
93
|
+
'--no-error-on-unmatched-pattern',
|
|
94
|
+
...targets
|
|
95
|
+
], {
|
|
96
|
+
cwd: targetDir,
|
|
97
|
+
encoding: 'utf-8',
|
|
98
|
+
env: {
|
|
99
|
+
...process.env,
|
|
100
|
+
FORCE_COLOR: '0'
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
if (0 !== result.status) {
|
|
104
|
+
const detail = [
|
|
105
|
+
result.stderr.trim(),
|
|
106
|
+
result.stdout.trim()
|
|
107
|
+
].filter(Boolean).join('\n');
|
|
108
|
+
throw new Error([
|
|
109
|
+
'Failed to format generated UltraModern workspace output.',
|
|
110
|
+
detail
|
|
111
|
+
].filter(Boolean).join('\n'));
|
|
112
|
+
}
|
|
113
|
+
} finally{
|
|
114
|
+
removePreformatConfig(targetDir);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function writePreformatConfig(targetDir) {
|
|
118
|
+
const configPath = node_path.join(targetDir, preformatConfigPath);
|
|
119
|
+
node_fs.mkdirSync(node_path.dirname(configPath), {
|
|
120
|
+
recursive: true
|
|
121
|
+
});
|
|
122
|
+
const oxfmtUrl = pathToFileURL(resolveOxfmtEntry()).href;
|
|
123
|
+
const ultraciteConfigUrl = pathToFileURL(resolveUltraciteOxfmtConfig()).href;
|
|
124
|
+
node_fs.writeFileSync(configPath, [
|
|
125
|
+
`import { defineConfig } from ${JSON.stringify(oxfmtUrl)};`,
|
|
126
|
+
`import ultracite from ${JSON.stringify(ultraciteConfigUrl)};`,
|
|
127
|
+
'',
|
|
128
|
+
'export default defineConfig({',
|
|
129
|
+
' extends: [ultracite],',
|
|
130
|
+
' ignorePatterns: [',
|
|
131
|
+
...workspaceOxfmtIgnorePatterns.map((pattern)=>` ${JSON.stringify(pattern)},`),
|
|
132
|
+
' ],',
|
|
133
|
+
' singleQuote: true,',
|
|
134
|
+
'});',
|
|
135
|
+
''
|
|
136
|
+
].join('\n'), 'utf-8');
|
|
137
|
+
return configPath;
|
|
138
|
+
}
|
|
139
|
+
function removePreformatConfig(targetDir) {
|
|
140
|
+
node_fs.rmSync(node_path.join(targetDir, preformatConfigPath), {
|
|
141
|
+
force: true
|
|
142
|
+
});
|
|
143
|
+
try {
|
|
144
|
+
node_fs.rmdirSync(node_path.join(targetDir, preformatConfigDir));
|
|
145
|
+
} catch {}
|
|
146
|
+
}
|
|
147
|
+
function resolveOxfmtBin() {
|
|
148
|
+
const packageJsonPath = fs_io_require.resolve('oxfmt/package.json');
|
|
149
|
+
const packageJson = JSON.parse(node_fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
150
|
+
const binPath = 'string' == typeof packageJson.bin ? packageJson.bin : packageJson.bin?.oxfmt;
|
|
151
|
+
if ('string' != typeof binPath || 0 === binPath.length) throw new Error('Unable to resolve oxfmt binary from package metadata.');
|
|
152
|
+
return node_path.join(node_path.dirname(packageJsonPath), binPath);
|
|
153
|
+
}
|
|
154
|
+
function resolveOxfmtEntry() {
|
|
155
|
+
return fs_io_require.resolve('oxfmt');
|
|
156
|
+
}
|
|
157
|
+
function resolveUltraciteOxfmtConfig() {
|
|
158
|
+
return fs_io_require.resolve('ultracite/oxfmt');
|
|
159
|
+
}
|
|
46
160
|
function renderTemplate(template, data) {
|
|
47
161
|
return template.replace(/\{\{(\w+)\}\}/g, (match, key)=>data[key] ?? match);
|
|
48
162
|
}
|
|
@@ -87,4 +201,4 @@ function readJsonFile(filePath) {
|
|
|
87
201
|
function writeJsonFile(filePath, value) {
|
|
88
202
|
node_fs.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`, 'utf-8');
|
|
89
203
|
}
|
|
90
|
-
export { assertSafeRelativePath, collectTemplateFiles, copyRootTemplate, createPackageRoot, ensureInsideRoot, fileTemplatesDir, hashFile, hashTemplateTree, readFileTemplate, readJsonFile, renderFileTemplate, renderTemplate, workspaceTemplateDir, writeFile, writeFileReplacing, writeJson, writeJsonFile };
|
|
204
|
+
export { assertSafeRelativePath, collectTemplateFiles, copyRootTemplate, createPackageRoot, ensureInsideRoot, fileTemplatesDir, formatGeneratedWorkspaceFiles, hashFile, hashTemplateTree, readFileTemplate, readJsonFile, renderFileTemplate, renderTemplate, workspaceTemplateDir, writeFile, writeFileReplacing, writeJson, writeJsonFile };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import node_crypto from "node:crypto";
|
|
2
2
|
import node_fs from "node:fs";
|
|
3
3
|
import node_path from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import { ULTRAMODERN_CONFIG_PATH, appHasEffectApi } from "./descriptors.js";
|
|
5
5
|
import { normalizePath, packageName } from "./naming.js";
|
|
6
6
|
const ignoredSnapshotDirectories = new Set([
|
|
7
7
|
'.git',
|
|
@@ -71,7 +71,7 @@ function createGenerationResult(options) {
|
|
|
71
71
|
app.id,
|
|
72
72
|
app.effectApiPrefix
|
|
73
73
|
])),
|
|
74
|
-
generatedContractPath:
|
|
74
|
+
generatedContractPath: ULTRAMODERN_CONFIG_PATH,
|
|
75
75
|
warnings: options.warnings ?? []
|
|
76
76
|
};
|
|
77
77
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { addUltramodernVertical, planUltramodernVertical } from "./add-vertical.js";
|
|
2
|
+
export { normalizeUltramodernBridgeConfig } from "./bridge-config.js";
|
|
2
3
|
export { ultramodernWorkspaceVersions } from "./versions.js";
|
|
3
4
|
export { generateUltramodernWorkspace } from "./write-workspace.js";
|