Skip to content

Commit b490ffd

Browse files
committed
Implement PR suggestions and fix small bug
this mostly affects the build - followed solid-logic where possible for tsc, eslint, esm and changed sourcePane to SourcePane.
1 parent c6f1a0a commit b490ffd

10 files changed

Lines changed: 34 additions & 32 deletions

config/babel.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import path from 'path'
66
* @see https://lit.dev/docs/components/decorators/#using-decorators-with-babel
77
*/
88

9-
const pathsUsingDecorators = ['src/design-system', 'src/primitives', 'src/storybook', 'src/components']
9+
const pathsUsingDecorators = ['src/primitives', 'src/components']
1010

1111
export const litDecoratorsBabelOptions = {
1212
assumptions: {

declarations.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ declare module '*.styles.css' {
44
export default styles
55
}
66

7-
declare module '*.css';
7+
declare module '*.css';

dev/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as logic from 'solid-logic'
2-
import pane from '../src/sourcePane'
2+
import pane from '../src/SourcePane'
33
import './dev-global.css'
44
import * as $rdf from 'rdflib'
55
import * as UI from 'solid-ui'

eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export default [
55
{
66
ignores: [
77
'dist/**',
8-
'lib/**',
98
'node_modules/**',
109
'coverage/**'
1110
],

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,8 @@
33
"version": "3.1.0",
44
"description": "Solid-compatible Panes: Source editor",
55
"main": "dist/source-pane.js",
6-
"module": "dist/source-pane.esm.js",
7-
"types": "dist/SourcePane.d.ts",
8-
"exports": {
9-
".": {
10-
"import": "./dist/source-pane.esm.js",
11-
"require": "./dist/source-pane.js",
12-
"types": "./dist/SourcePane.d.ts"
13-
}
14-
},
6+
"module": "dist/esm/source-pane.esm.js",
7+
"types": "dist/sourcePane.d.ts",
158
"files": [
169
"/dist",
1710
"README.md",
@@ -23,7 +16,7 @@
2316
],
2417
"scripts": {
2518
"clean": "rm -rf dist",
26-
"build": "npm run clean && npm run typecheck && npm run build-js && npm run build-dist",
19+
"build": "npm run clean && npm run typecheck && npm run build-dist && npm run build-js",
2720
"typecheck": "tsc --noEmit",
2821
"build-dist": "webpack --progress",
2922
"build-js": "tsc --emitDeclarationOnly",
@@ -32,7 +25,7 @@
3225
"watch": "sh -c 'npm run watch-js & npm run watch-dist & wait'",
3326
"lint": "eslint",
3427
"lint-fix": "eslint --fix",
35-
"watch-workspace": "sh -c 'npm run watch-js & npm run watch-dist & wait'",
28+
"watch:workspace": "sh -c 'npm run watch-js & npm run watch-dist & wait'",
3629
"watch-js": "tsc --watch --emitDeclarationOnly",
3730
"test": "jest --no-coverage",
3831
"typecheck-test": "tsc --noEmit -p tsconfig.test.json",
@@ -100,7 +93,7 @@
10093
"solid-ui": "^3.1.1",
10194
"style-loader": "^4.0.0",
10295
"terser-webpack-plugin": "^5.4.0",
103-
"typescript": "^6.0.3",
96+
"typescript": "^5.9.3",
10497
"webpack": "^5.97.1",
10598
"webpack-cli": "^7.0.2",
10699
"webpack-dev-server": "^5.2.3"

src/sourcePane.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ import { DataBrowserContext, NewPaneOptions } from 'pane-registry'
99
import * as mime from 'mime-types'
1010
import { html, render as litRender } from 'lit'
1111
import { log } from './debug'
12-
import './components/sourceEditorCard/SourceEditorCard'
13-
import './components/source-provider/SourceProvider'
12+
import SourceEditorCard from './components/sourceEditorCard/SourceEditorCard'
13+
import SourceProvider from './components/source-provider/SourceProvider'
1414
import './sourcePane.css'
1515
import { SourcePaneState } from './types'
1616

17+
// Keep custom-element modules in the bundle; they are registered for side effects.
18+
void SourceEditorCard
19+
void SourceProvider
20+
1721
const pane = {
1822
icon: icons.iconBase + 'noun_109873.svg', // noun_109873_51A7F9.svg
1923

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/* Basic Options */
44
"target": "ES2019" /* Specify ECMAScript target version - matches your browser support */,
55
"module": "ESNext" /* Let bundlers handle module transformation for better tree-shaking */,
6-
"moduleResolution": "bundler", /* Use bundler-aware module resolution for modern Webpack builds. */
6+
"moduleResolution": "node", /* Use bundler-aware module resolution for modern Webpack builds. */
77
/* Crucial for library compatibility: */
88
"skipLibCheck": true, // Skip type checking of declaration files for faster builds
99
"allowSyntheticDefaultImports": true, // Often helps with ESM interop
@@ -21,7 +21,7 @@
2121
"sourceMap": true /* Generates corresponding '.map' file. */,
2222
// "outFile": "./", /* Concatenate and emit output to single file. */
2323

24-
"outDir": "lib" /* Redirect output structure to the directory. */,
24+
"outDir": "dist" /* Redirect output structure to the directory. */,
2525
"rootDir": "src/",
2626
"plugins": [{ "name": "typescript-plugin-css-modules" }],
2727

webpack.config.mjs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const externalsESM = {
2626
}
2727

2828
const commonConfig = {
29-
mode: 'production',
3029
entry: './src/sourcePane.ts',
30+
mode: 'production',
3131
module: {
3232
rules: moduleRules,
3333
},
@@ -47,15 +47,16 @@ const umdConfig = {
4747
path: path.resolve(process.cwd(), 'dist'),
4848
filename: 'source-pane.js',
4949
chunkFilename: '[name].js',
50+
publicPath: 'auto',
5051
library: {
5152
type: 'umd',
5253
name: 'SourcePane',
5354
export: 'default',
5455
},
5556
globalObject: 'this',
56-
clean: false,
5757
},
5858
optimization: {
59+
concatenateModules: false,
5960
minimize: false,
6061
},
6162
}
@@ -67,15 +68,16 @@ const minConfig = {
6768
path: path.resolve(process.cwd(), 'dist'),
6869
filename: 'source-pane.min.js',
6970
chunkFilename: '[name].min.js',
71+
publicPath: 'auto',
7072
library: {
7173
type: 'umd',
7274
name: 'SourcePane',
7375
export: 'default',
7476
},
7577
globalObject: 'this',
76-
clean: false,
7778
},
7879
optimization: {
80+
concatenateModules: false,
7981
minimize: true,
8082
minimizer: [
8183
new TerserPlugin({
@@ -90,25 +92,29 @@ const minConfig = {
9092
},
9193
}
9294

93-
const esmConfig = {
95+
const esmPaneConfig = {
9496
...commonConfig,
97+
devtool: false,
9598
externals: externalsESM,
9699
externalsType: 'module',
97100
experiments: {
98101
outputModule: true,
99102
},
100103
output: {
101-
path: path.resolve(process.cwd(), 'dist'),
104+
path: path.resolve(process.cwd(), 'dist/esm'),
102105
filename: 'source-pane.esm.js',
103106
chunkFilename: '[name].esm.js',
107+
publicPath: 'auto',
104108
library: {
105109
type: 'module',
106110
},
107-
clean: false,
108111
},
109112
optimization: {
113+
concatenateModules: false,
114+
runtimeChunk: false,
115+
splitChunks: false,
110116
minimize: false,
111117
},
112118
}
113119

114-
export default [umdConfig, minConfig, esmConfig]
120+
export default [umdConfig, minConfig, esmPaneConfig]

webpack.dev.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default [
88
mode: 'development',
99
entry: ['./dev/index.js'],
1010
output: {
11-
path: path.resolve(process.cwd(), 'lib'),
11+
path: path.resolve(process.cwd(), 'dist'),
1212
filename: 'main.js',
1313
clean: false,
1414
},

0 commit comments

Comments
 (0)