@woodsportal/hubspot-kit 1.0.37 → 1.0.38
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
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
- **CSS entries** — shared `tailwind.css.config.css`; documented never-merge rules on `main.dev.css` / `main.prod.css`
|
|
20
20
|
- **`wp doctor`** — CSS pipeline checks (prefix, `.temp` @source, `skipRuntimeCss`, `module.css` dw utilities, CDN `require_css` warning)
|
|
21
21
|
|
|
22
|
+
## 1.0.38 — 2026-06-08
|
|
23
|
+
|
|
24
|
+
### Dev server
|
|
25
|
+
- **Module-config overlay** — stop force-resolving `react` / `react-dom` to CJS `index.js` for kit UI under `.wphs/`; fixes `createContext` / named export errors in the browser on `yarn local`
|
|
26
|
+
|
|
22
27
|
## 1.0.37 — 2026-06-08
|
|
23
28
|
|
|
24
29
|
### Dev server
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@woodsportal/hubspot-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.38",
|
|
4
4
|
"description": "WoodsCLI — HubSpot CMS dev kit by WoodsPortal. wp CLI, Vite presets, module-config overlay, and theme/module build pipelines.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"build": "tsup",
|
|
52
52
|
"dev": "tsup --watch",
|
|
53
53
|
"typecheck": "tsc --noEmit",
|
|
54
|
-
"test": "node --import tsx --test 'src/lib/**/*.test.ts' 'src/schema/**/*.test.ts' 'src/vite/**/*.test.ts' 'scripts/portal-build-id.test.mjs' 'scripts/resolve-consumer-dep.test.mjs' 'scripts/vite/ensure-dev-kit-shims.test.mjs' 'scripts/vite/consumer-react-aliases.test.mjs' && vitest run src/dev-module-config/__tests__/normalize-repeater-items.test.ts src/dev-module-config/__tests__/module-config-transform.test.ts src/dev-module-config/__tests__/flatten-visible-fields.test.ts",
|
|
54
|
+
"test": "node --import tsx --test 'src/lib/**/*.test.ts' 'src/schema/**/*.test.ts' 'src/vite/**/*.test.ts' 'scripts/portal-build-id.test.mjs' 'scripts/resolve-consumer-dep.test.mjs' 'scripts/vite/ensure-dev-kit-shims.test.mjs' 'scripts/vite/consumer-react-aliases.test.mjs' 'scripts/vite/resolve-from-project-root.test.mjs' && vitest run src/dev-module-config/__tests__/normalize-repeater-items.test.ts src/dev-module-config/__tests__/module-config-transform.test.ts src/dev-module-config/__tests__/flatten-visible-fields.test.ts",
|
|
55
55
|
"test:examples": "node examples/smoke/run-matrix.mjs --tier static",
|
|
56
56
|
"lint": "eslint src",
|
|
57
57
|
"verify": "npm run typecheck && npm run test && npm run test:examples && npm run build",
|
|
@@ -2,6 +2,22 @@ import { resolve, sep } from 'node:path'
|
|
|
2
2
|
|
|
3
3
|
import { resolveConsumerDep } from '../resolve-consumer-dep.mjs'
|
|
4
4
|
|
|
5
|
+
/** Let Vite dedupe + optimizeDeps handle React; forced absolute paths serve CJS in the browser. */
|
|
6
|
+
export const SKIP_CONSUMER_RESOLVE_SPECS = new Set([
|
|
7
|
+
'react',
|
|
8
|
+
'react-dom',
|
|
9
|
+
'react/jsx-runtime',
|
|
10
|
+
'react/jsx-dev-runtime',
|
|
11
|
+
'react-dom/client',
|
|
12
|
+
'react/compiler-runtime',
|
|
13
|
+
])
|
|
14
|
+
|
|
15
|
+
function shouldSkipConsumerResolve(source) {
|
|
16
|
+
if (SKIP_CONSUMER_RESOLVE_SPECS.has(source)) return true
|
|
17
|
+
if (source.startsWith('react/') || source.startsWith('react-dom/')) return true
|
|
18
|
+
return false
|
|
19
|
+
}
|
|
20
|
+
|
|
5
21
|
/**
|
|
6
22
|
* When Vite transforms kit dev UI (`.wphs/`, package src, or dev-module-config),
|
|
7
23
|
* bare imports must resolve from the consumer project's node_modules.
|
|
@@ -29,6 +45,9 @@ export default function resolveFromProjectRoot(projectRoot, kitRoot) {
|
|
|
29
45
|
if (!isKitUiImporter(importer)) {
|
|
30
46
|
return null
|
|
31
47
|
}
|
|
48
|
+
if (shouldSkipConsumerResolve(source)) {
|
|
49
|
+
return null
|
|
50
|
+
}
|
|
32
51
|
try {
|
|
33
52
|
return resolveConsumerDep(source, projectRoot)
|
|
34
53
|
} catch {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import { resolve } from 'node:path'
|
|
3
|
+
import { describe, it } from 'node:test'
|
|
4
|
+
|
|
5
|
+
import { consumerDepFixtureRoot } from '../test-fixtures/consumer-dep-fixture-root.mjs'
|
|
6
|
+
import resolveFromProjectRoot, {
|
|
7
|
+
SKIP_CONSUMER_RESOLVE_SPECS,
|
|
8
|
+
} from './resolve-from-project-root.js'
|
|
9
|
+
|
|
10
|
+
describe('resolveFromProjectRoot', () => {
|
|
11
|
+
const kitRoot = resolve(consumerDepFixtureRoot, 'kit')
|
|
12
|
+
const kitUiFile = resolve(consumerDepFixtureRoot, '.wphs/.kit-module-config/ui/ModuleConfigNavContext.tsx')
|
|
13
|
+
const appFile = resolve(consumerDepFixtureRoot, 'src/app.tsx')
|
|
14
|
+
|
|
15
|
+
const plugin = resolveFromProjectRoot(consumerDepFixtureRoot, kitRoot)
|
|
16
|
+
const resolveId = /** @type {(source: string, importer: string) => Promise<string | null>} */ (
|
|
17
|
+
plugin.resolveId.bind(plugin)
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
it('does not force-resolve react for kit UI (avoids CJS index.js in browser)', async () => {
|
|
21
|
+
assert.ok(SKIP_CONSUMER_RESOLVE_SPECS.has('react'))
|
|
22
|
+
assert.equal(await resolveId('react', kitUiFile), null)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('does not force-resolve react/jsx-dev-runtime for kit UI (alias + optimizeDeps)', async () => {
|
|
26
|
+
assert.equal(await resolveId('react/jsx-dev-runtime', kitUiFile), null)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('still resolves other deps from the consumer for kit UI', async () => {
|
|
30
|
+
const resolved = await resolveId('vite', kitUiFile)
|
|
31
|
+
assert.match(resolved ?? '', /node_modules[/\\]vite[/\\]/)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('ignores non-kit importers', async () => {
|
|
35
|
+
assert.equal(await resolveId('vite', appFile), null)
|
|
36
|
+
})
|
|
37
|
+
})
|