diff --git a/.esbuildrc.js b/.esbuildrc.js new file mode 100644 index 0000000..71efa48 --- /dev/null +++ b/.esbuildrc.js @@ -0,0 +1,10 @@ +const { build } = require('esbuild') + +const options = { + jsxFactory: 'h' +} + +build(options).catch(err => { + process.stderr.write(err.stderr) + process.exit(1) +}) diff --git a/.eslintrc b/.eslintrc index 06a5fd3..1276d51 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,4 @@ { - "parser": "babel-eslint", "extends": "eslint:recommended", "env": { "browser": true, @@ -18,16 +17,41 @@ "rules": { "no-empty": 0, "no-console": 0, - "no-unused-vars": [0, { "varsIgnorePattern": "^h$" }], + "no-unused-vars": [ + 0, + { + "varsIgnorePattern": "^h$" + } + ], "no-cond-assign": 1, "semi": 2, "camelcase": 0, "comma-style": 2, - "comma-dangle": [2, "never"], - "indent": [2, "tab", {"SwitchCase": 1}], - "no-mixed-spaces-and-tabs": [2, "smart-tabs"], - "no-trailing-spaces": [2, { "skipBlankLines": true }], - "max-nested-callbacks": [2, 3], + "comma-dangle": [ + 2, + "never" + ], + "indent": [ + 2, + "tab", + { + "SwitchCase": 1 + } + ], + "no-mixed-spaces-and-tabs": [ + 2, + "smart-tabs" + ], + "no-trailing-spaces": [ + 2, + { + "skipBlankLines": true + } + ], + "max-nested-callbacks": [ + 2, + 3 + ], "no-eval": 2, "no-implied-eval": 2, "no-new-func": 2, @@ -37,7 +61,10 @@ "no-redeclare": 2, "no-dupe-keys": 2, "radix": 2, - "strict": [2, "never"], + "strict": [ + 2, + "never" + ], "no-shadow": 0, "no-delete-var": 2, "no-undef-init": 2, @@ -54,4 +81,4 @@ "object-shorthand": 2, "prefer-arrow-callback": 2 } -} +} \ No newline at end of file diff --git a/README.md b/README.md index 1c41422..33010dd 100644 --- a/README.md +++ b/README.md @@ -101,3 +101,17 @@ The above outputs the following HTML: ``` + +### To generate comment in h + +```js +h('!', null) +h('!', null,

foo

, bar,
baz
) +``` + +The above outputs the following HTML: + +```html + + +```` diff --git a/package.json b/package.json index 6e3d2ff..433b77f 100644 --- a/package.json +++ b/package.json @@ -1,73 +1,59 @@ { - "name": "vhtml", - "amdName": "vhtml", - "version": "2.2.0", - "description": "Hyperscript reviver that constructs a sanitized HTML string.", - "main": "dist/vhtml.js", - "minified:main": "dist/vhtml.min.js", - "jsnext:main": "src/vhtml.js", - "scripts": { - "build": "npm-run-all transpile minify size", - "transpile": "rollup -c rollup.config.js", - "minify": "uglifyjs $npm_package_main -cm -o $npm_package_minified_main -p relative --in-source-map ${npm_package_main}.map --source-map ${npm_package_minified_main}.map", - "size": "echo \"gzip size: $(gzip-size $npm_package_minified_main | pretty-bytes)\"", - "test": "eslint {src,test} && mocha --compilers js:babel-register test/**/*.js", - "prepublish": "npm-run-all build test", - "release": "npm run -s build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish" - }, - "babel": { - "presets": [ - "es2015", - "stage-0" + "name": "vhtml", + "amdName": "vhtml", + "version": "2.2.2", + "description": "Hyperscript reviver that constructs a sanitized HTML string.", + "main": "./dist/vhtml.cjs.js", + "module": "./dist/vhtml.es.js", + "browser": "./dist/vhtml.umd.js", + "types": "./dist/types/vhtml.d.ts", + "minified:main": "./dist/vhtml.umd.js", + "jsnext:main": "./src/vhtml.ts", + "scripts": { + "release1": "git add . && git commit -m \"Bump version\" && git push && pnpm version patch", + "preinstall": "npx only-allow pnpm", + "build": "vite build && tsc --declaration && pnpm size", + "tsc": "tsc", + "size": "echo \"gzip size: $(gzip-size $npm_package_minified_main | pretty-bytes)\"", + "test": "mocha --require esbuild-register test/**/*.ts*", + "prepublish": "pnpm build && pnpm test", + "release": "npm run -s build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish" + }, + "files": [ + "src", + "dist" ], - "plugins": [ - "transform-object-rest-spread", - [ - "transform-react-jsx", - { - "pragma": "h" - } - ] - ] - }, - "files": [ - "src", - "dist" - ], - "keywords": [ - "hyperscript", - "html", - "renderer", - "strings" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/developit/vhtml.git" - }, - "author": "Jason Miller ", - "license": "MIT", - "bugs": { - "url": "https://github.com/developit/vhtml/issues" - }, - "homepage": "https://github.com/developit/vhtml", - "devDependencies": { - "babel-core": "^6.6.4", - "babel-eslint": "^7.0.0", - "babel-plugin-transform-object-rest-spread": "^6.6.4", - "babel-plugin-transform-react-jsx": "^6.6.5", - "babel-preset-es2015": "^6.9.0", - "babel-preset-stage-0": "^6.5.0", - "babel-register": "^6.7.2", - "chai": "^3.5.0", - "eslint": "^3.1.0", - "gzip-size-cli": "^1.0.0", - "mkdirp": "^0.5.1", - "mocha": "^3.1.2", - "npm-run-all": "^2.3.0", - "pretty-bytes-cli": "^1.0.0", - "rollup": "^0.36.3", - "rollup-plugin-babel": "^2.4.0", - "rollup-plugin-es3": "^1.0.3", - "uglify-js": "^2.6.2" - } + "keywords": [ + "hyperscript", + "html", + "renderer", + "strings" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/developit/vhtml.git" + }, + "author": "Jason Miller ", + "license": "MIT", + "bugs": { + "url": "https://github.com/developit/vhtml/issues" + }, + "homepage": "https://github.com/developit/vhtml", + "devDependencies": { + "chai": "^5.1.0", + "esbuild-register": "^3.5.0", + "eslint": "^9.0.0", + "gzip-size-cli": "^5.1.0", + "mocha": "^10.4.0", + "npm-run-all": "^4.1.5", + "pretty-bytes-cli": "^3.0.0", + "uglify-js": "^3.17.4", + "vite": "^5.2.8", + "vite-plugin-clean": "^1.0.0" + }, + "dependencies": { + "@types/mocha": "^10.0.2", + "pnpm": "^8.15.7", + "typescript": "5.4.5" + } } diff --git a/rollup.config.js b/rollup.config.js deleted file mode 100644 index 3a7799d..0000000 --- a/rollup.config.js +++ /dev/null @@ -1,26 +0,0 @@ -import path from 'path'; -import fs from 'fs'; -import babel from 'rollup-plugin-babel'; -import es3 from 'rollup-plugin-es3'; - -let pkg = JSON.parse(fs.readFileSync('./package.json')); - -export default { - entry: pkg['jsnext:main'], - dest: pkg.main, - sourceMap: path.resolve(pkg.main), - moduleName: pkg.amdName, - exports: 'default', - format: 'umd', - plugins: [ - babel({ - babelrc: false, - comments: false, - presets: [ - ['es2015', { loose:true, modules:false }] - ].concat(pkg.babel.presets.slice(1)), - plugins: pkg.babel.plugins - }), - es3() - ] -}; diff --git a/src/empty-tags.js b/src/empty-tags.ts similarity index 94% rename from src/empty-tags.js rename to src/empty-tags.ts index 6f91e68..b238d70 100644 --- a/src/empty-tags.js +++ b/src/empty-tags.ts @@ -14,5 +14,5 @@ export default [ 'param', 'source', 'track', - 'wbr' -]; \ No newline at end of file + 'wbr', +] diff --git a/src/vhtml.js b/src/vhtml.js deleted file mode 100644 index 0e03f69..0000000 --- a/src/vhtml.js +++ /dev/null @@ -1,60 +0,0 @@ -import emptyTags from './empty-tags'; - -// escape an attribute -let esc = str => String(str).replace(/[&<>"']/g, s=>`&${map[s]};`); -let map = {'&':'amp','<':'lt','>':'gt','"':'quot',"'":'apos'}; -let setInnerHTMLAttr = 'dangerouslySetInnerHTML'; -let DOMAttributeNames = { - className: 'class', - htmlFor: 'for' -}; - -let sanitized = {}; - -/** Hyperscript reviver that constructs a sanitized HTML string. */ -export default function h(name, attrs) { - let stack=[], s = ''; - attrs = attrs || {}; - for (let i=arguments.length; i-- > 2; ) { - stack.push(arguments[i]); - } - - // Sortof component support! - if (typeof name==='function') { - attrs.children = stack.reverse(); - return name(attrs); - // return name(attrs, stack.reverse()); - } - - if (name) { - s += '<' + name; - if (attrs) for (let i in attrs) { - if (attrs[i]!==false && attrs[i]!=null && i !== setInnerHTMLAttr) { - s += ` ${DOMAttributeNames[i] ? DOMAttributeNames[i] : esc(i)}="${esc(attrs[i])}"`; - } - } - s += '>'; - } - - if (emptyTags.indexOf(name) === -1) { - if (attrs[setInnerHTMLAttr]) { - s += attrs[setInnerHTMLAttr].__html; - } - else while (stack.length) { - let child = stack.pop(); - if (child) { - if (child.pop) { - for (let i=child.length; i--; ) stack.push(child[i]); - } - else { - s += sanitized[child]===true ? child : esc(child); - } - } - } - - s += name ? `` : ''; - } - - sanitized[s] = true; - return s; -} diff --git a/src/vhtml.ts b/src/vhtml.ts new file mode 100644 index 0000000..d5e9eee --- /dev/null +++ b/src/vhtml.ts @@ -0,0 +1,79 @@ +import emptyTags from './empty-tags' + +// escape an attribute +let esc = (str: string) => String(str).replace(/[&<>"']/g, (s) => `&${map[s as keyof typeof map]};`) +let map = { '&': 'amp', '<': 'lt', '>': 'gt', '"': 'quot', "'": 'apos' } +let setInnerHTMLAttr = 'dangerouslySetInnerHTML' +let DOMAttributeNames = { + className: 'class', + htmlFor: 'for' +} + +let sanitized: Record = {} + +/** Hyperscript reviver that constructs a sanitized HTML string. */ +export default function h(name: string | Function | null, attrs: any, ..._args: any[]) { + let stack: string[] = [], s = '' + attrs = attrs || {} + for (let i = arguments.length; i-- > 2;) { + stack.push(arguments[i]) + } + + // Sortof component support! + if (typeof name === 'function') { + attrs.children = stack.reverse() + return name(attrs) + // return name(attrs, stack.reverse()); + } + + const loopAttr = () => { + if (attrs) for (let i in attrs) { + if (attrs[i] !== false && attrs[i] != null && i !== setInnerHTMLAttr) { + //@ts-ignore + s += ` ${DOMAttributeNames[i] ? DOMAttributeNames[i] : esc(i)}="${esc(attrs[i])}"` + } + } + } + + if (name) { + if (name === '!') { + s += '' + else if (name === 'text') { } + else + s += name ? `` : '' + } + + sanitized[s] = true + return s +} diff --git a/test/vhtml.js b/test/vhtml.test.tsx similarity index 51% rename from test/vhtml.js rename to test/vhtml.test.tsx index f88ddf2..f0f7c78 100644 --- a/test/vhtml.js +++ b/test/vhtml.test.tsx @@ -1,141 +1,154 @@ -import h from '../src/vhtml'; -import { expect } from 'chai'; +/// + +//to disable syntax error +import React from 'react' + +import h from '../src/vhtml' +import { expect } from 'chai' /** @jsx h */ /*global describe,it*/ describe('vhtml', () => { it('should stringify html', () => { - let items = ['one', 'two', 'three']; + let items = ['one', 'two', 'three'] expect(

Hi!

Here is a list of {items.length} items:

    - { items.map( item => ( -
  • { item }
  • - )) } + {items.map(item => ( +
  • {item}
  • + ))}
).to.equal( `

Hi!

Here is a list of 3 items:

  • one
  • two
  • three
` - ); - }); + ) + }) it('should sanitize children', () => { expect(
- { `blocked` } + {`blocked`} allowed
).to.equal( `
<strong>blocked</strong>allowed
` - ); - }); + ) + }) it('should sanitize attributes', () => { expect(
"'`} /> ).to.equal( `
` - ); - }); + ) + }) + + // it('should sanitize function', () => { + // expect( + //
alert('hello')} /> + // ).to.equal( + // `
` + // ) + // }) it('should not sanitize the "dangerouslySetInnerHTML" attribute, and directly set its `__html` property as innerHTML', () => { expect(
Injected HTML" }} /> ).to.equal( `
Injected HTML
` - ); - }); + ) + }) it('should flatten children', () => { expect(
- {[['a','b']]} + {[['a', 'b']]} d - {['e',['f'],[['g']]]} + {['e', ['f'], [['g']]]}
).to.equal( `
abdefg
` - ); - }); + ) + }) it('should support sortof components', () => { - let items = ['one', 'two']; + let items = ['one', 'two'] const Item = ({ item, index, children }) => (
  • {item}

    {children}
  • - ); + ) expect(

    Hi!

      - { items.map( (item, index) => ( + {items.map((item, index) => ( This is item {item}! - )) } + ))}
    ).to.equal( `

    Hi!

    • one

      This is item one!
    • two

      This is item two!
    ` - ); - }); + ) + }) it('should support sortof components without args', () => { - let items = ['one', 'two']; - - const Item = () => ( -
  • -

    -
  • - ); - - expect( -
    -

    Hi!

    -
      - { items.map( (item, index) => ( - - This is item {item}! - - )) } -
    -
    - ).to.equal( - `

    Hi!

    ` - ); - }); + let items = ['one', 'two'] + + const Item = () => ( +
  • +

    +
  • + ) + + expect( +
    +

    Hi!

    +
      + {items.map((item, index) => ( + + This is item {item}! + + ))} +
    +
    + ).to.equal( + `

    Hi!

    ` + ) + }) it('should support sortof components without args but with children', () => { - let items = ['one', 'two']; - - const Item = ({ children }) => ( -
  • -

    - {children} -
  • - ); - - expect( -
    -

    Hi!

    -
      - { items.map( (item, index) => ( - - This is item {item}! - - )) } -
    -
    - ).to.equal( - `

    Hi!

    • This is item one!
    • This is item two!
    ` - ); - }); + let items = ['one', 'two'] + + const Item = ({ children }) => ( +
  • +

    + {children} +
  • + ) + + expect( +
    +

    Hi!

    +
      + {items.map((item, index) => ( + + This is item {item}! + + ))} +
    +
    + ).to.equal( + `

    Hi!

    • This is item one!
    • This is item two!
    ` + ) + }) it('should support empty (void) tags', () => { expect( @@ -163,31 +176,69 @@ describe('vhtml', () => {
    ).to.equal( `


    ` - ); - }); + ) + }) it('should handle special prop names', () => { expect(
    ).to.equal( '
    ' - ); - }); + ) + }) it('should support string fragments', () => { expect( h(null, null, "foo", "bar", "baz") ).to.equal( 'foobarbaz' - ); - }); + ) + }) it('should support element fragments', () => { expect( h(null, null,

    foo

    , bar,
    baz
    ) ).to.equal( '

    foo

    bar
    baz
    ' - ); - }); + ) + }) -}); + it('should support svg', () => { + expect( + + + + + + + + + + ).to.equal( + `` + ) + }) + + it('should support text', () => { + expect( + h('text', null, "hello world!") + ).to.equal( + `hello world!` + ) + }) + + it('should support empty comment', () => { + expect( + h('!', null) + ).to.equal( + '' + ) + }) + it('should support comment', () => { + expect( + h('!', null,

    foo

    , bar,
    baz
    ) + ).to.equal( + '' + ) + }) +}) diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..864dc34 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,101 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + /* Modules */ + "module": "UMD", /* Specify what module code is generated. */ + "rootDir": "./src", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "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": [], /* Specify multiple folders that act like './node_modules/@types'. */ + "types": [ + "mocha" + ], /* 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. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./dist", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + "declarationDir": "./dist/types", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "test/*", + "vite.config.mts" + ] +} diff --git a/vite.config.mts b/vite.config.mts new file mode 100644 index 0000000..a0cbe42 --- /dev/null +++ b/vite.config.mts @@ -0,0 +1,27 @@ + +/* IMPORT */ + +import { defineConfig } from 'vite' + + +/* MAIN */ + +const config = defineConfig({ + build: { + target: 'esnext', + // minify: false, + lib: { + name: 'vhtml', + formats: [/*'cjs', '*/'es'/*, 'umd'*/], + entry: "./src/vhtml.ts", + fileName: (format: string, entryName: string) => `${entryName}.${format}.js` + }, + }, + esbuild: { + // jsx: 'automatic', + }, +}) + +/* EXPORT */ + +export default config pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy