Skip to content

Commit 520ada7

Browse files
committed
Some updates
1 parent 6c247be commit 520ada7

21 files changed

+531
-576
lines changed

common/index.js

Whitespace-only changes.

common/package.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

crank/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict'
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('../dist/js-elements.crank.cjs.production.js')
5+
} else {
6+
module.exports = require('../dist/js-elements.crank.cjs.development.js')
7+
}

ext/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict'
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('../dist/js-elements.ext.cjs.production.js')
5+
} else {
6+
module.exports = require('../dist/js-elements.ext.cjs.development.js')
7+
}

package-lock.json

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

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-elements",
3-
"version": "0.0.53",
3+
"version": "0.0.59",
44
"description": "",
55
"main": "index.js",
66
"module": "dist/js-elements.esm.producion.js",
@@ -9,14 +9,18 @@
99
"types": "dist/types/main/index.d.ts",
1010
"files": [
1111
"index.js",
12-
"dist"
12+
"dist",
13+
"ext",
14+
"lit-html",
15+
"preact",
16+
"crank"
1317
],
1418
"scripts": {
1519
"clean": "shx rm -rf ./build ./dist",
1620
"test": "echo \"Error: no test specified\" && exit 1",
1721
"storybook": "start-storybook -p 6006",
1822
"build-storybook": "build-storybook",
19-
"build": "npm run clean && rollup --c rollup.config.js && tsc -d --emitDeclarationOnly --declarationDir dist/types",
23+
"build": "npm run clean && cross-env NODE_OPTIONS=--max_old_space_size=4096 rollup --c rollup.config.js && tsc -d --emitDeclarationOnly --declarationDir dist/types",
2024
"dist": "npm run build && npm run zipsource",
2125
"zipsource": "shx rm -rf ./build/source && shx mkdir -p ./build/source && copyfiles -a ./* ./build/source && shx cp -r ./src ./build/source && shx mkdir -p ./dist/source && cd build && bestzip --force node ../dist/source/source.zip source && cd .."
2226
},
@@ -49,6 +53,7 @@
4953
"bestzip": "^2.1.6",
5054
"compression-webpack-plugin": "^4.0.0",
5155
"copyfiles": "^2.3.0",
56+
"cross-env": "^7.0.2",
5257
"dyo": "^2.0.4",
5358
"eslint": "^7.6.0",
5459
"js-spec": "^0.1.79",
@@ -76,6 +81,7 @@
7681
"zip-webpack-plugin": "^3.0.0"
7782
},
7883
"dependencies": {
84+
"@bikeshaving/crank": "^0.3.2",
7985
"@types/superfine": "^7.0.1"
8086
}
8187
}

preact/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict'
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
module.exports = require('../dist/js-elements.preact.cjs.production.js')
5+
} else {
6+
module.exports = require('../dist/js-elements.preact.cjs.development.js')
7+
}

rollup.config.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import gzip from 'rollup-plugin-gzip'
88

99
const configs = []
1010

11-
for (const pkg of ['core', 'common', 'lit-html', 'ext', 'preact', 'crank']) {
11+
for (const pkg of ['root', 'lit-html', 'ext', 'preact', 'crank']) {
1212
for (const format of ['umd', 'cjs', 'amd', 'esm']) {
1313
for (const productive of [false, true]) {
1414
configs.push(createConfig(pkg, format, productive))
@@ -21,22 +21,38 @@ export default configs
2121
// --- locals -------------------------------------------------------
2222

2323
function createConfig(pkg, moduleFormat, productive) {
24+
const env = productive ? 'productive' : 'development'
25+
2426
return {
25-
input: `src/main/js-elements-${pkg}.ts`,
27+
input:
28+
pkg === 'root'
29+
? 'src/main/js-elements.ts'
30+
: `src/main/js-elements-${pkg}.ts`,
2631

2732
output: {
28-
file: productive
29-
? `dist/js-elements.${pkg}.${moduleFormat}.production.js`
30-
: `dist/js-elements.${pkg}.${moduleFormat}.development.js`,
33+
file:
34+
pkg === 'root'
35+
? `dist/js-elements.${moduleFormat}.${env}.js`
36+
: `dist/js-elements.${pkg}.${moduleFormat}.${env}.js`,
3137

3238
format: moduleFormat,
3339
sourcemap: false, // productive ? false : 'inline', // TODO
34-
name: 'jsElements.' + pkg,
40+
name: pkg === 'root' ? 'jsElements' : 'jsElements.' + pkg,
3541

36-
globals: {}
42+
globals: {
43+
'lit-html': 'litHtml',
44+
preact: 'preact',
45+
'@bikeshaving/crank': 'crank',
46+
'@bikeshaving/crank/dom': 'crankDOM'
47+
}
3748
},
3849

39-
external: ['lit-html', 'preact', 'crank'],
50+
external: [
51+
'lit-html',
52+
'preact',
53+
'@bikeshaving/crank',
54+
'@bikeshaving/crank/dom'
55+
],
4056

4157
plugins: [
4258
resolve(),

src/main/api/core.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ type FunctionDefineElement<O, R> = {
179179

180180
// === createAdaption ================================================
181181

182-
function createAdaption<O, R>(renderer: any): FunctionDefineElement<O, R> {
182+
function createAdaption<O, R>(
183+
renderer: (content: O, target: Element) => void
184+
): FunctionDefineElement<O, R> {
183185
return (name: string, config: any) =>
184186
defineElementWithRenderer(name, config, renderer) as any // TODO
185187
}

0 commit comments

Comments
 (0)