soma-core 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,8 +10,10 @@ import {
10
10
  import { filterMockEnvironment } from './environment-policy.mjs';
11
11
 
12
12
  const MOCK_COMMANDS = new Set(['dev', 'build', 'start']);
13
- const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../..');
14
- const DEFAULT_PRELOAD_URL = pathToFileURL(path.join(PACKAGE_ROOT, 'core', 'mock', 'node', 'preload.mjs')).href;
13
+ const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../..');
14
+ const DEFAULT_PRELOAD_URL = pathToFileURL(
15
+ path.join(path.dirname(fileURLToPath(import.meta.url)), 'preload.mjs'),
16
+ ).href;
15
17
 
16
18
  export { SomaMockCliError, terminateMockChild };
17
19
 
package/dist/cli/soma.js CHANGED
@@ -375,6 +375,20 @@ function resolveNextWorkspaceDir(hostDir) {
375
375
  assertReusableWorkspaceDir(workspaceDir);
376
376
  return workspaceDir;
377
377
  }
378
+ /** Mount Host `public/` into the Next workspace so files are served at `/…`. */
379
+ function ensureHostPublicAssets(hostDir, workspaceDir) {
380
+ const hostPublic = node_path_1.default.join(hostDir, 'public');
381
+ const workspacePublic = node_path_1.default.join(workspaceDir, 'public');
382
+ const hostPublicStat = lstatIfPresent(hostPublic);
383
+ if (hostPublicStat?.isDirectory()) {
384
+ linkOrCopy(hostPublic, workspacePublic, 'dir');
385
+ return;
386
+ }
387
+ const existing = lstatIfPresent(workspacePublic);
388
+ if (existing) {
389
+ node_fs_1.default.rmSync(workspacePublic, { recursive: true, force: true });
390
+ }
391
+ }
378
392
  function ensureNextWorkspace(hostDir) {
379
393
  const workspaceDir = resolveNextWorkspaceDir(hostDir);
380
394
  node_fs_1.default.mkdirSync(workspaceDir, { recursive: true });
@@ -385,6 +399,7 @@ function ensureNextWorkspace(hostDir) {
385
399
  linkOrCopy(node_path_1.default.join(packageRoot, 'postcss.config.js'), node_path_1.default.join(workspaceDir, 'postcss.config.js'), 'file');
386
400
  linkOrCopy(node_path_1.default.join(packageRoot, 'tailwind.config.ts'), node_path_1.default.join(workspaceDir, 'tailwind.config.ts'), 'file');
387
401
  linkOrCopy(node_path_1.default.join(packageRoot, 'global.d.ts'), node_path_1.default.join(workspaceDir, 'global.d.ts'), 'file');
402
+ ensureHostPublicAssets(hostDir, workspaceDir);
388
403
  const hasWorkspaceNodeModules = ensureWorkspaceNodeModules(workspaceDir);
389
404
  writeFileIfChanged(node_path_1.default.join(workspaceDir, 'next.config.js'), `module.exports = require(${JSON.stringify(node_path_1.default.join(packageRoot, 'next.config.js'))});\n`);
390
405
  writeFileIfChanged(node_path_1.default.join(workspaceDir, 'tsconfig.json'), buildNextWorkspaceTsconfig(workspaceDir, hasWorkspaceNodeModules));
package/next.config.js CHANGED
@@ -125,9 +125,30 @@ function readEnvTranspilePackages() {
125
125
  .filter(Boolean);
126
126
  }
127
127
 
128
+ function readHostSourcePackageNames() {
129
+ const packageJson = readJson(path.join(hostDir, 'package.json'));
130
+ const dependencies = {
131
+ ...(packageJson?.dependencies ?? {}),
132
+ ...(packageJson?.devDependencies ?? {}),
133
+ };
134
+ return Object.entries(dependencies)
135
+ .filter(([name]) => {
136
+ const packageRoot = path.join(hostDir, 'node_modules', ...name.split('/'));
137
+ const sourcePackage = readJson(path.join(packageRoot, 'package.json'));
138
+ return sourcePackage?.soma?.source === true
139
+ || fs.existsSync(path.join(packageRoot, 'shell', 'html'));
140
+ })
141
+ .map(([name]) => name);
142
+ }
143
+
128
144
  const hostFileDependencyEntries = readHostFileDependencyEntries();
129
145
  const transpilePackages = [
130
- ...new Set(['soma-core', ...hostFileDependencyEntries.map((entry) => entry.name), ...readEnvTranspilePackages()]),
146
+ ...new Set([
147
+ 'soma-core',
148
+ ...hostFileDependencyEntries.map((entry) => entry.name),
149
+ ...readHostSourcePackageNames(),
150
+ ...readEnvTranspilePackages(),
151
+ ]),
131
152
  ];
132
153
 
133
154
  const nextConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soma-core",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "SOMA — Semantic Oriented Modular Architecture. A declarative frontend framework runtime built on Next.js 14+ App Router.",
5
5
  "keywords": [
6
6
  "soma",
@@ -108,7 +108,6 @@
108
108
  "dev": "next dev",
109
109
  "build": "next build",
110
110
  "start": "next start",
111
- "lint": "next lint",
112
111
  "test": "vitest run && npm run test:mock",
113
112
  "test:mock": "node --test tests/mock/*.test.mjs",
114
113
  "verify:mock-pack": "node scripts/verify-mock-pack.mjs",
@@ -152,5 +151,9 @@
152
151
  "vite": "6.4.3",
153
152
  "vitest": "^3.2.7",
154
153
  "ws": "^8.21.0"
154
+ },
155
+ "publishConfig": {
156
+ "access": "public",
157
+ "registry": "https://registry.npmjs.org/"
155
158
  }
156
159
  }