diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d36639039e72..843e8e764207 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -279,39 +279,6 @@ jobs: # `job_build` can't see `job_install_deps` and what it returned) dependency_cache_key: ${{ needs.job_install_deps.outputs.dependency_cache_key }} - job_size_check: - name: Size Check - needs: [job_get_metadata, job_build] - timeout-minutes: 15 - runs-on: ubuntu-20.04 - if: - github.event_name == 'pull_request' || needs.job_get_metadata.outputs.is_develop == 'true' || - needs.job_get_metadata.outputs.is_release == 'true' - steps: - - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) - uses: actions/checkout@v4 - with: - ref: ${{ env.HEAD_COMMIT }} - - name: Set up Node - uses: actions/setup-node@v4 - with: - # The size limit action runs `yarn` and `yarn build` when this job is executed on - # use Node 14 for now. - node-version: '14' - - name: Restore caches - uses: ./.github/actions/restore-cache - env: - DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} - - name: Check bundle sizes - uses: getsentry/size-limit-action@runForBranch - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - skip_step: build - main_branch: develop - # When on release branch, we want to always run - # Else, we fall back to the default handling of the action - run_for_branch: ${{ (needs.job_get_metadata.outputs.is_release == 'true' && 'true') || '' }} - job_lint: name: Lint # Even though the linter only checks source code, not built code, it needs the built code in order check that all diff --git a/dev-packages/rollup-utils/npmHelpers.mjs b/dev-packages/rollup-utils/npmHelpers.mjs index 6085a502200f..76391efebd27 100644 --- a/dev-packages/rollup-utils/npmHelpers.mjs +++ b/dev-packages/rollup-utils/npmHelpers.mjs @@ -17,6 +17,7 @@ import { makeSetSDKSourcePlugin, makeSucrasePlugin, } from './plugins/index.mjs'; +import { makePackageNodeEsm } from './plugins/make-esm-plugin.mjs'; import { mergePlugins } from './utils.mjs'; const packageDotJSON = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' })); @@ -104,6 +105,7 @@ export function makeBaseNPMConfig(options = {}) { ...builtinModules, ...Object.keys(packageDotJSON.dependencies || {}), ...Object.keys(packageDotJSON.peerDependencies || {}), + ...Object.keys(packageDotJSON.optionalDependencies || {}), ], }; @@ -120,7 +122,7 @@ export function makeBaseNPMConfig(options = {}) { export function makeNPMConfigVariants(baseConfig) { const variantSpecificConfigs = [ { output: { format: 'cjs', dir: path.join(baseConfig.output.dir, 'cjs') } }, - { output: { format: 'esm', dir: path.join(baseConfig.output.dir, 'esm') } }, + { output: { format: 'esm', dir: path.join(baseConfig.output.dir, 'esm'), plugins: [makePackageNodeEsm()] } }, ]; return variantSpecificConfigs.map(variant => deepMerge(baseConfig, variant)); diff --git a/dev-packages/rollup-utils/plugins/make-esm-plugin.mjs b/dev-packages/rollup-utils/plugins/make-esm-plugin.mjs new file mode 100644 index 000000000000..aa3f272ba2e0 --- /dev/null +++ b/dev-packages/rollup-utils/plugins/make-esm-plugin.mjs @@ -0,0 +1,16 @@ +/** + * Outputs a package.json file with {type: module} in the root of the output directory so that Node + * treats .js files as ESM. + */ +export function makePackageNodeEsm() { + return { + name: 'make-package-node-esm', + generateBundle() { + this.emitFile({ + type: 'asset', + fileName: 'package.json', + source: '{ "type": "module" }', + }); + }, + }; +} diff --git a/packages/browser/package.json b/packages/browser/package.json index c6a4dc028d93..1a6a79c0cc41 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -18,6 +18,19 @@ "main": "build/npm/cjs/index.js", "module": "build/npm/esm/index.js", "types": "build/npm/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/esm/index.js" + }, + "require": { + "types": "./build/npm.types/index.d.ts", + "default": "./build/npm/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/npm/types/index.d.ts": [ diff --git a/packages/bun/package.json b/packages/bun/package.json index 362ec8a4eacc..ff7bdf6c5147 100644 --- a/packages/bun/package.json +++ b/packages/bun/package.json @@ -18,6 +18,19 @@ "main": "build/esm/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/npm/types/index.d.ts": [ diff --git a/packages/core/package.json b/packages/core/package.json index 0b517f5101d1..24f7e29a036a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/deno/package.json b/packages/deno/package.json index 6eebb79744ef..7e8a0b73153d 100644 --- a/packages/deno/package.json +++ b/packages/deno/package.json @@ -8,6 +8,15 @@ "license": "MIT", "module": "build/index.mjs", "types": "build/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/index.d.ts", + "default": "./build/index.mjs" + } + } + }, "publishConfig": { "access": "public" }, diff --git a/packages/feedback/package.json b/packages/feedback/package.json index 749618261570..bf75b64913f2 100644 --- a/packages/feedback/package.json +++ b/packages/feedback/package.json @@ -18,6 +18,19 @@ "main": "build/npm/cjs/index.js", "module": "build/npm/esm/index.js", "types": "build/npm/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/esm/index.js" + }, + "require": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/npm/types/index.d.ts": [ diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index 38717d42fe5a..8cec3aa0bdb2 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -26,6 +26,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/integration-shims/package.json b/packages/integration-shims/package.json index 144abc0f22c5..e3d037178ac1 100644 --- a/packages/integration-shims/package.json +++ b/packages/integration-shims/package.json @@ -5,6 +5,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index ba743b849e16..2bf624f7374b 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -13,6 +13,17 @@ "module": "build/esm/index.server.js", "browser": "build/esm/index.client.js", "types": "build/types/index.types.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "import": "./build/esm/index.client.js", + "require": "./build/cjs/index.client.js" + }, + "node": "./build/cjs/index.server.js", + "types": "./build/types/index.types.d.ts" + } + }, "typesVersions": { "<4.9": { "build/npm/types/index.d.ts": [ diff --git a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts index fe28ad71558e..e13c51827c6e 100644 --- a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts @@ -14,7 +14,13 @@ import { stripUrlQueryAndFragment, } from '@sentry/utils'; import type { NEXT_DATA as NextData } from 'next/dist/next-server/lib/utils'; -import { default as Router } from 'next/router'; +import RouterImport from 'next/router'; + +// next/router v10 is CJS +// +// For ESM/CJS interoperability 'reasons', depending on how this file is loaded, Router might be on the default export +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any +const Router: typeof RouterImport = RouterImport.events ? RouterImport : (RouterImport as any).default; import { DEBUG_BUILD } from '../../common/debug-build'; diff --git a/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts b/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts index aaf7a7417c15..76cfdec677b6 100644 --- a/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts +++ b/packages/nextjs/test/performance/pagesRouterInstrumentation.test.ts @@ -1,7 +1,7 @@ import { WINDOW } from '@sentry/react'; import { JSDOM } from 'jsdom'; import type { NEXT_DATA as NextData } from 'next/dist/next-server/lib/utils'; -import { default as Router } from 'next/router'; +import Router from 'next/router'; import { pagesRouterInstrumentation } from '../../src/client/routing/pagesRouterRoutingInstrumentation'; diff --git a/packages/node-experimental/package.json b/packages/node-experimental/package.json index ccd6e1c5b8f4..20b4471c616e 100644 --- a/packages/node-experimental/package.json +++ b/packages/node-experimental/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/node-experimental/src/integrations/node-fetch.ts b/packages/node-experimental/src/integrations/node-fetch.ts index 254b3f93e930..a80d015515bb 100644 --- a/packages/node-experimental/src/integrations/node-fetch.ts +++ b/packages/node-experimental/src/integrations/node-fetch.ts @@ -27,22 +27,20 @@ const _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => { const _breadcrumbs = typeof options.breadcrumbs === 'undefined' ? true : options.breadcrumbs; const _ignoreOutgoingRequests = options.ignoreOutgoingRequests; - function getInstrumentation(): [Instrumentation] | void { + async function getInstrumentation(): Promise<[Instrumentation] | void> { // Only add NodeFetch if Node >= 16, as previous versions do not support it if (NODE_MAJOR < 16) { return; } try { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const { FetchInstrumentation } = require('opentelemetry-instrumentation-fetch-node'); + const pkg = await import('opentelemetry-instrumentation-fetch-node'); return [ - new FetchInstrumentation({ + new pkg.FetchInstrumentation({ ignoreRequestHook: (request: { origin?: string }) => { const url = request.origin; return _ignoreOutgoingRequests && url && _ignoreOutgoingRequests(url); }, - onRequest: ({ span }: { span: Span }) => { _updateSpan(span); @@ -50,7 +48,8 @@ const _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => { _addRequestBreadcrumb(span); } }, - }), + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any), ]; } catch (error) { // Could not load instrumentation @@ -60,13 +59,14 @@ const _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => { return { name: 'NodeFetch', setupOnce() { - const instrumentations = getInstrumentation(); - - if (instrumentations) { - registerInstrumentations({ - instrumentations, - }); - } + // eslint-disable-next-line @typescript-eslint/no-floating-promises + getInstrumentation().then(instrumentations => { + if (instrumentations) { + registerInstrumentations({ + instrumentations, + }); + } + }); }, }; }) satisfies IntegrationFn; diff --git a/packages/node-experimental/src/integrations/tracing/prisma.ts b/packages/node-experimental/src/integrations/tracing/prisma.ts index 1f78262b9a3c..e261e95b9196 100644 --- a/packages/node-experimental/src/integrations/tracing/prisma.ts +++ b/packages/node-experimental/src/integrations/tracing/prisma.ts @@ -1,5 +1,6 @@ import { registerInstrumentations } from '@opentelemetry/instrumentation'; -import { PrismaInstrumentation } from '@prisma/instrumentation'; +// When importing CJS modules into an ESM module, we cannot import the named exports directly. +import * as prismaInstrumentation from '@prisma/instrumentation'; import { defineIntegration } from '@sentry/core'; import type { IntegrationFn } from '@sentry/types'; @@ -10,7 +11,7 @@ const _prismaIntegration = (() => { registerInstrumentations({ instrumentations: [ // does not have a hook to adjust spans & add origin - new PrismaInstrumentation({}), + new prismaInstrumentation.PrismaInstrumentation({}), ], }); }, diff --git a/packages/node-experimental/src/sdk/init.ts b/packages/node-experimental/src/sdk/init.ts index 5e62a01de6cd..a018dbdbb435 100644 --- a/packages/node-experimental/src/sdk/init.ts +++ b/packages/node-experimental/src/sdk/init.ts @@ -39,6 +39,10 @@ import { defaultStackParser, getSentryRelease } from './api'; import { NodeClient } from './client'; import { initOtel } from './initOtel'; +function getCjsOnlyIntegrations(isCjs = typeof require !== 'undefined'): Integration[] { + return isCjs ? [modulesIntegration()] : []; +} + /** Get the default integrations for the Node Experimental SDK. */ export function getDefaultIntegrations(options: Options): Integration[] { // TODO @@ -59,9 +63,8 @@ export function getDefaultIntegrations(options: Options): Integration[] { contextLinesIntegration(), localVariablesIntegration(), nodeContextIntegration(), - modulesIntegration(), httpIntegration(), - nativeNodeFetchIntegration(), + ...getCjsOnlyIntegrations(), ...(hasTracingEnabled(options) ? getAutoPerformanceIntegrations() : []), ]; } diff --git a/packages/node-experimental/tsconfig.json b/packages/node-experimental/tsconfig.json index d38a5701a2bf..5a6bb72e5fd3 100644 --- a/packages/node-experimental/tsconfig.json +++ b/packages/node-experimental/tsconfig.json @@ -4,6 +4,7 @@ "include": ["src/**/*"], "compilerOptions": { - "lib": ["es2017"] + "lib": ["es2017"], + "module": "Node16" } } diff --git a/packages/node/package.json b/packages/node/package.json index 52806202a687..48cd6f557668 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ @@ -38,7 +51,7 @@ "@types/cookie": "0.5.2", "@types/express": "^4.17.14", "@types/lru-cache": "^5.1.0", - "@types/node": "~10.17.0", + "@types/node": "14.18.63", "express": "^4.17.1", "nock": "^13.0.5", "undici": "^5.21.0" diff --git a/packages/node/src/handlers.ts b/packages/node/src/handlers.ts index 5c1c0a26e481..826758befc75 100644 --- a/packages/node/src/handlers.ts +++ b/packages/node/src/handlers.ts @@ -141,6 +141,8 @@ export function requestHandler( if (options && options.flushTimeout && options.flushTimeout > 0) { // eslint-disable-next-line @typescript-eslint/unbound-method const _end = res.end; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore I've only updated the node types and this package will soon be removed res.end = function (chunk?: any | (() => void), encoding?: string | (() => void), cb?: () => void): void { void flush(options.flushTimeout) .then(() => { diff --git a/packages/node/src/integrations/anr/index.ts b/packages/node/src/integrations/anr/index.ts index bfb81557fd75..7e0de1d0badc 100644 --- a/packages/node/src/integrations/anr/index.ts +++ b/packages/node/src/integrations/anr/index.ts @@ -120,6 +120,7 @@ async function _startWorker(client: NodeClient, _options: Partial { + // eslint-disable-next-line @typescript-eslint/no-floating-promises worker.terminate(); }); diff --git a/packages/node/src/integrations/http.ts b/packages/node/src/integrations/http.ts index 75dc8e061537..941682ee0290 100644 --- a/packages/node/src/integrations/http.ts +++ b/packages/node/src/integrations/http.ts @@ -206,7 +206,7 @@ export class Http implements Integration { // It has been changed in Node 9, so for all versions equal and above, we patch `https` separately. if (NODE_VERSION.major > 8) { // eslint-disable-next-line @typescript-eslint/no-var-requires - const httpsModule = require('https'); + const httpsModule = require('node:https'); const wrappedHttpsHandlerMaker = _createWrappedRequestMethodFactory( httpsModule, this._breadcrumbs, diff --git a/packages/node/src/integrations/utils/errorhandling.ts b/packages/node/src/integrations/utils/errorhandling.ts index 5d3abb90afce..fc2a2c2b8e7b 100644 --- a/packages/node/src/integrations/utils/errorhandling.ts +++ b/packages/node/src/integrations/utils/errorhandling.ts @@ -20,6 +20,7 @@ export function logAndExitProcess(error: Error): void { if (client === undefined) { DEBUG_BUILD && logger.warn('No NodeClient was defined, we are exiting the process now.'); global.process.exit(1); + return; } const options = client.getOptions(); diff --git a/packages/node/src/integrations/utils/http.ts b/packages/node/src/integrations/utils/http.ts index 87982f5b3ba3..82319c2fcdb8 100644 --- a/packages/node/src/integrations/utils/http.ts +++ b/packages/node/src/integrations/utils/http.ts @@ -1,5 +1,5 @@ -import type * as http from 'http'; -import type * as https from 'https'; +import type * as http from 'node:http'; +import type * as https from 'node:https'; import { URL } from 'url'; import { NODE_VERSION } from '../../nodeVersion'; diff --git a/packages/node/src/proxy/helpers.ts b/packages/node/src/proxy/helpers.ts index 119ffd9317ce..a5064408855d 100644 --- a/packages/node/src/proxy/helpers.ts +++ b/packages/node/src/proxy/helpers.ts @@ -27,8 +27,8 @@ */ /* eslint-disable jsdoc/require-jsdoc */ -import * as http from 'http'; -import * as https from 'https'; +import * as http from 'node:http'; +import * as https from 'node:https'; import type { Readable } from 'stream'; // TODO (v8): Remove this when Node < 12 is no longer supported import type { URL } from 'url'; diff --git a/packages/node/src/transports/http.ts b/packages/node/src/transports/http.ts index 83d8bab5141a..a6a05fc07c95 100644 --- a/packages/node/src/transports/http.ts +++ b/packages/node/src/transports/http.ts @@ -1,5 +1,5 @@ -import * as http from 'http'; -import * as https from 'https'; +import * as http from 'node:http'; +import * as https from 'node:https'; import { Readable } from 'stream'; import { URL } from 'url'; import { createGzip } from 'zlib'; diff --git a/packages/node/test/handlers.test.ts b/packages/node/test/handlers.test.ts index 861cfdf13259..ba71541acbab 100644 --- a/packages/node/test/handlers.test.ts +++ b/packages/node/test/handlers.test.ts @@ -151,6 +151,7 @@ describe('requestHandler', () => { setImmediate(() => { expect(flush).toHaveBeenCalledWith(1337); + // eslint-disable-next-line deprecation/deprecation expect(res.finished).toBe(true); done(); }); @@ -164,6 +165,7 @@ describe('requestHandler', () => { res.end('ok'); setImmediate(() => { + // eslint-disable-next-line deprecation/deprecation expect(res.finished).toBe(true); done(); }); diff --git a/packages/node/test/integrations/undici.test.ts b/packages/node/test/integrations/undici.test.ts index 86bfb98a6802..ef1f45d92ebb 100644 --- a/packages/node/test/integrations/undici.test.ts +++ b/packages/node/test/integrations/undici.test.ts @@ -498,6 +498,7 @@ function setupTestServer() { res.end(); // also terminate socket because keepalive hangs connection a bit + // eslint-disable-next-line deprecation/deprecation res.connection?.end(); }); diff --git a/packages/node/test/transports/http.test.ts b/packages/node/test/transports/http.test.ts index 3b3d969af5e7..d7f4535b6b6d 100644 --- a/packages/node/test/transports/http.test.ts +++ b/packages/node/test/transports/http.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable deprecation/deprecation */ import * as http from 'http'; import { createGunzip } from 'zlib'; @@ -50,7 +51,9 @@ function setupTestServer( res.end(); // also terminate socket because keepalive hangs connection a bit - res.connection.end(); + if (res.connection) { + res.connection.end(); + } }); testServer.listen(18099); diff --git a/packages/node/test/transports/https.test.ts b/packages/node/test/transports/https.test.ts index 58e3cb6c7faa..d6782293e666 100644 --- a/packages/node/test/transports/https.test.ts +++ b/packages/node/test/transports/https.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable deprecation/deprecation */ import * as http from 'http'; import * as https from 'https'; import { createTransport } from '@sentry/core'; @@ -49,7 +50,9 @@ function setupTestServer( res.end(); // also terminate socket because keepalive hangs connection a bit - res.connection.end(); + if (res.connection) { + res.connection.end(); + } }); testServer.listen(8099); diff --git a/packages/opentelemetry/package.json b/packages/opentelemetry/package.json index 9c0e3479deda..903d641a103b 100644 --- a/packages/opentelemetry/package.json +++ b/packages/opentelemetry/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/profiling-node/package.json b/packages/profiling-node/package.json index 8d3e2658a94c..e0025e41552f 100644 --- a/packages/profiling-node/package.json +++ b/packages/profiling-node/package.json @@ -8,6 +8,15 @@ "license": "MIT", "main": "lib/index.js", "types": "lib/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "require": { + "types": "./lib/types/index.d.ts", + "default": "./lib/index.js" + } + } + }, "typesVersions": { "<4.9": { "lib/types/index.d.ts": [ diff --git a/packages/react/package.json b/packages/react/package.json index 8d24da75acf2..752fe8cf7c19 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/remix/package.json b/packages/remix/package.json index 9a19fc7a68d3..37e2e9fcf1c0 100644 --- a/packages/remix/package.json +++ b/packages/remix/package.json @@ -23,6 +23,17 @@ "module": "build/esm/index.server.js", "browser": "build/esm/index.client.js", "types": "build/types/index.types.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "import": "./build/esm/index.client.js", + "require": "./build/cjs/index.client.js" + }, + "node": "./build/cjs/index.server.js", + "types": "./build/types/index.types.d.ts" + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/replay-canvas/package.json b/packages/replay-canvas/package.json index b2d26f2f7b0e..a2f0cb81a44d 100644 --- a/packages/replay-canvas/package.json +++ b/packages/replay-canvas/package.json @@ -5,6 +5,19 @@ "main": "build/npm/cjs/index.js", "module": "build/npm/esm/index.js", "types": "build/npm/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/esm/index.js" + }, + "require": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/npm/types/index.d.ts": [ diff --git a/packages/replay/package.json b/packages/replay/package.json index 06e2de70332d..e84da910e56f 100644 --- a/packages/replay/package.json +++ b/packages/replay/package.json @@ -5,6 +5,19 @@ "main": "build/npm/cjs/index.js", "module": "build/npm/esm/index.js", "types": "build/npm/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/esm/index.js" + }, + "require": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/npm/types/index.d.ts": [ diff --git a/packages/serverless/package.json b/packages/serverless/package.json index 33b29a966ce5..e1f83f7bea17 100644 --- a/packages/serverless/package.json +++ b/packages/serverless/package.json @@ -18,6 +18,19 @@ "main": "build/npm/cjs/index.js", "module": "build/npm/esm/index.js", "types": "build/npm/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/esm/index.js" + }, + "require": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/npm/types/index.d.ts": [ diff --git a/packages/svelte/package.json b/packages/svelte/package.json index 1fca476a52cd..fa8e69a8be84 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/tracing-internal/package.json b/packages/tracing-internal/package.json index 6750afe1d4a4..c2b523736e1b 100644 --- a/packages/tracing-internal/package.json +++ b/packages/tracing-internal/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/types/package.json b/packages/types/package.json index 6a3fb905b9f1..791ec312e9f7 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/utils/package.json b/packages/utils/package.json index efb8f3791816..685cb3784ff2 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/vercel-edge/package.json b/packages/vercel-edge/package.json index b996d8b70968..ba6d7d82257b 100644 --- a/packages/vercel-edge/package.json +++ b/packages/vercel-edge/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/vue/package.json b/packages/vue/package.json index 9549561b45f9..371fc276001d 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -18,6 +18,19 @@ "main": "build/cjs/index.js", "module": "build/esm/index.js", "types": "build/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/types/index.d.ts", + "default": "./build/esm/index.js" + }, + "require": { + "types": "./build/types/index.d.ts", + "default": "./build/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/types/index.d.ts": [ diff --git a/packages/wasm/package.json b/packages/wasm/package.json index a1e5056eeebc..b136a6417a13 100644 --- a/packages/wasm/package.json +++ b/packages/wasm/package.json @@ -18,6 +18,19 @@ "main": "build/npm/cjs/index.js", "module": "build/npm/esm/index.js", "types": "build/npm/types/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/esm/index.js" + }, + "require": { + "types": "./build/npm/types/index.d.ts", + "default": "./build/npm/cjs/index.js" + } + } + }, "typesVersions": { "<4.9": { "build/npm/types/index.d.ts": [