fix: rollup compress the utils folder
Some checks failed
Some checks failed
This commit is contained in:
parent
9b1ce3faca
commit
5f3b4395ab
|
@ -2,12 +2,12 @@
|
|||
"name": "laterano",
|
||||
"version": "0.0.1",
|
||||
"main": "dist/main.min.js",
|
||||
"types": "dist/types.d.ts",
|
||||
"types": "dist/types/main.d.ts",
|
||||
"module": "dist/main.min.js",
|
||||
"scripts": {
|
||||
"build": "tsc && rollup -c && npm run cleanup-intermediate",
|
||||
"prepare": "npm run build",
|
||||
"cleanup-intermediate": "rimraf dist/main.js dist/types",
|
||||
"cleanup-intermediate": "rimraf dist/main.js dist/utils",
|
||||
"quality-check": "biome ci .",
|
||||
"qc": "npm run quality-check",
|
||||
"lint": "biome format . --write"
|
||||
|
|
|
@ -5,7 +5,7 @@ import dts from 'rollup-plugin-dts'
|
|||
|
||||
export default [
|
||||
{
|
||||
input: 'dist/main.js',
|
||||
input: 'src/main.ts',
|
||||
output: [
|
||||
{
|
||||
file: 'dist/main.min.js',
|
||||
|
@ -15,10 +15,20 @@ export default [
|
|||
],
|
||||
plugins: [resolve(), typescript()],
|
||||
},
|
||||
{
|
||||
input: 'dist/utils/index.js',
|
||||
output: {
|
||||
file: 'dist/utils.bundle.min.js',
|
||||
format: 'esm',
|
||||
inlineDynamicImports: true,
|
||||
plugins: [terser()],
|
||||
},
|
||||
plugins: [resolve(), typescript({ outDir: 'dist' })],
|
||||
},
|
||||
{
|
||||
input: 'dist/types/main.d.ts',
|
||||
output: {
|
||||
file: 'dist/types.d.ts',
|
||||
file: 'dist/types/main.d.ts',
|
||||
format: 'es',
|
||||
},
|
||||
plugins: [dts()],
|
||||
|
|
21
src/main.ts
21
src/main.ts
|
@ -1,5 +1,26 @@
|
|||
import utils from './utils/index'
|
||||
|
||||
interface ComponentOptions {
|
||||
tag: string
|
||||
template: string
|
||||
style?: string
|
||||
onMount?: (this: CustomElement) => void
|
||||
onUnmount?: () => void
|
||||
onAttributeChanged?: (
|
||||
attrName: string,
|
||||
oldValue: string,
|
||||
newValue: string,
|
||||
) => void
|
||||
states?: Record<string, unknown>
|
||||
statesListeners?: { [key: string]: (value: unknown) => void }
|
||||
funcs?: { [key: string]: (...args: unknown[]) => void }
|
||||
}
|
||||
|
||||
interface CustomElement extends HTMLElement {
|
||||
setState(key_path: string, value: unknown): void
|
||||
getState(key_path: string): unknown
|
||||
}
|
||||
|
||||
export default (options: ComponentOptions) => {
|
||||
const {
|
||||
tag,
|
||||
|
|
29
src/types.d.ts
vendored
29
src/types.d.ts
vendored
|
@ -1,29 +0,0 @@
|
|||
interface CustomElement extends HTMLElement {
|
||||
setState(key_path: string, value: unknown): void
|
||||
getState(key_path: string): unknown
|
||||
}
|
||||
|
||||
interface ListRenderingContext {
|
||||
states: Record<string, unknown>
|
||||
stateToElementsMap: Record<string, Set<HTMLElement>>
|
||||
statesListeners: Record<string, (value: unknown) => void>
|
||||
setState: (keyPath: string, value: unknown) => void
|
||||
getState: (keyPath: string) => unknown
|
||||
triggerFunc: (eventName: string, ...args: unknown[]) => void
|
||||
}
|
||||
|
||||
interface ComponentOptions {
|
||||
tag: string
|
||||
template: string
|
||||
style?: string
|
||||
onMount?: (this: CustomElement) => void
|
||||
onUnmount?: () => void
|
||||
onAttributeChanged?: (
|
||||
attrName: string,
|
||||
oldValue: string,
|
||||
newValue: string,
|
||||
) => void
|
||||
states?: Record<string, unknown>
|
||||
statesListeners?: { [key: string]: (value: unknown) => void }
|
||||
funcs?: { [key: string]: (...args: unknown[]) => void }
|
||||
}
|
|
@ -1,5 +1,19 @@
|
|||
import setupArrowFunctionHandler from './setupArrowFunctionHandler'
|
||||
|
||||
interface CustomElement extends HTMLElement {
|
||||
setState(key_path: string, value: unknown): void
|
||||
getState(key_path: string): unknown
|
||||
}
|
||||
|
||||
interface ListRenderingContext {
|
||||
states: Record<string, unknown>
|
||||
stateToElementsMap: Record<string, Set<HTMLElement>>
|
||||
statesListeners: Record<string, (value: unknown) => void>
|
||||
setState: (keyPath: string, value: unknown) => void
|
||||
getState: (keyPath: string) => unknown
|
||||
triggerFunc: (eventName: string, ...args: unknown[]) => void
|
||||
}
|
||||
|
||||
export default function processTemplateMacros(
|
||||
element: Element,
|
||||
context: CustomElement,
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||
// "typeRoots": ["./src/types"], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
"typeRoots": ["./src/types"], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
|
|
Loading…
Reference in New Issue
Block a user