@opentrons/components 0.1.6-alpha.11 → 0.1.6-alpha.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentrons/components",
3
- "version": "0.1.6-alpha.11",
3
+ "version": "0.1.6-alpha.15",
4
4
  "description": "React components library for Opentrons' projects",
5
5
  "source": "src/index.ts",
6
6
  "types": "lib/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "styled-components": "5.3.6"
24
24
  },
25
25
  "dependencies": {
26
- "@opentrons/shared-data": "0.1.6-alpha.11",
26
+ "@opentrons/shared-data": "0.1.6-alpha.15",
27
27
  "@popperjs/core": "2.1.1",
28
28
  "@react-spring/types": "9.6.1",
29
29
  "@react-spring/web": "9.6.1",
package/tsconfig.json CHANGED
@@ -9,6 +9,8 @@
9
9
  "composite": true,
10
10
  "rootDir": "src",
11
11
  "outDir": "lib",
12
+ "allowSyntheticDefaultImports": true,
13
+ "esModuleInterop": true
12
14
  },
13
15
  "include": ["typings", "src"],
14
16
  "exclude": ["**/*.stories.tsx"]
package/vite.config.mts CHANGED
@@ -6,22 +6,35 @@ import postCssApply from 'postcss-apply'
6
6
  import postColorModFunction from 'postcss-color-mod-function'
7
7
  import postCssPresetEnv from 'postcss-preset-env'
8
8
  import lostCss from 'lost'
9
+ import commonjs from '@rollup/plugin-commonjs' // Importing @rollup/plugin-commonjs to handle CJS to ESM conversion
9
10
 
10
11
  export default defineConfig({
11
12
  build: {
12
13
  // Relative to the root
13
14
  outDir: 'lib',
14
- // do not delete the outdir, typescript types might live there and we dont want to delete them
15
+ // Do not delete the outdir, TypeScript types might live there, and we don't want to delete them
15
16
  emptyOutDir: false,
16
17
  lib: {
17
18
  entry: 'src/index.ts',
18
19
  formats: ['es', 'cjs'], // Generate both ES Module and CommonJS outputs
19
- fileName: (format) => (format === 'es' ? 'index.mjs' : 'index.cjs'),
20
+ fileName: format => (format === 'es' ? 'index.mjs' : 'index.cjs'),
20
21
  },
21
22
  rollupOptions: {
22
23
  external: ['react', 'react-dom', 'styled-components'], // Ensure peer dependencies are not bundled
24
+ output: {
25
+ exports: 'named', // Use named exports for compatibility with styled-components in CJS
26
+ globals: {
27
+ 'styled-components': 'styled', // Ensure styled-components maps correctly in UMD builds
28
+ },
29
+ plugins: [
30
+ commonjs({
31
+ include: /node_modules/, // Include node_modules for CommonJS conversion
32
+ transformMixedEsModules: true, // Ensure proper handling of mixed modules
33
+ }),
34
+ ],
35
+ },
23
36
  },
24
- target: 'es2017', // Transpile down to a compatible version for Next.js (for Protocol Library)
37
+ target: 'es2017', // Transpile down to a compatible version for Next.js
25
38
  },
26
39
  plugins: [
27
40
  react({
@@ -51,7 +64,7 @@ export default defineConfig({
51
64
  },
52
65
  define: {
53
66
  'process.env': process.env,
54
- global: 'globalThis',
67
+ global: 'globalThis', // Fix issues with globalThis in some environments
55
68
  },
56
69
  resolve: {
57
70
  alias: {