From c161de6324d0d6148d6f7086a0ce09cc1e99a605 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Fri, 28 Jun 2024 10:52:56 -0700 Subject: [PATCH 1/2] fix(testing): add testing sub module to export map --- package.json | 9 +++++++++ test/end-to-end/exportMap/index.js | 5 +++++ test/end-to-end/exportMap/index.mts | 31 +++++++++++++++++------------ 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index a8640734378..6a29ce083b1 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,15 @@ "./sys/node/*": { "import": "./sys/node/*", "require": "./sys/node/*" + }, + "./testing": { + "import": "./testing/index.js", + "types": "./testing/index.d.ts", + "require": "./testing/index.js" + }, + "./testing/*": { + "import": "./testing/*", + "require": "./testing/*" } }, "scripts": { diff --git a/test/end-to-end/exportMap/index.js b/test/end-to-end/exportMap/index.js index 89de9aff46e..3462f948558 100644 --- a/test/end-to-end/exportMap/index.js +++ b/test/end-to-end/exportMap/index.js @@ -6,6 +6,7 @@ const { h } = require('@stencil/core'); const { MockDocument } = require('@stencil/core/mock-doc'); const appData = require('@stencil/core/internal/app-data'); const { createNodeLogger } = require('@stencil/core/sys/node'); +const { createTesting } = require('@stencil/core/testing'); assert(typeof version === 'string'); assert(typeof run, 'function'); @@ -13,3 +14,7 @@ assert(typeof h === 'function'); assert(typeof MockDocument === 'function'); assert(Object.keys(appData).length === 3); assert(typeof createNodeLogger === 'function'); +assert(typeof createTesting === 'function'); + +console.log(`🎉 All CJS imports successfully resolved!`); +console.log('✅ passed!\n'); diff --git a/test/end-to-end/exportMap/index.mts b/test/end-to-end/exportMap/index.mts index 388bbe592e7..47209d290c9 100644 --- a/test/end-to-end/exportMap/index.mts +++ b/test/end-to-end/exportMap/index.mts @@ -1,19 +1,24 @@ -import assert from 'node:assert' +import assert from 'node:assert'; -import { run } from '@stencil/core/cli' -import { version } from '@stencil/core/compiler' +import { run } from '@stencil/core/cli'; +import { version } from '@stencil/core/compiler'; import { MockDocument } from '@stencil/core/mock-doc'; import type { BuildConditionals } from '@stencil/core/internal'; -import { BUILD } from '@stencil/core/internal/app-data' -import { createNodeLogger } from '@stencil/core/sys/node' +import { BUILD } from '@stencil/core/internal/app-data'; +import { createNodeLogger } from '@stencil/core/sys/node'; +import { createTesting } from '@stencil/core/testing'; -assert(typeof version === 'string') -version.slice() -BUILD as BuildConditionals +assert(typeof version === 'string'); +version.slice(); +BUILD as BuildConditionals; -assert(typeof run, 'function') -run.call +assert(typeof run, 'function'); +run.call; -assert(typeof MockDocument === 'function') -assert(typeof BUILD !== 'undefined') -assert(typeof createNodeLogger === 'function') +assert(typeof MockDocument === 'function'); +assert(typeof BUILD !== 'undefined'); +assert(typeof createNodeLogger === 'function'); +assert(typeof createTesting === 'function'); + +console.log(`🎉 All ESM imports successfully resolved!`); +console.log('✅ passed!\n'); From b16b98e20f329c872f5faf68169dc24b85aa4275 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Fri, 28 Jun 2024 11:02:38 -0700 Subject: [PATCH 2/2] add require import for ./internal/client --- package.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 6a29ce083b1..c11ad708e5b 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,12 @@ "types": "./internal/index.d.ts" }, "./internal/client": { - "import": "./internal/client/index.js" + "import": "./internal/client/index.js", + "require": "./internal/client/index.js" }, "./internal/testing": { - "import": "./internal/testing/index.js" + "import": "./internal/testing/index.js", + "require": "./internal/testing/index.js" }, "./internal/testing/*": { "import": "./internal/testing/*" @@ -61,7 +63,8 @@ "types": "./compiler/stencil.d.ts" }, "./compiler/*": { - "import": "./compiler/*" + "import": "./compiler/*", + "types": "./compiler/*" }, "./sys/node": { "import": "./sys/node/index.js",