@softize/opus 12.6.1 → 12.6.2

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 CHANGED
@@ -7,6 +7,12 @@ Depois de qualquer bump, rode os gates (`typecheck` · `test` · `opus check` ·
7
7
  `opus copy --check` · `base copy check` · `manifest:check`) — eles apontam o que a
8
8
  mudança cobra do seu código.
9
9
 
10
+ ## 12.6.2 — 2026-08-26
11
+
12
+ O `postinstall` passa a materializar `base.json` e `opus.json` somente a partir do exemplar de
13
+ `@softize/opus` resolvido pelo workspace declarado. Versões transitivas instaladas no mesmo projeto
14
+ não disputam mais esses marcadores durante instalações concorrentes.
15
+
10
16
  ## 12.6.1 — 2026-08-26
11
17
 
12
18
  Os padrões de UI passam a distinguir melhor estrutura e ação. `Page` centraliza o conteúdo com
@@ -0,0 +1,32 @@
1
+ import { realpathSync } from 'node:fs'
2
+ import { createRequire } from 'node:module'
3
+ import path from 'node:path'
4
+
5
+ import { readProjectFile, safeProjectPath } from '@softize/base/project-path'
6
+
7
+ function resolutionDirectory(projectDir) {
8
+ try {
9
+ const base = JSON.parse(readProjectFile(projectDir, 'base.json', { allowMissing: true }).content || '{}')
10
+ const resolveFrom = base?.packages?.['@softize/opus']?.resolveFrom
11
+ if (typeof resolveFrom !== 'string') return projectDir
12
+ const candidate = safeProjectPath(projectDir, resolveFrom, { mustExist: true })
13
+ return candidate.kind === 'directory' ? candidate.path : projectDir
14
+ } catch {
15
+ return projectDir
16
+ }
17
+ }
18
+
19
+ /**
20
+ * Só o exemplar resolvido pelo workspace declarado pode materializar o projeto.
21
+ * Gerenciadores de pacote executam o postinstall de exemplares transitivos com o mesmo
22
+ * INIT_CWD; sem esta prova, versões diferentes disputam base.json e opus.json.
23
+ */
24
+ export function isResolvedOpusInstance(projectDir, packageRoot) {
25
+ try {
26
+ const from = resolutionDirectory(projectDir)
27
+ const resolved = createRequire(path.join(from, 'package.json')).resolve('@softize/opus/package.json')
28
+ return realpathSync(path.dirname(resolved)) === realpathSync(packageRoot)
29
+ } catch {
30
+ return false
31
+ }
32
+ }
@@ -19,6 +19,7 @@ import { fileURLToPath } from 'node:url'
19
19
  import { canonicalProjectDirectory, readProjectFile } from '@softize/base/project-path'
20
20
 
21
21
  import { initProject } from './init.mjs'
22
+ import { isResolvedOpusInstance } from './postinstall-target.mjs'
22
23
 
23
24
  const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..')
24
25
  const REGISTRY_DIR = path.join(PACKAGE_ROOT, 'registry')
@@ -40,6 +41,7 @@ async function main() {
40
41
  if (pkg.name === '@softize/opus') return
41
42
  const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) }
42
43
  if (!deps['@softize/opus']) return // Não é consumidor do Opus.
44
+ if (!isResolvedOpusInstance(projectDir, PACKAGE_ROOT)) return
43
45
 
44
46
  const r = await initProject(REGISTRY_DIR, projectDir)
45
47
  if (!r.materialization.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softize/opus",
3
- "version": "12.6.1",
3
+ "version": "12.6.2",
4
4
  "description": "End-to-end action protocol for TypeScript. Single package with subpath exports (core + adapters).",
5
5
  "license": "MIT",
6
6
  "type": "module",