diff --git a/examples/adaptive-threshold/.gitignore b/examples/adaptive-threshold/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/adaptive-threshold/.gitignore +++ b/examples/adaptive-threshold/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/adaptive-threshold/package.json b/examples/adaptive-threshold/package.json index 595a4517d8..3131f9e821 100644 --- a/examples/adaptive-threshold/package.json +++ b/examples/adaptive-threshold/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -39,5 +33,8 @@ "transducers-hdom" ], "screenshot": "examples/adaptive-threshold.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/adaptive-threshold/index.html b/examples/adaptive-threshold/public/index.html similarity index 93% rename from examples/adaptive-threshold/index.html rename to examples/adaptive-threshold/public/index.html index 5cd9b402b9..0c128a830a 100644 --- a/examples/adaptive-threshold/index.html +++ b/examples/adaptive-threshold/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/adaptive-threshold/snowpack.config.js b/examples/adaptive-threshold/snowpack.config.js new file mode 100644 index 0000000000..b453cdcb2a --- /dev/null +++ b/examples/adaptive-threshold/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/adaptive-threshold", + }, +}; diff --git a/examples/adaptive-threshold/src/api.ts b/examples/adaptive-threshold/src/api.ts index c8bd70dfe2..f1341427d6 100644 --- a/examples/adaptive-threshold/src/api.ts +++ b/examples/adaptive-threshold/src/api.ts @@ -1,5 +1,5 @@ import type { Val1 } from "@thi.ng/api"; -import { PackedBuffer } from "@thi.ng/pixel"; +import type { PackedBuffer } from "@thi.ng/pixel"; // event ID constants export const SET_IMAGE = "set-image"; diff --git a/examples/adaptive-threshold/src/index.ts b/examples/adaptive-threshold/src/index.ts index bc34d84ba9..e67ff8d09f 100644 --- a/examples/adaptive-threshold/src/index.ts +++ b/examples/adaptive-threshold/src/index.ts @@ -1,5 +1,5 @@ import { peek } from "@thi.ng/arrays"; -import { PackedBuffer } from "@thi.ng/pixel"; +import type { PackedBuffer } from "@thi.ng/pixel"; import { fromRAF, sidechainPartition } from "@thi.ng/rstream"; import { map } from "@thi.ng/transducers"; import { updateDOM } from "@thi.ng/transducers-hdom"; diff --git a/examples/adaptive-threshold/src/static.d.ts b/examples/adaptive-threshold/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/adaptive-threshold/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/adaptive-threshold/src/webpack.d.ts b/examples/adaptive-threshold/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/adaptive-threshold/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/adaptive-threshold/tsconfig.json b/examples/adaptive-threshold/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/adaptive-threshold/tsconfig.json +++ b/examples/adaptive-threshold/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/adaptive-threshold/webpack.config.js b/examples/adaptive-threshold/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/adaptive-threshold/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/async-effect/.gitignore b/examples/async-effect/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/async-effect/.gitignore +++ b/examples/async-effect/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/async-effect/package.json b/examples/async-effect/package.json index c3941cd3dc..02cc4e607a 100644 --- a/examples/async-effect/package.json +++ b/examples/async-effect/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "prep": "yarn clean && mkdir -p out && cp foo.json out", - "build": "yarn prep && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "yarn prep && parcel index.html -p 8080 --open -d out" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -31,5 +25,8 @@ "readme": [ "interceptors" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/async-effect/foo.json b/examples/async-effect/public/foo.json similarity index 100% rename from examples/async-effect/foo.json rename to examples/async-effect/public/foo.json diff --git a/examples/async-effect/index.html b/examples/async-effect/public/index.html similarity index 94% rename from examples/async-effect/index.html rename to examples/async-effect/public/index.html index 85e1afcc39..846f7e2034 100644 --- a/examples/async-effect/index.html +++ b/examples/async-effect/public/index.html @@ -44,6 +44,6 @@

async side effect handling

>

- + diff --git a/examples/async-effect/snowpack.config.js b/examples/async-effect/snowpack.config.js new file mode 100644 index 0000000000..947542ffe9 --- /dev/null +++ b/examples/async-effect/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/async-effect", + }, +}; diff --git a/examples/async-effect/src/static.d.ts b/examples/async-effect/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/async-effect/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/async-effect/tsconfig.json b/examples/async-effect/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/async-effect/tsconfig.json +++ b/examples/async-effect/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/bitmap-font/.gitignore b/examples/bitmap-font/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/bitmap-font/.gitignore +++ b/examples/bitmap-font/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/bitmap-font/package.json b/examples/bitmap-font/package.json index a69324ec08..985362ff7a 100644 --- a/examples/bitmap-font/package.json +++ b/examples/bitmap-font/package.json @@ -6,16 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "rimraf": "^2.6.3", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -40,5 +33,8 @@ "transducers-hdom" ], "screenshot": "examples/bitmap-font.gif" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/bitmap-font/index.html b/examples/bitmap-font/public/index.html similarity index 92% rename from examples/bitmap-font/index.html rename to examples/bitmap-font/public/index.html index 33c4369f85..230a13f3db 100644 --- a/examples/bitmap-font/index.html +++ b/examples/bitmap-font/public/index.html @@ -27,6 +27,6 @@ >Source code - + diff --git a/examples/bitmap-font/snowpack.config.js b/examples/bitmap-font/snowpack.config.js new file mode 100644 index 0000000000..44f64dc948 --- /dev/null +++ b/examples/bitmap-font/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/bitmap-font", + }, +}; diff --git a/examples/bitmap-font/src/index.ts b/examples/bitmap-font/src/index.ts index 7b23a4072b..0dab0a6250 100644 --- a/examples/bitmap-font/src/index.ts +++ b/examples/bitmap-font/src/index.ts @@ -48,6 +48,7 @@ const banner = ({ input, on, off }: IObjectOf) => comp( // dynamically create `xfChar` transducers for each char // and run them in parallel via `multiplex()` + // @ts-ignore multiplex.apply(null, [ ...map((i) => xfChar(i, on, off), range(input.length)), ]), @@ -57,6 +58,7 @@ const banner = ({ input, on, off }: IObjectOf) => // use `str()` reducer to build string result str("\n"), // convert input string into stream of row-major bitmap font tuples + // @ts-ignore zip.apply(null, [...map(lookupChar, input || " ")]) ); @@ -113,8 +115,8 @@ main.transform(map(app), updateDOM()); // input.next(transduce(map((x: number) => String.fromCharCode(x)), str(), range(32, 127))); -// HMR handling -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(() => main.done()); -} +// // HMR handling +// if (process.env.NODE_ENV !== "production") { +// const hot = (module).hot; +// hot && hot.dispose(() => main.done()); +// } diff --git a/examples/bitmap-font/src/static.d.ts b/examples/bitmap-font/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/bitmap-font/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/bitmap-font/tsconfig.json b/examples/bitmap-font/tsconfig.json index 118d2a6ce2..48d558b4f8 100644 --- a/examples/bitmap-font/tsconfig.json +++ b/examples/bitmap-font/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true, - "strictBindCallApply": false - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/bitmap-font/webpack.config.js b/examples/bitmap-font/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/bitmap-font/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/canvas-dial/.gitignore b/examples/canvas-dial/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/canvas-dial/.gitignore +++ b/examples/canvas-dial/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/canvas-dial/package.json b/examples/canvas-dial/package.json index ec75eda138..d457e003ec 100644 --- a/examples/canvas-dial/package.json +++ b/examples/canvas-dial/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -42,5 +36,8 @@ "vectors" ], "screenshot": "examples/canvas-dial.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/canvas-dial/index.html b/examples/canvas-dial/public/index.html similarity index 90% rename from examples/canvas-dial/index.html rename to examples/canvas-dial/public/index.html index da2c34495e..5a4fad6bc5 100644 --- a/examples/canvas-dial/index.html +++ b/examples/canvas-dial/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/canvas-dial/snowpack.config.js b/examples/canvas-dial/snowpack.config.js new file mode 100644 index 0000000000..c11ebe5b7f --- /dev/null +++ b/examples/canvas-dial/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/canvas-dial", + }, +}; diff --git a/examples/canvas-dial/src/dial.ts b/examples/canvas-dial/src/dial.ts index f14d776e0c..552a189560 100644 --- a/examples/canvas-dial/src/dial.ts +++ b/examples/canvas-dial/src/dial.ts @@ -3,7 +3,7 @@ import { peek } from "@thi.ng/arrays"; import { isString } from "@thi.ng/checks"; import { canvas2D } from "@thi.ng/hdom-components"; import { fitClamped } from "@thi.ng/math"; -import { Subscription } from "@thi.ng/rstream"; +import type { Subscription } from "@thi.ng/rstream"; import { GestureEvent, gestureStream, diff --git a/examples/canvas-dial/src/static.d.ts b/examples/canvas-dial/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/canvas-dial/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/canvas-dial/tsconfig.json b/examples/canvas-dial/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/canvas-dial/tsconfig.json +++ b/examples/canvas-dial/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/canvas-dial/webpack.config.js b/examples/canvas-dial/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/canvas-dial/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/cellular-automata/.gitignore b/examples/cellular-automata/.gitignore index 360cd8a267..e228563433 100644 --- a/examples/cellular-automata/.gitignore +++ b/examples/cellular-automata/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js \ No newline at end of file +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/cellular-automata/package.json b/examples/cellular-automata/package.json index 9046fe1d9e..75a1d684db 100644 --- a/examples/cellular-automata/package.json +++ b/examples/cellular-automata/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest", @@ -33,5 +28,8 @@ "transducers" ], "screenshot": "examples/cellular-automata.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/cellular-automata/index.html b/examples/cellular-automata/public/index.html similarity index 94% rename from examples/cellular-automata/index.html rename to examples/cellular-automata/public/index.html index 5f1d0e6389..f995405363 100644 --- a/examples/cellular-automata/index.html +++ b/examples/cellular-automata/public/index.html @@ -38,6 +38,6 @@ >@thi.ng/hdom. - + diff --git a/examples/cellular-automata/snowpack.config.js b/examples/cellular-automata/snowpack.config.js new file mode 100644 index 0000000000..01547e6d6a --- /dev/null +++ b/examples/cellular-automata/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/cellular-automata", + }, +}; diff --git a/examples/cellular-automata/src/static.d.ts b/examples/cellular-automata/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/cellular-automata/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/cellular-automata/tsconfig.json b/examples/cellular-automata/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/cellular-automata/tsconfig.json +++ b/examples/cellular-automata/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/commit-heatmap/README.md b/examples/commit-heatmap/README.md index b2315afd3c..0ef7e1677b 100644 --- a/examples/commit-heatmap/README.md +++ b/examples/commit-heatmap/README.md @@ -9,6 +9,9 @@ spec. See source code for config options. ## Generating the visualization +The instructions below assume the [entire umbrella repo has already been +built](https://github.com/thi-ng/umbrella/blob/develop/README.md#building): + ```bash cd umbrella/examples/commit-heatmap yarn build diff --git a/examples/commit-heatmap/package.json b/examples/commit-heatmap/package.json index 2223839652..54913fe2f7 100644 --- a/examples/commit-heatmap/package.json +++ b/examples/commit-heatmap/package.json @@ -6,12 +6,8 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "ts-node src/index.ts" - }, - "devDependencies": { - "ts-node": "^8.5.2", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf .cache build out", + "build": "../../node_modules/.bin/ts-node src/index.ts" }, "dependencies": { "@thi.ng/associative": "latest", diff --git a/examples/commit-heatmap/src/index.ts b/examples/commit-heatmap/src/index.ts index 5fe236f6da..eebd9041a0 100644 --- a/examples/commit-heatmap/src/index.ts +++ b/examples/commit-heatmap/src/index.ts @@ -281,5 +281,5 @@ threadLast( timeLineLabels(), ], serialize, - [fs.writeFileSync, "heatmap2.svg"] + [fs.writeFileSync, "heatmap.svg"] ); diff --git a/examples/commit-table-ssr/package.json b/examples/commit-table-ssr/package.json index e82737cc9e..419583bba8 100644 --- a/examples/commit-table-ssr/package.json +++ b/examples/commit-table-ssr/package.json @@ -6,20 +6,16 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "prep": "yarn clean && mkdir -p out && cp commits.json out", - "build-static": "tsc && node build/server/static.js", - "build": "yarn prep && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", + "clean": "../../node_modules/.bin/rimraf node_modules/.cache build out", + "build-static": "../../node_modules/.bin/ts-node src/server/static.ts", "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "tsc && node build/server/index.js" + "start": "../../node_modules/.bin/ts-node src/server/index.ts" }, "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", + "ts-node": "^9.1.0", "typescript": "^4.1.2" }, "dependencies": { - "express": "^4.17.1", "@thi.ng/api": "latest", "@thi.ng/associative": "latest", "@thi.ng/cache": "latest", @@ -28,7 +24,8 @@ "@thi.ng/rstream": "latest", "@thi.ng/transducers": "latest", "@thi.ng/transducers-hdom": "latest", - "@types/express": "^4.17.7" + "@types/express": "^4.17.7", + "express": "^4.17.1" }, "browserslist": [ "last 3 Chrome versions" diff --git a/examples/crypto-chart/.gitignore b/examples/crypto-chart/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/crypto-chart/.gitignore +++ b/examples/crypto-chart/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/crypto-chart/ohlc.json b/examples/crypto-chart/ohlc.json new file mode 100644 index 0000000000..3347ad31b3 --- /dev/null +++ b/examples/crypto-chart/ohlc.json @@ -0,0 +1,1535 @@ +{ + "Response": "Success", + "Type": 100, + "Aggregated": false, + "Data": [ + { + "time": 1531054800, + "close": 6736.36, + "high": 6747.33, + "low": 6712.34, + "open": 6731.21, + "volumefrom": 1808.95, + "volumeto": 12241907.1 + }, + { + "time": 1531058400, + "close": 6751.25, + "high": 6762.05, + "low": 6724.56, + "open": 6736.36, + "volumefrom": 2054.76, + "volumeto": 13903333.45 + }, + { + "time": 1531062000, + "close": 6743.55, + "high": 6768.96, + "low": 6742.58, + "open": 6751.4, + "volumefrom": 2015.38, + "volumeto": 13683443.72 + }, + { + "time": 1531065600, + "close": 6751.56, + "high": 6758.84, + "low": 6742.12, + "open": 6744.22, + "volumefrom": 1085.39, + "volumeto": 7381082.14 + }, + { + "time": 1531069200, + "close": 6752.21, + "high": 6764.38, + "low": 6745.59, + "open": 6751.59, + "volumefrom": 1274.54, + "volumeto": 8656031.41 + }, + { + "time": 1531072800, + "close": 6752.81, + "high": 6763.28, + "low": 6745.05, + "open": 6752.21, + "volumefrom": 1080.71, + "volumeto": 7331549.32 + }, + { + "time": 1531076400, + "close": 6758, + "high": 6760.83, + "low": 6742.41, + "open": 6752.81, + "volumefrom": 1043.28, + "volumeto": 7073338.91 + }, + { + "time": 1531080000, + "close": 6748.79, + "high": 6765.02, + "low": 6748.46, + "open": 6758, + "volumefrom": 1370.51, + "volumeto": 9343071.48 + }, + { + "time": 1531083600, + "close": 6755, + "high": 6761.91, + "low": 6743.97, + "open": 6748.79, + "volumefrom": 1123.85, + "volumeto": 7634206.13 + }, + { + "time": 1531087200, + "close": 6751.18, + "high": 6758.82, + "low": 6742.34, + "open": 6755.03, + "volumefrom": 1205.95, + "volumeto": 8191445.01 + }, + { + "time": 1531090800, + "close": 6707.38, + "high": 6752.81, + "low": 6684.15, + "open": 6751.94, + "volumefrom": 3513.7, + "volumeto": 23623766.17 + }, + { + "time": 1531094400, + "close": 6716.19, + "high": 6727.06, + "low": 6692.62, + "open": 6707.46, + "volumefrom": 1595.85, + "volumeto": 10764835.22 + }, + { + "time": 1531098000, + "close": 6704.18, + "high": 6717.29, + "low": 6694.84, + "open": 6716.19, + "volumefrom": 1298.23, + "volumeto": 8729204.25 + }, + { + "time": 1531101600, + "close": 6701.34, + "high": 6706, + "low": 6690.61, + "open": 6704.18, + "volumefrom": 1135.75, + "volumeto": 7632998.18 + }, + { + "time": 1531105200, + "close": 6712.3, + "high": 6717.81, + "low": 6699.16, + "open": 6701.3, + "volumefrom": 1233.99, + "volumeto": 8303151.48 + }, + { + "time": 1531108800, + "close": 6702.38, + "high": 6715.55, + "low": 6696.35, + "open": 6712.3, + "volumefrom": 1377.04, + "volumeto": 9269485.43 + }, + { + "time": 1531112400, + "close": 6702.77, + "high": 6706.54, + "low": 6694.53, + "open": 6702.58, + "volumefrom": 1233.8, + "volumeto": 8294586.37 + }, + { + "time": 1531116000, + "close": 6714.61, + "high": 6720.46, + "low": 6699.55, + "open": 6702.81, + "volumefrom": 1775.97, + "volumeto": 11958344.77 + }, + { + "time": 1531119600, + "close": 6725.73, + "high": 6739.25, + "low": 6706.88, + "open": 6714.66, + "volumefrom": 1529.24, + "volumeto": 10316826.29 + }, + { + "time": 1531123200, + "close": 6721.48, + "high": 6729.42, + "low": 6715.41, + "open": 6725.74, + "volumefrom": 1359.6, + "volumeto": 9174151.01 + }, + { + "time": 1531126800, + "close": 6690.8, + "high": 6721.65, + "low": 6670.9, + "open": 6721.48, + "volumefrom": 3344.4, + "volumeto": 22431823.64 + }, + { + "time": 1531130400, + "close": 6696.14, + "high": 6702.51, + "low": 6680.06, + "open": 6690.94, + "volumefrom": 1682.41, + "volumeto": 11306630.17 + }, + { + "time": 1531134000, + "close": 6723, + "high": 6746.24, + "low": 6694.68, + "open": 6695.2, + "volumefrom": 2631.14, + "volumeto": 17723558.62 + }, + { + "time": 1531137600, + "close": 6711.4, + "high": 6725.63, + "low": 6705.89, + "open": 6723.14, + "volumefrom": 1459.97, + "volumeto": 9866328.98 + }, + { + "time": 1531141200, + "close": 6727.41, + "high": 6739.11, + "low": 6709.93, + "open": 6711.49, + "volumefrom": 1868.24, + "volumeto": 12614000.31 + }, + { + "time": 1531144800, + "close": 6728.75, + "high": 6729.07, + "low": 6717, + "open": 6727.41, + "volumefrom": 1481.69, + "volumeto": 10032564.2 + }, + { + "time": 1531148400, + "close": 6722.57, + "high": 6737.7, + "low": 6721.18, + "open": 6728.75, + "volumefrom": 1594.78, + "volumeto": 10776229.52 + }, + { + "time": 1531152000, + "close": 6710.13, + "high": 6725, + "low": 6678.93, + "open": 6722.57, + "volumefrom": 2713.74, + "volumeto": 18305957.1 + }, + { + "time": 1531155600, + "close": 6697.09, + "high": 6712.33, + "low": 6677.61, + "open": 6710.13, + "volumefrom": 3340.27, + "volumeto": 22447322.98 + }, + { + "time": 1531159200, + "close": 6703.53, + "high": 6711.76, + "low": 6687.13, + "open": 6697.11, + "volumefrom": 1600.65, + "volumeto": 10753710.89 + }, + { + "time": 1531162800, + "close": 6716.41, + "high": 6719.86, + "low": 6698.36, + "open": 6703.53, + "volumefrom": 1347.06, + "volumeto": 9095142.98 + }, + { + "time": 1531166400, + "close": 6702.32, + "high": 6718.25, + "low": 6696.07, + "open": 6716.46, + "volumefrom": 1168.77, + "volumeto": 7905232.9 + }, + { + "time": 1531170000, + "close": 6722.62, + "high": 6724.47, + "low": 6696.55, + "open": 6702.49, + "volumefrom": 1400.96, + "volumeto": 9462854.68 + }, + { + "time": 1531173600, + "close": 6702.5, + "high": 6803.1, + "low": 6678.35, + "open": 6722.62, + "volumefrom": 5907.23, + "volumeto": 39855256.37 + }, + { + "time": 1531177200, + "close": 6668.84, + "high": 6707.67, + "low": 6625.58, + "open": 6702.5, + "volumefrom": 4680.63, + "volumeto": 31295949.44 + }, + { + "time": 1531180800, + "close": 6672.88, + "high": 6683.61, + "low": 6643.58, + "open": 6668.84, + "volumefrom": 2285.78, + "volumeto": 15281083.7 + }, + { + "time": 1531184400, + "close": 6655.67, + "high": 6678.06, + "low": 6655.67, + "open": 6672.88, + "volumefrom": 1541.5, + "volumeto": 10329286.72 + }, + { + "time": 1531188000, + "close": 6638.49, + "high": 6661.26, + "low": 6628.32, + "open": 6655.29, + "volumefrom": 2451.5, + "volumeto": 16344607.49 + }, + { + "time": 1531191600, + "close": 6639.2, + "high": 6656.36, + "low": 6635.24, + "open": 6638.53, + "volumefrom": 1457.85, + "volumeto": 9726365.65 + }, + { + "time": 1531195200, + "close": 6647.33, + "high": 6656.37, + "low": 6630.67, + "open": 6639.2, + "volumefrom": 1374.69, + "volumeto": 9185559.77 + }, + { + "time": 1531198800, + "close": 6629.46, + "high": 6652.19, + "low": 6628.04, + "open": 6647.33, + "volumefrom": 1614.18, + "volumeto": 10779743.34 + }, + { + "time": 1531202400, + "close": 6605.14, + "high": 6630.69, + "low": 6577.59, + "open": 6629.46, + "volumefrom": 5507.95, + "volumeto": 36449029.53 + }, + { + "time": 1531206000, + "close": 6606.67, + "high": 6612.45, + "low": 6592.53, + "open": 6604.38, + "volumefrom": 1739.22, + "volumeto": 11570214.54 + }, + { + "time": 1531209600, + "close": 6599.58, + "high": 6619.62, + "low": 6589.65, + "open": 6606.67, + "volumefrom": 1706.34, + "volumeto": 11336289.39 + }, + { + "time": 1531213200, + "close": 6448.91, + "high": 6599.53, + "low": 6443, + "open": 6599.53, + "volumefrom": 8469.1, + "volumeto": 55216106.52 + }, + { + "time": 1531216800, + "close": 6477.34, + "high": 6482.96, + "low": 6436.38, + "open": 6448.91, + "volumefrom": 4240.7, + "volumeto": 27484743.41 + }, + { + "time": 1531220400, + "close": 6366.8, + "high": 6477.35, + "low": 6331.28, + "open": 6477.32, + "volumefrom": 7837.09, + "volumeto": 50283889.36 + }, + { + "time": 1531224000, + "close": 6375.2, + "high": 6380.64, + "low": 6340.4, + "open": 6366.71, + "volumefrom": 3752.26, + "volumeto": 24006341.09 + }, + { + "time": 1531227600, + "close": 6389.33, + "high": 6399.65, + "low": 6362.89, + "open": 6375.47, + "volumefrom": 4272.56, + "volumeto": 27394449.92 + }, + { + "time": 1531231200, + "close": 6385.13, + "high": 6392.75, + "low": 6350.99, + "open": 6388.8, + "volumefrom": 3016.77, + "volumeto": 19301321.15 + }, + { + "time": 1531234800, + "close": 6386.13, + "high": 6392.51, + "low": 6374.96, + "open": 6384.5, + "volumefrom": 1937.58, + "volumeto": 12453402.15 + }, + { + "time": 1531238400, + "close": 6362.18, + "high": 6411.34, + "low": 6348.68, + "open": 6386.17, + "volumefrom": 3047.89, + "volumeto": 19482722.44 + }, + { + "time": 1531242000, + "close": 6374.69, + "high": 6382.17, + "low": 6350.48, + "open": 6362.18, + "volumefrom": 1884.61, + "volumeto": 12053801.31 + }, + { + "time": 1531245600, + "close": 6384.1, + "high": 6389.53, + "low": 6370.05, + "open": 6374.54, + "volumefrom": 1408.74, + "volumeto": 9045142.44 + }, + { + "time": 1531249200, + "close": 6377.46, + "high": 6385.16, + "low": 6366.94, + "open": 6384.1, + "volumefrom": 1585.99, + "volumeto": 10175354.9 + }, + { + "time": 1531252800, + "close": 6393.3, + "high": 6404.51, + "low": 6376.35, + "open": 6377.46, + "volumefrom": 2121.66, + "volumeto": 13609905.66 + }, + { + "time": 1531256400, + "close": 6376.49, + "high": 6409.04, + "low": 6375.92, + "open": 6393.3, + "volumefrom": 1721.38, + "volumeto": 11082330.97 + }, + { + "time": 1531260000, + "close": 6374.55, + "high": 6389.03, + "low": 6360.85, + "open": 6376.49, + "volumefrom": 1622.16, + "volumeto": 10390880.53 + }, + { + "time": 1531263600, + "close": 6306.85, + "high": 6374.98, + "low": 6277.23, + "open": 6374.57, + "volumefrom": 5915.82, + "volumeto": 37449570.74 + }, + { + "time": 1531267200, + "close": 6390.82, + "high": 6400.78, + "low": 6293.68, + "open": 6306.87, + "volumefrom": 4756.67, + "volumeto": 30336519.52 + }, + { + "time": 1531270800, + "close": 6371.22, + "high": 6395.35, + "low": 6363.64, + "open": 6391.5, + "volumefrom": 1582.43, + "volumeto": 10216055.54 + }, + { + "time": 1531274400, + "close": 6371.71, + "high": 6377.77, + "low": 6359.73, + "open": 6371.22, + "volumefrom": 996.81, + "volumeto": 6384469.16 + }, + { + "time": 1531278000, + "close": 6344.1, + "high": 6375.17, + "low": 6340.58, + "open": 6371.71, + "volumefrom": 1562.72, + "volumeto": 10012551.1 + }, + { + "time": 1531281600, + "close": 6354.55, + "high": 6365.17, + "low": 6328.48, + "open": 6344.1, + "volumefrom": 1924.77, + "volumeto": 12271764.03 + }, + { + "time": 1531285200, + "close": 6343.63, + "high": 6354.65, + "low": 6299.48, + "open": 6354.55, + "volumefrom": 2660.57, + "volumeto": 16960966.21 + }, + { + "time": 1531288800, + "close": 6322.76, + "high": 6346.18, + "low": 6293.82, + "open": 6343.7, + "volumefrom": 2773.56, + "volumeto": 17637160.77 + }, + { + "time": 1531292400, + "close": 6349.21, + "high": 6366.5, + "low": 6319.82, + "open": 6322.76, + "volumefrom": 2453.37, + "volumeto": 15690691.92 + }, + { + "time": 1531296000, + "close": 6378.34, + "high": 6379.27, + "low": 6348.49, + "open": 6349.19, + "volumefrom": 1655.21, + "volumeto": 10628920.08 + }, + { + "time": 1531299600, + "close": 6347, + "high": 6381.38, + "low": 6331.11, + "open": 6378.34, + "volumefrom": 2429.16, + "volumeto": 15529373.41 + }, + { + "time": 1531303200, + "close": 6352.68, + "high": 6357.32, + "low": 6334.49, + "open": 6347, + "volumefrom": 1985.1, + "volumeto": 12770865.32 + }, + { + "time": 1531306800, + "close": 6382.28, + "high": 6405.59, + "low": 6352.68, + "open": 6352.68, + "volumefrom": 2995.55, + "volumeto": 19354627.86 + }, + { + "time": 1531310400, + "close": 6382.92, + "high": 6394.94, + "low": 6367.72, + "open": 6382.28, + "volumefrom": 1714.28, + "volumeto": 11127145.13 + }, + { + "time": 1531314000, + "close": 6382.87, + "high": 6400.76, + "low": 6376.36, + "open": 6382.86, + "volumefrom": 3433.89, + "volumeto": 22184264.2 + }, + { + "time": 1531317600, + "close": 6379.44, + "high": 6386.68, + "low": 6353.64, + "open": 6382.87, + "volumefrom": 2410.65, + "volumeto": 15685628.46 + }, + { + "time": 1531321200, + "close": 6372.94, + "high": 6381.12, + "low": 6362.13, + "open": 6379.49, + "volumefrom": 1567.77, + "volumeto": 10133170.75 + }, + { + "time": 1531324800, + "close": 6358.27, + "high": 6377.44, + "low": 6343.04, + "open": 6373.01, + "volumefrom": 2425.19, + "volumeto": 15567078.81 + }, + { + "time": 1531328400, + "close": 6362.57, + "high": 6381.78, + "low": 6357.6, + "open": 6358.27, + "volumefrom": 1693.04, + "volumeto": 10895956.52 + }, + { + "time": 1531332000, + "close": 6362.43, + "high": 6364.89, + "low": 6349.89, + "open": 6362.72, + "volumefrom": 1000.74, + "volumeto": 6493713.28 + }, + { + "time": 1531335600, + "close": 6362.08, + "high": 6362.79, + "low": 6309.63, + "open": 6361.53, + "volumefrom": 3141.68, + "volumeto": 19980278.9 + }, + { + "time": 1531339200, + "close": 6370.26, + "high": 6387.51, + "low": 6358.77, + "open": 6362.08, + "volumefrom": 1514.63, + "volumeto": 9699597.33 + }, + { + "time": 1531342800, + "close": 6375.24, + "high": 6388.94, + "low": 6359.13, + "open": 6370.26, + "volumefrom": 1777.67, + "volumeto": 11389235.23 + }, + { + "time": 1531346400, + "close": 6380.98, + "high": 6390.48, + "low": 6363.56, + "open": 6375.24, + "volumefrom": 1208.06, + "volumeto": 7777066.7 + }, + { + "time": 1531350000, + "close": 6394.36, + "high": 6396.41, + "low": 6378.7, + "open": 6380.98, + "volumefrom": 1391.16, + "volumeto": 8940654.12 + }, + { + "time": 1531353600, + "close": 6380.65, + "high": 6394.93, + "low": 6368.83, + "open": 6394.36, + "volumefrom": 2531.03, + "volumeto": 16230024.11 + }, + { + "time": 1531357200, + "close": 6346.36, + "high": 6382.71, + "low": 6346.07, + "open": 6380.65, + "volumefrom": 1982.19, + "volumeto": 12695222.72 + }, + { + "time": 1531360800, + "close": 6343.99, + "high": 6356.45, + "low": 6319.1, + "open": 6346.36, + "volumefrom": 2057.78, + "volumeto": 13077618.21 + }, + { + "time": 1531364400, + "close": 6359.09, + "high": 6360.86, + "low": 6342.23, + "open": 6343.99, + "volumefrom": 897.82, + "volumeto": 5749807.24 + }, + { + "time": 1531368000, + "close": 6347.94, + "high": 6362.39, + "low": 6338.79, + "open": 6359.67, + "volumefrom": 1021.31, + "volumeto": 6544094.25 + }, + { + "time": 1531371600, + "close": 6340.93, + "high": 6348.42, + "low": 6315.71, + "open": 6348.04, + "volumefrom": 1119.58, + "volumeto": 7150597.29 + }, + { + "time": 1531375200, + "close": 6227.43, + "high": 6345.24, + "low": 6205.65, + "open": 6340.87, + "volumefrom": 8625.26, + "volumeto": 53848908.56 + }, + { + "time": 1531378800, + "close": 6190.11, + "high": 6233.46, + "low": 6167.51, + "open": 6227.43, + "volumefrom": 4634.39, + "volumeto": 28782141.54 + }, + { + "time": 1531382400, + "close": 6208.6, + "high": 6208.65, + "low": 6148.56, + "open": 6190.11, + "volumefrom": 5437.93, + "volumeto": 33669660.83 + }, + { + "time": 1531386000, + "close": 6196.07, + "high": 6214.48, + "low": 6188.93, + "open": 6208.6, + "volumefrom": 2931.86, + "volumeto": 18251378.85 + }, + { + "time": 1531389600, + "close": 6181.98, + "high": 6196.11, + "low": 6166.89, + "open": 6196.07, + "volumefrom": 2777.28, + "volumeto": 17214048.32 + }, + { + "time": 1531393200, + "close": 6174.11, + "high": 6191.39, + "low": 6149.38, + "open": 6181.47, + "volumefrom": 2418.54, + "volumeto": 14950407.61 + }, + { + "time": 1531396800, + "close": 6189.47, + "high": 6199.55, + "low": 6166.78, + "open": 6174.06, + "volumefrom": 2325.16, + "volumeto": 14428307.44 + }, + { + "time": 1531400400, + "close": 6191.18, + "high": 6196.09, + "low": 6171.38, + "open": 6189.47, + "volumefrom": 2226.22, + "volumeto": 13834016.16 + }, + { + "time": 1531404000, + "close": 6187.27, + "high": 6200.23, + "low": 6178.99, + "open": 6191.56, + "volumefrom": 2298.68, + "volumeto": 14317623.73 + }, + { + "time": 1531407600, + "close": 6168.96, + "high": 6191.39, + "low": 6166.56, + "open": 6187.43, + "volumefrom": 1457.68, + "volumeto": 9068058.02 + }, + { + "time": 1531411200, + "close": 6190.81, + "high": 6205.73, + "low": 6168.62, + "open": 6169, + "volumefrom": 2844.64, + "volumeto": 17702858.89 + }, + { + "time": 1531414800, + "close": 6190.09, + "high": 6201.86, + "low": 6174.34, + "open": 6190.81, + "volumefrom": 1676.25, + "volumeto": 10445786.42 + }, + { + "time": 1531418400, + "close": 6177.49, + "high": 6198.26, + "low": 6173, + "open": 6190.09, + "volumefrom": 1166.57, + "volumeto": 7312438.43 + }, + { + "time": 1531422000, + "close": 6183.09, + "high": 6188.18, + "low": 6160.27, + "open": 6177.53, + "volumefrom": 1704.06, + "volumeto": 10630764.8 + }, + { + "time": 1531425600, + "close": 6184.27, + "high": 6192.99, + "low": 6177.94, + "open": 6183.09, + "volumefrom": 1370.22, + "volumeto": 8563525.07 + }, + { + "time": 1531429200, + "close": 6175.03, + "high": 6185.31, + "low": 6163.74, + "open": 6184.27, + "volumefrom": 1293.66, + "volumeto": 8029608.45 + }, + { + "time": 1531432800, + "close": 6157.64, + "high": 6182.18, + "low": 6133.93, + "open": 6175.11, + "volumefrom": 2096.36, + "volumeto": 12961149.43 + }, + { + "time": 1531436400, + "close": 6253.6, + "high": 6270.29, + "low": 6084, + "open": 6157.64, + "volumefrom": 8660.9, + "volumeto": 53620136.26 + }, + { + "time": 1531440000, + "close": 6250.92, + "high": 6285.48, + "low": 6226.02, + "open": 6253.66, + "volumefrom": 3581.27, + "volumeto": 22511975.13 + }, + { + "time": 1531443600, + "close": 6234.36, + "high": 6257.81, + "low": 6233.23, + "open": 6250.92, + "volumefrom": 1133.42, + "volumeto": 7134076.13 + }, + { + "time": 1531447200, + "close": 6244.85, + "high": 6263.2, + "low": 6231.57, + "open": 6234.36, + "volumefrom": 1323.34, + "volumeto": 8326560.53 + }, + { + "time": 1531450800, + "close": 6252.59, + "high": 6257.13, + "low": 6244.34, + "open": 6244.85, + "volumefrom": 1213.84, + "volumeto": 7642556.22 + }, + { + "time": 1531454400, + "close": 6257.74, + "high": 6267.53, + "low": 6245.41, + "open": 6252.59, + "volumefrom": 2125.95, + "volumeto": 13403443.97 + }, + { + "time": 1531458000, + "close": 6256.03, + "high": 6263.1, + "low": 6247.57, + "open": 6257.74, + "volumefrom": 1300.98, + "volumeto": 8224538.73 + }, + { + "time": 1531461600, + "close": 6247.29, + "high": 6262, + "low": 6226.3, + "open": 6256.03, + "volumefrom": 1921.77, + "volumeto": 12119063.12 + }, + { + "time": 1531465200, + "close": 6251.84, + "high": 6259.07, + "low": 6243.49, + "open": 6247.29, + "volumefrom": 1528.39, + "volumeto": 9613110.57 + }, + { + "time": 1531468800, + "close": 6251.88, + "high": 6262.37, + "low": 6241.74, + "open": 6252.19, + "volumefrom": 1208.78, + "volumeto": 7617196.44 + }, + { + "time": 1531472400, + "close": 6247.12, + "high": 6259.72, + "low": 6245.05, + "open": 6251.88, + "volumefrom": 1194.4, + "volumeto": 7523559.74 + }, + { + "time": 1531476000, + "close": 6244.47, + "high": 6259.23, + "low": 6241.27, + "open": 6247.51, + "volumefrom": 1142.29, + "volumeto": 7201680.55 + }, + { + "time": 1531479600, + "close": 6253.97, + "high": 6264.53, + "low": 6241.99, + "open": 6244.47, + "volumefrom": 1027.83, + "volumeto": 6480971.52 + }, + { + "time": 1531483200, + "close": 6285.5, + "high": 6297.63, + "low": 6250.63, + "open": 6253.97, + "volumefrom": 2246.02, + "volumeto": 14149718.59 + }, + { + "time": 1531486800, + "close": 6249.46, + "high": 6286.98, + "low": 6246.99, + "open": 6285.5, + "volumefrom": 2180.22, + "volumeto": 13725967.18 + }, + { + "time": 1531490400, + "close": 6262.33, + "high": 6275.05, + "low": 6244.57, + "open": 6249.53, + "volumefrom": 1881.19, + "volumeto": 11834310.25 + }, + { + "time": 1531494000, + "close": 6271.75, + "high": 6277.86, + "low": 6253.82, + "open": 6262.43, + "volumefrom": 1777.67, + "volumeto": 11186281.6 + }, + { + "time": 1531497600, + "close": 6274.02, + "high": 6287.75, + "low": 6255.21, + "open": 6271.81, + "volumefrom": 1816.52, + "volumeto": 11447557.29 + }, + { + "time": 1531501200, + "close": 6279.63, + "high": 6284.74, + "low": 6264.41, + "open": 6274.02, + "volumefrom": 1391.67, + "volumeto": 8793588.78 + }, + { + "time": 1531504800, + "close": 6252.29, + "high": 6349.21, + "low": 6233.57, + "open": 6279.69, + "volumefrom": 5448.74, + "volumeto": 34330129.18 + }, + { + "time": 1531508400, + "close": 6184.59, + "high": 6255.66, + "low": 6180.03, + "open": 6252.27, + "volumefrom": 4946.27, + "volumeto": 30731212.69 + }, + { + "time": 1531512000, + "close": 6199.62, + "high": 6224.61, + "low": 6131.54, + "open": 6184.68, + "volumefrom": 5467.67, + "volumeto": 33890975.97 + }, + { + "time": 1531515600, + "close": 6228.26, + "high": 6240.15, + "low": 6196.46, + "open": 6199.62, + "volumefrom": 2459.39, + "volumeto": 15348000.07 + }, + { + "time": 1531519200, + "close": 6233.29, + "high": 6233.95, + "low": 6196.09, + "open": 6228.29, + "volumefrom": 1499.92, + "volumeto": 9371373.05 + }, + { + "time": 1531522800, + "close": 6229.83, + "high": 6255.45, + "low": 6212.3, + "open": 6233.29, + "volumefrom": 1146.89, + "volumeto": 7194424.68 + }, + { + "time": 1531526400, + "close": 6253.41, + "high": 6282.41, + "low": 6227.32, + "open": 6229.61, + "volumefrom": 1432.5, + "volumeto": 9020030.19 + }, + { + "time": 1531530000, + "close": 6246.63, + "high": 6288.44, + "low": 6230.07, + "open": 6253.41, + "volumefrom": 1279.28, + "volumeto": 8083202.45 + }, + { + "time": 1531533600, + "close": 6245.91, + "high": 6254.14, + "low": 6232.99, + "open": 6246.63, + "volumefrom": 581.84, + "volumeto": 3674209.8 + }, + { + "time": 1531537200, + "close": 6219.48, + "high": 6246.19, + "low": 6212.58, + "open": 6245.98, + "volumefrom": 859.69, + "volumeto": 5398704.65 + }, + { + "time": 1531540800, + "close": 6232.08, + "high": 6236.64, + "low": 6218.27, + "open": 6219.52, + "volumefrom": 573.05, + "volumeto": 3616448.09 + }, + { + "time": 1531544400, + "close": 6228.16, + "high": 6241.88, + "low": 6227.64, + "open": 6232.11, + "volumefrom": 670.38, + "volumeto": 4224030.4 + }, + { + "time": 1531548000, + "close": 6222.79, + "high": 6238.98, + "low": 6217.55, + "open": 6228.21, + "volumefrom": 579.04, + "volumeto": 3641279.22 + }, + { + "time": 1531551600, + "close": 6227.17, + "high": 6238.36, + "low": 6214.88, + "open": 6222.85, + "volumefrom": 882.9, + "volumeto": 5547597.69 + }, + { + "time": 1531555200, + "close": 6228.26, + "high": 6232.91, + "low": 6214.66, + "open": 6227.17, + "volumefrom": 988.93, + "volumeto": 6196216.22 + }, + { + "time": 1531558800, + "close": 6209.03, + "high": 6232.2, + "low": 6190.18, + "open": 6228.21, + "volumefrom": 1519.58, + "volumeto": 9477712.13 + }, + { + "time": 1531562400, + "close": 6226.68, + "high": 6228.3, + "low": 6208.77, + "open": 6209.03, + "volumefrom": 949.22, + "volumeto": 5943855.26 + }, + { + "time": 1531566000, + "close": 6243.66, + "high": 6253.98, + "low": 6226.6, + "open": 6226.69, + "volumefrom": 1139.81, + "volumeto": 7155449.92 + }, + { + "time": 1531569600, + "close": 6241.15, + "high": 6259.7, + "low": 6240.4, + "open": 6243.66, + "volumefrom": 1060.82, + "volumeto": 6674241.01 + }, + { + "time": 1531573200, + "close": 6246.82, + "high": 6246.93, + "low": 6234.35, + "open": 6241.15, + "volumefrom": 852.81, + "volumeto": 5362837.9 + }, + { + "time": 1531576800, + "close": 6248.17, + "high": 6256.15, + "low": 6240.57, + "open": 6246.82, + "volumefrom": 1054.42, + "volumeto": 6632178.53 + }, + { + "time": 1531580400, + "close": 6252.82, + "high": 6253.26, + "low": 6231.3, + "open": 6248.17, + "volumefrom": 1021.31, + "volumeto": 6443906.59 + }, + { + "time": 1531584000, + "close": 6275.9, + "high": 6277.6, + "low": 6250.64, + "open": 6252.94, + "volumefrom": 1887.92, + "volumeto": 11907239.67 + }, + { + "time": 1531587600, + "close": 6274.19, + "high": 6278.79, + "low": 6263.6, + "open": 6275.9, + "volumefrom": 1506.54, + "volumeto": 9519611.21 + }, + { + "time": 1531591200, + "close": 6250.67, + "high": 6300.03, + "low": 6234.92, + "open": 6274.19, + "volumefrom": 1357.48, + "volumeto": 8555230.38 + }, + { + "time": 1531594800, + "close": 6281.33, + "high": 6284.31, + "low": 6222.2, + "open": 6249.52, + "volumefrom": 1739.34, + "volumeto": 10926973.25 + }, + { + "time": 1531598400, + "close": 6286.29, + "high": 6332.46, + "low": 6236.22, + "open": 6281.79, + "volumefrom": 2968.3, + "volumeto": 18687874.52 + }, + { + "time": 1531602000, + "close": 6274.44, + "high": 6297.88, + "low": 6272.27, + "open": 6286.29, + "volumefrom": 887.98, + "volumeto": 5622374.02 + }, + { + "time": 1531605600, + "close": 6269.34, + "high": 6291.68, + "low": 6265.69, + "open": 6274.44, + "volumefrom": 1147.69, + "volumeto": 7235699.7 + }, + { + "time": 1531609200, + "close": 6268.75, + "high": 6280.66, + "low": 6268.3, + "open": 6269.52, + "volumefrom": 772.35, + "volumeto": 4869883.56 + }, + { + "time": 1531612800, + "close": 6264.31, + "high": 6275.51, + "low": 6245.75, + "open": 6268.32, + "volumefrom": 1234.34, + "volumeto": 7767086.98 + }, + { + "time": 1531616400, + "close": 6257.61, + "high": 6264.48, + "low": 6250.13, + "open": 6263.27, + "volumefrom": 840.15, + "volumeto": 5296830.09 + }, + { + "time": 1531620000, + "close": 6260.11, + "high": 6266.9, + "low": 6252.77, + "open": 6257.61, + "volumefrom": 811.65, + "volumeto": 5115797.52 + }, + { + "time": 1531623600, + "close": 6271.27, + "high": 6271.58, + "low": 6252.1, + "open": 6260.11, + "volumefrom": 877.38, + "volumeto": 5525653.33 + }, + { + "time": 1531627200, + "close": 6283.29, + "high": 6294.66, + "low": 6263.26, + "open": 6271.27, + "volumefrom": 922.72, + "volumeto": 5831628.28 + }, + { + "time": 1531630800, + "close": 6294.22, + "high": 6298.76, + "low": 6281, + "open": 6283.35, + "volumefrom": 857.09, + "volumeto": 5409531.91 + }, + { + "time": 1531634400, + "close": 6297.09, + "high": 6305.07, + "low": 6288.47, + "open": 6294.1, + "volumefrom": 857.95, + "volumeto": 5435064.44 + }, + { + "time": 1531638000, + "close": 6293.2, + "high": 6300.17, + "low": 6284.61, + "open": 6297.09, + "volumefrom": 944.41, + "volumeto": 5987349.78 + }, + { + "time": 1531641600, + "close": 6330.76, + "high": 6358.54, + "low": 6293.03, + "open": 6293.2, + "volumefrom": 2931.66, + "volumeto": 18574867.99 + }, + { + "time": 1531645200, + "close": 6318.81, + "high": 6344.93, + "low": 6311.71, + "open": 6329.99, + "volumefrom": 1429.16, + "volumeto": 9093020.53 + }, + { + "time": 1531648800, + "close": 6351.18, + "high": 6394.67, + "low": 6318.79, + "open": 6318.79, + "volumefrom": 3128.86, + "volumeto": 19933132.96 + }, + { + "time": 1531652400, + "close": 6365.58, + "high": 6374.77, + "low": 6348.07, + "open": 6351.18, + "volumefrom": 1806.75, + "volumeto": 11669063.36 + }, + { + "time": 1531656000, + "close": 6355.99, + "high": 6366.62, + "low": 6347.32, + "open": 6365.58, + "volumefrom": 1176.05, + "volumeto": 7516629.3 + }, + { + "time": 1531659600, + "close": 6348.13, + "high": 6355.99, + "low": 6348.13, + "open": 6355.99, + "volumefrom": 0, + "volumeto": 0 + } + ], + "TimeTo": 1531659600, + "TimeFrom": 1531054800, + "FirstValueInArray": true, + "ConversionType": { + "type": "direct", + "conversionSymbol": "" + } +} \ No newline at end of file diff --git a/examples/crypto-chart/package.json b/examples/crypto-chart/package.json index 7173b3494d..fd9b3c280f 100644 --- a/examples/crypto-chart/package.json +++ b/examples/crypto-chart/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -46,5 +41,8 @@ "transducers-stats" ], "screenshot": "examples/crypto-chart.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/crypto-chart/index.html b/examples/crypto-chart/public/index.html similarity index 90% rename from examples/crypto-chart/index.html rename to examples/crypto-chart/public/index.html index 2a9d97cbce..0f1d4be5ac 100644 --- a/examples/crypto-chart/index.html +++ b/examples/crypto-chart/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/crypto-chart/snowpack.config.js b/examples/crypto-chart/snowpack.config.js new file mode 100644 index 0000000000..e19f406e35 --- /dev/null +++ b/examples/crypto-chart/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/crypto-chart", + }, +}; diff --git a/examples/crypto-chart/src/static.d.ts b/examples/crypto-chart/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/crypto-chart/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/crypto-chart/tsconfig.json b/examples/crypto-chart/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/crypto-chart/tsconfig.json +++ b/examples/crypto-chart/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/devcards/.gitignore b/examples/devcards/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/devcards/.gitignore +++ b/examples/devcards/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/devcards/package.json b/examples/devcards/package.json index 17b2756717..1e8716ede5 100644 --- a/examples/devcards/package.json +++ b/examples/devcards/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -31,5 +26,8 @@ "atom", "hdom" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/devcards/index.html b/examples/devcards/public/index.html similarity index 94% rename from examples/devcards/index.html rename to examples/devcards/public/index.html index d44367df37..f3e635bf06 100644 --- a/examples/devcards/index.html +++ b/examples/devcards/public/index.html @@ -75,13 +75,13 @@ extension from Reagent Project examples).

- Total filesize: 19.3KB (7.4KB gzip'd) - see + Total filesize: 19.7KB (7.7KB gzip'd) - see source for more information.

- + diff --git a/examples/devcards/snowpack.config.js b/examples/devcards/snowpack.config.js new file mode 100644 index 0000000000..7b31b1e56a --- /dev/null +++ b/examples/devcards/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/devcards", + }, +}; diff --git a/examples/devcards/src/static.d.ts b/examples/devcards/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/devcards/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/devcards/tsconfig.json b/examples/devcards/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/devcards/tsconfig.json +++ b/examples/devcards/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/ellipse-proximity/.gitignore b/examples/ellipse-proximity/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/ellipse-proximity/.gitignore +++ b/examples/ellipse-proximity/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/ellipse-proximity/package.json b/examples/ellipse-proximity/package.json index 47a23ed099..ae376da13c 100644 --- a/examples/ellipse-proximity/package.json +++ b/examples/ellipse-proximity/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.1.0", - "typescript": "^3.9.7" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/geom-closest-point": "latest", @@ -39,5 +33,8 @@ "vectors" ], "screenshot": "examples/ellipse-proximity.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/ellipse-proximity/index.html b/examples/ellipse-proximity/public/index.html similarity index 93% rename from examples/ellipse-proximity/index.html rename to examples/ellipse-proximity/public/index.html index 118bb95535..e9e973128b 100644 --- a/examples/ellipse-proximity/index.html +++ b/examples/ellipse-proximity/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/ellipse-proximity/snowpack.config.js b/examples/ellipse-proximity/snowpack.config.js new file mode 100644 index 0000000000..6114e0d69b --- /dev/null +++ b/examples/ellipse-proximity/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/ellipse-proximity", + }, +}; diff --git a/examples/ellipse-proximity/src/static.d.ts b/examples/ellipse-proximity/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/ellipse-proximity/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/ellipse-proximity/src/webpack.d.ts b/examples/ellipse-proximity/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/ellipse-proximity/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/ellipse-proximity/tsconfig.json b/examples/ellipse-proximity/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/ellipse-proximity/tsconfig.json +++ b/examples/ellipse-proximity/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/ellipse-proximity/webpack.config.js b/examples/ellipse-proximity/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/ellipse-proximity/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/fft-synth/.gitignore b/examples/fft-synth/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/fft-synth/.gitignore +++ b/examples/fft-synth/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/fft-synth/package.json b/examples/fft-synth/package.json index 1e2d48428d..7d3a2ae2b7 100644 --- a/examples/fft-synth/package.json +++ b/examples/fft-synth/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/atom": "latest", @@ -45,5 +39,8 @@ "random" ], "screenshot": "examples/fft-synth.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/fft-synth/index.html b/examples/fft-synth/public/index.html similarity index 94% rename from examples/fft-synth/index.html rename to examples/fft-synth/public/index.html index 84e3df28e5..cd5ef14198 100644 --- a/examples/fft-synth/index.html +++ b/examples/fft-synth/public/index.html @@ -30,6 +30,6 @@ >Source code and info - + diff --git a/examples/fft-synth/snowpack.config.js b/examples/fft-synth/snowpack.config.js new file mode 100644 index 0000000000..04e376bfc3 --- /dev/null +++ b/examples/fft-synth/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/fft-synth", + }, +}; diff --git a/examples/fft-synth/src/static.d.ts b/examples/fft-synth/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/fft-synth/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/fft-synth/src/webpack.d.ts b/examples/fft-synth/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/fft-synth/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/fft-synth/tsconfig.json b/examples/fft-synth/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/fft-synth/tsconfig.json +++ b/examples/fft-synth/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/fft-synth/webpack.config.js b/examples/fft-synth/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/fft-synth/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/geom-convex-hull/.gitignore b/examples/geom-convex-hull/.gitignore index 77ca864e83..e228563433 100644 --- a/examples/geom-convex-hull/.gitignore +++ b/examples/geom-convex-hull/.gitignore @@ -1,6 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -!webpack.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/geom-convex-hull/package.json b/examples/geom-convex-hull/package.json index ac972b9331..9ee9d5ea24 100644 --- a/examples/geom-convex-hull/package.json +++ b/examples/geom-convex-hull/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/geom": "latest", @@ -34,5 +28,8 @@ "geom-hull" ], "screenshot": "examples/geom-convex-hull.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/geom-convex-hull/index.html b/examples/geom-convex-hull/public/index.html similarity index 92% rename from examples/geom-convex-hull/index.html rename to examples/geom-convex-hull/public/index.html index 49e150bfd2..89d806a4a8 100644 --- a/examples/geom-convex-hull/index.html +++ b/examples/geom-convex-hull/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/geom-convex-hull/snowpack.config.js b/examples/geom-convex-hull/snowpack.config.js new file mode 100644 index 0000000000..8d4fd4cb47 --- /dev/null +++ b/examples/geom-convex-hull/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/geom-convex-hull", + }, +}; diff --git a/examples/geom-convex-hull/src/static.d.ts b/examples/geom-convex-hull/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/geom-convex-hull/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/geom-convex-hull/src/webpack.d.ts b/examples/geom-convex-hull/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/geom-convex-hull/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/geom-convex-hull/tsconfig.json b/examples/geom-convex-hull/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/geom-convex-hull/tsconfig.json +++ b/examples/geom-convex-hull/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/geom-convex-hull/webpack.config.js b/examples/geom-convex-hull/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/geom-convex-hull/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/geom-fuzz-basics/.gitignore b/examples/geom-fuzz-basics/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/geom-fuzz-basics/.gitignore +++ b/examples/geom-fuzz-basics/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/geom-fuzz-basics/package.json b/examples/geom-fuzz-basics/package.json index bdca4e3d36..27617696c9 100644 --- a/examples/geom-fuzz-basics/package.json +++ b/examples/geom-fuzz-basics/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/adapt-dpi": "latest", @@ -36,5 +30,8 @@ "hiccup-canvas" ], "screenshot": "geom/geom-fuzz.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/geom-fuzz-basics/index.html b/examples/geom-fuzz-basics/public/index.html similarity index 92% rename from examples/geom-fuzz-basics/index.html rename to examples/geom-fuzz-basics/public/index.html index b5b121f0a2..6ded14b160 100644 --- a/examples/geom-fuzz-basics/index.html +++ b/examples/geom-fuzz-basics/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/geom-fuzz-basics/snowpack.config.js b/examples/geom-fuzz-basics/snowpack.config.js new file mode 100644 index 0000000000..6822cb8b32 --- /dev/null +++ b/examples/geom-fuzz-basics/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/geom-fuzz-basics", + }, +}; diff --git a/examples/geom-fuzz-basics/src/static.d.ts b/examples/geom-fuzz-basics/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/geom-fuzz-basics/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/geom-fuzz-basics/src/webpack.d.ts b/examples/geom-fuzz-basics/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/geom-fuzz-basics/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/geom-fuzz-basics/tsconfig.json b/examples/geom-fuzz-basics/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/geom-fuzz-basics/tsconfig.json +++ b/examples/geom-fuzz-basics/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/geom-fuzz-basics/webpack.config.js b/examples/geom-fuzz-basics/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/geom-fuzz-basics/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/geom-knn/.gitignore b/examples/geom-knn/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/geom-knn/.gitignore +++ b/examples/geom-knn/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/geom-knn/package.json b/examples/geom-knn/package.json index 830e6d4131..3880705856 100644 --- a/examples/geom-knn/package.json +++ b/examples/geom-knn/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/bench": "latest", @@ -39,5 +34,8 @@ "vectors" ], "screenshot": "examples/geom-knn.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/geom-knn/index.html b/examples/geom-knn/public/index.html similarity index 90% rename from examples/geom-knn/index.html rename to examples/geom-knn/public/index.html index 13b4ef8deb..311b0520c5 100644 --- a/examples/geom-knn/index.html +++ b/examples/geom-knn/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/geom-knn/snowpack.config.js b/examples/geom-knn/snowpack.config.js new file mode 100644 index 0000000000..38ba861bf9 --- /dev/null +++ b/examples/geom-knn/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/geom-knn", + }, +}; diff --git a/examples/geom-knn/src/index.ts b/examples/geom-knn/src/index.ts index ea92bb3963..cf1eeac7af 100644 --- a/examples/geom-knn/src/index.ts +++ b/examples/geom-knn/src/index.ts @@ -1,7 +1,7 @@ import { timedResult } from "@thi.ng/bench"; import { KdTreeMap } from "@thi.ng/geom-accel"; import { canvas } from "@thi.ng/hdom-canvas"; -import { StreamSync, sync, trigger } from "@thi.ng/rstream"; +import { CloseMode, StreamSync, sync, trigger } from "@thi.ng/rstream"; import { gestureStream } from "@thi.ng/rstream-gestures"; import { map, mapcat } from "@thi.ng/transducers"; import { updateDOM } from "@thi.ng/transducers-hdom"; @@ -95,13 +95,11 @@ const app = (main: StreamSync) => { // component's `init` method is called which attaches the above gesture // stream dynamically. the entire UI then only updates when there are new // user interactions... -const main = sync({ src: { trigger: trigger() } }); +const main = sync({ + src: { trigger: trigger() }, + closeIn: CloseMode.NEVER, +}); // transform result stream using the // root component fn and the hdom differential // update transducer main.transform(map(app(main)), updateDOM()); - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(() => main.done()); -} diff --git a/examples/geom-knn/src/static.d.ts b/examples/geom-knn/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/geom-knn/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/geom-knn/tsconfig.json b/examples/geom-knn/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/geom-knn/tsconfig.json +++ b/examples/geom-knn/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/geom-tessel/.gitignore b/examples/geom-tessel/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/geom-tessel/.gitignore +++ b/examples/geom-tessel/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/geom-tessel/package.json b/examples/geom-tessel/package.json index 15d894c8f7..567995f000 100644 --- a/examples/geom-tessel/package.json +++ b/examples/geom-tessel/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/compose": "latest", @@ -39,5 +34,8 @@ "geom-tessellate" ], "screenshot": "geom/tessel.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/geom-tessel/index.html b/examples/geom-tessel/public/index.html similarity index 90% rename from examples/geom-tessel/index.html rename to examples/geom-tessel/public/index.html index f2cab2b4a3..1560d45bad 100644 --- a/examples/geom-tessel/index.html +++ b/examples/geom-tessel/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/geom-tessel/snowpack.config.js b/examples/geom-tessel/snowpack.config.js new file mode 100644 index 0000000000..4529dc0772 --- /dev/null +++ b/examples/geom-tessel/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/geom-tessel", + }, +}; diff --git a/examples/geom-tessel/src/index.ts b/examples/geom-tessel/src/index.ts index e466fc03be..a7a2d6b7d2 100644 --- a/examples/geom-tessel/src/index.ts +++ b/examples/geom-tessel/src/index.ts @@ -112,9 +112,3 @@ const main = sync({ }), updateDOM() ); - -// HMR handling -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(() => main.done()); -} diff --git a/examples/geom-tessel/src/static.d.ts b/examples/geom-tessel/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/geom-tessel/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/geom-tessel/tsconfig.json b/examples/geom-tessel/tsconfig.json index 4710ad552b..48d558b4f8 100644 --- a/examples/geom-tessel/tsconfig.json +++ b/examples/geom-tessel/tsconfig.json @@ -1,12 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true, - "noUnusedLocals": false, - "noUnusedParameters": false - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/geom-voronoi-mst/.gitignore b/examples/geom-voronoi-mst/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/geom-voronoi-mst/.gitignore +++ b/examples/geom-voronoi-mst/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/geom-voronoi-mst/package.json b/examples/geom-voronoi-mst/package.json index b1a07da454..9f4cb740db 100644 --- a/examples/geom-voronoi-mst/package.json +++ b/examples/geom-voronoi-mst/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/adjacency": "latest", @@ -45,5 +39,8 @@ "poisson" ], "screenshot": "examples/geom-voronoi-mst.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/geom-voronoi-mst/index.html b/examples/geom-voronoi-mst/public/index.html similarity index 89% rename from examples/geom-voronoi-mst/index.html rename to examples/geom-voronoi-mst/public/index.html index e35ca8f784..8cfb910bbe 100644 --- a/examples/geom-voronoi-mst/index.html +++ b/examples/geom-voronoi-mst/public/index.html @@ -18,7 +18,7 @@ > -
+
Generating...
- + diff --git a/examples/geom-voronoi-mst/snowpack.config.js b/examples/geom-voronoi-mst/snowpack.config.js new file mode 100644 index 0000000000..8050f0f583 --- /dev/null +++ b/examples/geom-voronoi-mst/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/geom-voronoi-mst", + }, +}; diff --git a/examples/geom-voronoi-mst/src/index.ts b/examples/geom-voronoi-mst/src/index.ts index 14da01520e..53c1f37546 100644 --- a/examples/geom-voronoi-mst/src/index.ts +++ b/examples/geom-voronoi-mst/src/index.ts @@ -14,7 +14,7 @@ import { } from "@thi.ng/geom"; import { KdTreeMap, KdTreeSet } from "@thi.ng/geom-accel"; import { DVMesh } from "@thi.ng/geom-voronoi"; -import { renderOnce } from "@thi.ng/hdom"; +import { clearDOM, renderOnce } from "@thi.ng/hdom"; import { canvas } from "@thi.ng/hdom-canvas"; import { fit } from "@thi.ng/math"; import { samplePoisson } from "@thi.ng/poisson"; @@ -84,6 +84,8 @@ const _mst = timed(() => { ).map((e) => line(e[2], e[3])); }); +clearDOM(document.getElementById("app")!); + renderOnce([ canvas, { width: W, height: W }, diff --git a/examples/geom-voronoi-mst/src/static.d.ts b/examples/geom-voronoi-mst/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/geom-voronoi-mst/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/geom-voronoi-mst/tsconfig.json b/examples/geom-voronoi-mst/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/geom-voronoi-mst/tsconfig.json +++ b/examples/geom-voronoi-mst/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/geom-voronoi-mst/webpack.config.js b/examples/geom-voronoi-mst/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/geom-voronoi-mst/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/gesture-analysis/.gitignore b/examples/gesture-analysis/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/gesture-analysis/.gitignore +++ b/examples/gesture-analysis/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/gesture-analysis/package.json b/examples/gesture-analysis/package.json index fab3eefd7e..67572d0a57 100644 --- a/examples/gesture-analysis/package.json +++ b/examples/gesture-analysis/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/arrays": "latest", @@ -41,5 +35,8 @@ "vectors" ], "screenshot": "examples/gesture-analysis.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/gesture-analysis/index.html b/examples/gesture-analysis/public/index.html similarity index 91% rename from examples/gesture-analysis/index.html rename to examples/gesture-analysis/public/index.html index b76376563a..9b3ac0f42e 100644 --- a/examples/gesture-analysis/index.html +++ b/examples/gesture-analysis/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/gesture-analysis/snowpack.config.js b/examples/gesture-analysis/snowpack.config.js new file mode 100644 index 0000000000..31b9ba8238 --- /dev/null +++ b/examples/gesture-analysis/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/gesture-analysis", + }, +}; diff --git a/examples/gesture-analysis/src/static.d.ts b/examples/gesture-analysis/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/gesture-analysis/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/gesture-analysis/tsconfig.json b/examples/gesture-analysis/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/gesture-analysis/tsconfig.json +++ b/examples/gesture-analysis/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/gesture-analysis/webpack.config.js b/examples/gesture-analysis/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/gesture-analysis/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/grid-iterators/.gitignore b/examples/grid-iterators/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/grid-iterators/.gitignore +++ b/examples/grid-iterators/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/grid-iterators/package.json b/examples/grid-iterators/package.json index 50c36f104e..61fa310a82 100644 --- a/examples/grid-iterators/package.json +++ b/examples/grid-iterators/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/color": "latest", @@ -34,5 +28,8 @@ "grid-iterators" ], "screenshot": "examples/grid-iterators.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/grid-iterators/index.html b/examples/grid-iterators/public/index.html similarity index 92% rename from examples/grid-iterators/index.html rename to examples/grid-iterators/public/index.html index e0e355af06..ef81ffeb2a 100644 --- a/examples/grid-iterators/index.html +++ b/examples/grid-iterators/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/grid-iterators/snowpack.config.js b/examples/grid-iterators/snowpack.config.js new file mode 100644 index 0000000000..422503b7aa --- /dev/null +++ b/examples/grid-iterators/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/grid-iterators", + }, +}; diff --git a/examples/grid-iterators/src/static.d.ts b/examples/grid-iterators/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/grid-iterators/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/grid-iterators/src/webpack.d.ts b/examples/grid-iterators/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/grid-iterators/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/grid-iterators/tsconfig.json b/examples/grid-iterators/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/grid-iterators/tsconfig.json +++ b/examples/grid-iterators/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/grid-iterators/webpack.config.js b/examples/grid-iterators/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/grid-iterators/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hdom-basics/.gitignore b/examples/hdom-basics/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-basics/.gitignore +++ b/examples/hdom-basics/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-basics/package.json b/examples/hdom-basics/package.json index 5ae4d4297e..4836746491 100644 --- a/examples/hdom-basics/package.json +++ b/examples/hdom-basics/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest" @@ -23,5 +18,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-basics/index.html b/examples/hdom-basics/public/index.html similarity index 90% rename from examples/hdom-basics/index.html rename to examples/hdom-basics/public/index.html index 7decd27244..f3c7bed80c 100644 --- a/examples/hdom-basics/index.html +++ b/examples/hdom-basics/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/hdom-basics/snowpack.config.js b/examples/hdom-basics/snowpack.config.js new file mode 100644 index 0000000000..d1238ae89b --- /dev/null +++ b/examples/hdom-basics/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-basics", + }, +}; diff --git a/examples/hdom-basics/src/static.d.ts b/examples/hdom-basics/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-basics/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-basics/tsconfig.json b/examples/hdom-basics/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-basics/tsconfig.json +++ b/examples/hdom-basics/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-benchmark/.gitignore b/examples/hdom-benchmark/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-benchmark/.gitignore +++ b/examples/hdom-benchmark/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-benchmark/package.json b/examples/hdom-benchmark/package.json index 2660c66422..98c784cc06 100644 --- a/examples/hdom-benchmark/package.json +++ b/examples/hdom-benchmark/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest", @@ -30,5 +25,8 @@ }, "thi.ng": { "screenshot": "examples/hdom-benchmark.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-benchmark/index.html b/examples/hdom-benchmark/public/index.html similarity index 95% rename from examples/hdom-benchmark/index.html rename to examples/hdom-benchmark/public/index.html index e6e709a190..4452946ca9 100644 --- a/examples/hdom-benchmark/index.html +++ b/examples/hdom-benchmark/public/index.html @@ -57,6 +57,6 @@ >@thi.ng/hdom. - + diff --git a/examples/hdom-benchmark/snowpack.config.js b/examples/hdom-benchmark/snowpack.config.js new file mode 100644 index 0000000000..c35ddf8a41 --- /dev/null +++ b/examples/hdom-benchmark/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-benchmark", + }, +}; diff --git a/examples/hdom-benchmark/src/static.d.ts b/examples/hdom-benchmark/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-benchmark/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-benchmark/tsconfig.json b/examples/hdom-benchmark/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-benchmark/tsconfig.json +++ b/examples/hdom-benchmark/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-benchmark/webpack.config.js b/examples/hdom-benchmark/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hdom-benchmark/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hdom-benchmark2/.gitignore b/examples/hdom-benchmark2/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-benchmark2/.gitignore +++ b/examples/hdom-benchmark2/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-benchmark2/package.json b/examples/hdom-benchmark2/package.json index cfd2149547..49f6d5a569 100644 --- a/examples/hdom-benchmark2/package.json +++ b/examples/hdom-benchmark2/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/binary": "latest", @@ -38,5 +33,8 @@ "transducers" ], "screenshot": "examples/hdom-benchmark2.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-benchmark2/index.html b/examples/hdom-benchmark2/public/index.html similarity index 90% rename from examples/hdom-benchmark2/index.html rename to examples/hdom-benchmark2/public/index.html index de4da53212..c096dd9322 100644 --- a/examples/hdom-benchmark2/index.html +++ b/examples/hdom-benchmark2/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/hdom-benchmark2/snowpack.config.js b/examples/hdom-benchmark2/snowpack.config.js new file mode 100644 index 0000000000..1d09027467 --- /dev/null +++ b/examples/hdom-benchmark2/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-benchmark2", + }, +}; diff --git a/examples/hdom-benchmark2/src/index.ts b/examples/hdom-benchmark2/src/index.ts index 18fe426304..bfc2d1cf80 100644 --- a/examples/hdom-benchmark2/src/index.ts +++ b/examples/hdom-benchmark2/src/index.ts @@ -161,7 +161,7 @@ const deltaOpts = [ ...map((i) => [i, i], [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]), ]; -const cancel = start(() => { +start(() => { frame++; return [ "div.ma3.code.f7", @@ -218,8 +218,3 @@ const cancel = start(() => { ], ]; }); - -const hot = (module).hot; -if (hot) { - hot.dispose(cancel); -} diff --git a/examples/hdom-benchmark2/src/static.d.ts b/examples/hdom-benchmark2/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-benchmark2/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-benchmark2/tsconfig.json b/examples/hdom-benchmark2/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-benchmark2/tsconfig.json +++ b/examples/hdom-benchmark2/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-benchmark2/webpack.config.js b/examples/hdom-benchmark2/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hdom-benchmark2/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hdom-canvas-clock/.gitignore b/examples/hdom-canvas-clock/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-canvas-clock/.gitignore +++ b/examples/hdom-canvas-clock/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-canvas-clock/package.json b/examples/hdom-canvas-clock/package.json index 360ae1dc89..73adbceef3 100644 --- a/examples/hdom-canvas-clock/package.json +++ b/examples/hdom-canvas-clock/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest", @@ -36,5 +31,8 @@ "vectors" ], "screenshot": "examples/hdom-canvas-clock.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-canvas-clock/index.html b/examples/hdom-canvas-clock/public/index.html similarity index 90% rename from examples/hdom-canvas-clock/index.html rename to examples/hdom-canvas-clock/public/index.html index 37243153cf..63fa12e4cf 100644 --- a/examples/hdom-canvas-clock/index.html +++ b/examples/hdom-canvas-clock/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/hdom-canvas-clock/snowpack.config.js b/examples/hdom-canvas-clock/snowpack.config.js new file mode 100644 index 0000000000..4fb1c0d83b --- /dev/null +++ b/examples/hdom-canvas-clock/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-canvas-clock", + }, +}; diff --git a/examples/hdom-canvas-clock/src/index.ts b/examples/hdom-canvas-clock/src/index.ts index d5aad206e9..ed5db31c36 100644 --- a/examples/hdom-canvas-clock/src/index.ts +++ b/examples/hdom-canvas-clock/src/index.ts @@ -45,7 +45,7 @@ const hand = ( ]; }; -const cancel = start(() => { +start(() => { const now = new Date(); const t = now.getTime() / 1000 - now.getTimezoneOffset() * 60; const sec = (t % 60) / 60; @@ -124,8 +124,3 @@ const cancel = start(() => { ], ]; }); - -const hot = (module).hot; -if (hot) { - hot.dispose(cancel); -} diff --git a/examples/hdom-canvas-clock/src/static.d.ts b/examples/hdom-canvas-clock/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-canvas-clock/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-canvas-clock/tsconfig.json b/examples/hdom-canvas-clock/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-canvas-clock/tsconfig.json +++ b/examples/hdom-canvas-clock/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-canvas-draw/.gitignore b/examples/hdom-canvas-draw/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-canvas-draw/.gitignore +++ b/examples/hdom-canvas-draw/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-canvas-draw/package.json b/examples/hdom-canvas-draw/package.json index 886a239d1c..efd924d9af 100644 --- a/examples/hdom-canvas-draw/package.json +++ b/examples/hdom-canvas-draw/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom-canvas": "latest", @@ -41,5 +36,8 @@ "vectors" ], "screenshot": "examples/hdom-canvas-draw.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-canvas-draw/index.html b/examples/hdom-canvas-draw/public/index.html similarity index 90% rename from examples/hdom-canvas-draw/index.html rename to examples/hdom-canvas-draw/public/index.html index ef1c6cafce..08046be249 100644 --- a/examples/hdom-canvas-draw/index.html +++ b/examples/hdom-canvas-draw/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/hdom-canvas-draw/snowpack.config.js b/examples/hdom-canvas-draw/snowpack.config.js new file mode 100644 index 0000000000..cbff5a5f79 --- /dev/null +++ b/examples/hdom-canvas-draw/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-canvas-draw", + }, +}; diff --git a/examples/hdom-canvas-draw/src/index.ts b/examples/hdom-canvas-draw/src/index.ts index d0a1ea6b03..adc86b2452 100644 --- a/examples/hdom-canvas-draw/src/index.ts +++ b/examples/hdom-canvas-draw/src/index.ts @@ -1,6 +1,6 @@ import { canvas } from "@thi.ng/hdom-canvas"; import { HALF_PI, PI } from "@thi.ng/math"; -import { StreamSync, sync, trigger } from "@thi.ng/rstream"; +import { CloseMode, StreamSync, sync, trigger } from "@thi.ng/rstream"; import { GestureEvent, gestureStream, @@ -143,7 +143,10 @@ const app = (main: StreamSync) => { // component's `init` method is called which attaches the above gesture // stream dynamically. the entire UI then only updates when there are new // user interactions... -const main = sync({ src: { trigger: trigger() } }); +const main = sync({ + src: { trigger: trigger() }, + closeIn: CloseMode.NEVER, +}); // transform result stream using the // root component fn and the hdom differential // update transducer diff --git a/examples/hdom-canvas-draw/src/static.d.ts b/examples/hdom-canvas-draw/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-canvas-draw/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-canvas-draw/tsconfig.json b/examples/hdom-canvas-draw/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-canvas-draw/tsconfig.json +++ b/examples/hdom-canvas-draw/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-canvas-particles/.gitignore b/examples/hdom-canvas-particles/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-canvas-particles/.gitignore +++ b/examples/hdom-canvas-particles/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-canvas-particles/package.json b/examples/hdom-canvas-particles/package.json index a24644bfae..a41a9f61b3 100644 --- a/examples/hdom-canvas-particles/package.json +++ b/examples/hdom-canvas-particles/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/compose": "latest", @@ -42,5 +36,8 @@ "vectors" ], "screenshot": "examples/hdom-canvas-particles.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-canvas-particles/index.html b/examples/hdom-canvas-particles/public/index.html similarity index 93% rename from examples/hdom-canvas-particles/index.html rename to examples/hdom-canvas-particles/public/index.html index c6d6ad5a5c..058b02658b 100644 --- a/examples/hdom-canvas-particles/index.html +++ b/examples/hdom-canvas-particles/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/hdom-canvas-particles/snowpack.config.js b/examples/hdom-canvas-particles/snowpack.config.js new file mode 100644 index 0000000000..69f8037d8c --- /dev/null +++ b/examples/hdom-canvas-particles/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-canvas-particles", + }, +}; diff --git a/examples/hdom-canvas-particles/src/index.ts b/examples/hdom-canvas-particles/src/index.ts index 4cd05f868c..bd4a6e4afe 100644 --- a/examples/hdom-canvas-particles/src/index.ts +++ b/examples/hdom-canvas-particles/src/index.ts @@ -128,9 +128,4 @@ const app = () => { }; }; -const cancel = start(app()); - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(cancel); -} +start(app()); diff --git a/examples/hdom-canvas-particles/src/static.d.ts b/examples/hdom-canvas-particles/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-canvas-particles/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-canvas-particles/src/webpack.d.ts b/examples/hdom-canvas-particles/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/hdom-canvas-particles/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/hdom-canvas-particles/tsconfig.json b/examples/hdom-canvas-particles/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/hdom-canvas-particles/tsconfig.json +++ b/examples/hdom-canvas-particles/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-canvas-particles/webpack.config.js b/examples/hdom-canvas-particles/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hdom-canvas-particles/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hdom-canvas-shapes/.gitignore b/examples/hdom-canvas-shapes/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-canvas-shapes/.gitignore +++ b/examples/hdom-canvas-shapes/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-canvas-shapes/package.json b/examples/hdom-canvas-shapes/package.json index 6ee1c2018b..a1ec771af9 100644 --- a/examples/hdom-canvas-shapes/package.json +++ b/examples/hdom-canvas-shapes/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/color": "latest", @@ -51,5 +46,8 @@ "vectors" ], "screenshot": "hdom-canvas/hdom-canvas-shapes-results.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-canvas-shapes/index.html b/examples/hdom-canvas-shapes/public/index.html similarity index 90% rename from examples/hdom-canvas-shapes/index.html rename to examples/hdom-canvas-shapes/public/index.html index 3a8d5142b5..f58c11bc62 100644 --- a/examples/hdom-canvas-shapes/index.html +++ b/examples/hdom-canvas-shapes/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/hdom-canvas-shapes/snowpack.config.js b/examples/hdom-canvas-shapes/snowpack.config.js new file mode 100644 index 0000000000..bdae2101cd --- /dev/null +++ b/examples/hdom-canvas-shapes/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-canvas-shapes", + }, +}; diff --git a/examples/hdom-canvas-shapes/src/index.ts b/examples/hdom-canvas-shapes/src/index.ts index b80c287850..e40da4456e 100644 --- a/examples/hdom-canvas-shapes/src/index.ts +++ b/examples/hdom-canvas-shapes/src/index.ts @@ -11,7 +11,7 @@ import { fromRAF, stream, Subscription, sync } from "@thi.ng/rstream"; import { map, range, repeatedly } from "@thi.ng/transducers"; import { updateDOM } from "@thi.ng/transducers-hdom"; import { addN } from "@thi.ng/vectors"; -import logo from "../assets/logo-64.png"; +import logo from "./logo-64.png"; // for testing SVG conversion @@ -397,10 +397,10 @@ selection.next( : "shape morph" ); -// HMR handling -// terminate `scene` rstream to avoid multiple running instances after HMR -// (this will also terminate all attached child streams/subscriptions) -const hot = (module).hot; -if (hot) { - hot.dispose(() => scene.done()); -} +// // HMR handling +// // terminate `scene` rstream to avoid multiple running instances after HMR +// // (this will also terminate all attached child streams/subscriptions) +// const hot = (module).hot; +// if (hot) { +// hot.dispose(() => scene.done()); +// } diff --git a/examples/hdom-canvas-shapes/assets/logo-64.png b/examples/hdom-canvas-shapes/src/logo-64.png similarity index 100% rename from examples/hdom-canvas-shapes/assets/logo-64.png rename to examples/hdom-canvas-shapes/src/logo-64.png diff --git a/examples/hdom-canvas-shapes/src/static.d.ts b/examples/hdom-canvas-shapes/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-canvas-shapes/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-canvas-shapes/tsconfig.json b/examples/hdom-canvas-shapes/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-canvas-shapes/tsconfig.json +++ b/examples/hdom-canvas-shapes/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-dropdown-fuzzy/.gitignore b/examples/hdom-dropdown-fuzzy/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-dropdown-fuzzy/.gitignore +++ b/examples/hdom-dropdown-fuzzy/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-dropdown-fuzzy/package.json b/examples/hdom-dropdown-fuzzy/package.json index 3297372557..1b6347eaea 100644 --- a/examples/hdom-dropdown-fuzzy/package.json +++ b/examples/hdom-dropdown-fuzzy/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -40,5 +34,8 @@ "interceptors", "transducers" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-dropdown-fuzzy/index.html b/examples/hdom-dropdown-fuzzy/public/index.html similarity index 94% rename from examples/hdom-dropdown-fuzzy/index.html rename to examples/hdom-dropdown-fuzzy/public/index.html index ee269dd997..23b77eb0c2 100644 --- a/examples/hdom-dropdown-fuzzy/index.html +++ b/examples/hdom-dropdown-fuzzy/public/index.html @@ -34,6 +34,6 @@ >
- + diff --git a/examples/hdom-dropdown-fuzzy/snowpack.config.js b/examples/hdom-dropdown-fuzzy/snowpack.config.js new file mode 100644 index 0000000000..2a8c198265 --- /dev/null +++ b/examples/hdom-dropdown-fuzzy/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-dropdown-fuzzy", + }, +}; diff --git a/examples/hdom-dropdown-fuzzy/src/static.d.ts b/examples/hdom-dropdown-fuzzy/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-dropdown-fuzzy/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-dropdown-fuzzy/tsconfig.json b/examples/hdom-dropdown-fuzzy/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-dropdown-fuzzy/tsconfig.json +++ b/examples/hdom-dropdown-fuzzy/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-dropdown-fuzzy/webpack.config.js b/examples/hdom-dropdown-fuzzy/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hdom-dropdown-fuzzy/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hdom-dropdown/.gitignore b/examples/hdom-dropdown/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-dropdown/.gitignore +++ b/examples/hdom-dropdown/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-dropdown/package.json b/examples/hdom-dropdown/package.json index 2611fbaced..88affe20e0 100644 --- a/examples/hdom-dropdown/package.json +++ b/examples/hdom-dropdown/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -29,5 +23,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-dropdown/index.html b/examples/hdom-dropdown/public/index.html similarity index 94% rename from examples/hdom-dropdown/index.html rename to examples/hdom-dropdown/public/index.html index 4158b5006f..fdf5925af6 100644 --- a/examples/hdom-dropdown/index.html +++ b/examples/hdom-dropdown/public/index.html @@ -32,6 +32,6 @@ >
- + diff --git a/examples/hdom-dropdown/snowpack.config.js b/examples/hdom-dropdown/snowpack.config.js new file mode 100644 index 0000000000..b1d2570e1a --- /dev/null +++ b/examples/hdom-dropdown/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-dropdown", + }, +}; diff --git a/examples/hdom-dropdown/src/static.d.ts b/examples/hdom-dropdown/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-dropdown/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-dropdown/tsconfig.json b/examples/hdom-dropdown/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-dropdown/tsconfig.json +++ b/examples/hdom-dropdown/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-dropdown/webpack.config.js b/examples/hdom-dropdown/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hdom-dropdown/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hdom-dyn-context/.gitignore b/examples/hdom-dyn-context/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-dyn-context/.gitignore +++ b/examples/hdom-dyn-context/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-dyn-context/package.json b/examples/hdom-dyn-context/package.json index 289f01ba5d..4b25109106 100644 --- a/examples/hdom-dyn-context/package.json +++ b/examples/hdom-dyn-context/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/atom": "latest", @@ -24,5 +19,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-dyn-context/index.html b/examples/hdom-dyn-context/public/index.html similarity index 90% rename from examples/hdom-dyn-context/index.html rename to examples/hdom-dyn-context/public/index.html index 700bc164e9..fb6cd8f267 100644 --- a/examples/hdom-dyn-context/index.html +++ b/examples/hdom-dyn-context/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/hdom-dyn-context/snowpack.config.js b/examples/hdom-dyn-context/snowpack.config.js new file mode 100644 index 0000000000..3ee559d3ea --- /dev/null +++ b/examples/hdom-dyn-context/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-dyn-context", + }, +}; diff --git a/examples/hdom-dyn-context/src/index.ts b/examples/hdom-dyn-context/src/index.ts index 87b5cbb9ad..0a2f746599 100644 --- a/examples/hdom-dyn-context/src/index.ts +++ b/examples/hdom-dyn-context/src/index.ts @@ -47,13 +47,7 @@ const app = ({ theme, themeID }: any) => [ ]; // kick off hdom render loop -const cancel = start(app, { +start(app, { ctx, autoDerefKeys: Object.keys(ctx), }); - -// HMR handling -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(cancel); -} diff --git a/examples/hdom-dyn-context/src/static.d.ts b/examples/hdom-dyn-context/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-dyn-context/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-dyn-context/tsconfig.json b/examples/hdom-dyn-context/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-dyn-context/tsconfig.json +++ b/examples/hdom-dyn-context/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-elm/.gitignore b/examples/hdom-elm/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-elm/.gitignore +++ b/examples/hdom-elm/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-elm/package.json b/examples/hdom-elm/package.json index 304a8830a3..9da6294d81 100644 --- a/examples/hdom-elm/package.json +++ b/examples/hdom-elm/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -34,5 +28,8 @@ "hdom", "paths" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-elm/index.html b/examples/hdom-elm/public/index.html similarity index 95% rename from examples/hdom-elm/index.html rename to examples/hdom-elm/public/index.html index 1d77422a59..52113fcc2b 100644 --- a/examples/hdom-elm/index.html +++ b/examples/hdom-elm/public/index.html @@ -41,6 +41,6 @@

Hotkeys

>Source code - + diff --git a/examples/hdom-elm/snowpack.config.js b/examples/hdom-elm/snowpack.config.js new file mode 100644 index 0000000000..eb3f15ed7f --- /dev/null +++ b/examples/hdom-elm/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-elm", + }, +}; diff --git a/examples/hdom-elm/src/static.d.ts b/examples/hdom-elm/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-elm/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-elm/tsconfig.json b/examples/hdom-elm/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/hdom-elm/tsconfig.json +++ b/examples/hdom-elm/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-elm/webpack.config.js b/examples/hdom-elm/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hdom-elm/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hdom-inner-html/.gitignore b/examples/hdom-inner-html/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-inner-html/.gitignore +++ b/examples/hdom-inner-html/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-inner-html/package.json b/examples/hdom-inner-html/package.json index 1179f4a3ab..7ee106a877 100644 --- a/examples/hdom-inner-html/package.json +++ b/examples/hdom-inner-html/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "rimraf": "^2.6.3", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest" @@ -24,5 +18,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-inner-html/index.html b/examples/hdom-inner-html/public/index.html similarity index 90% rename from examples/hdom-inner-html/index.html rename to examples/hdom-inner-html/public/index.html index 884104920d..4c201c176d 100644 --- a/examples/hdom-inner-html/index.html +++ b/examples/hdom-inner-html/public/index.html @@ -19,6 +19,6 @@
- + diff --git a/examples/hdom-inner-html/snowpack.config.js b/examples/hdom-inner-html/snowpack.config.js new file mode 100644 index 0000000000..a05c78b688 --- /dev/null +++ b/examples/hdom-inner-html/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-inner-html", + }, +}; diff --git a/examples/hdom-inner-html/src/index.ts b/examples/hdom-inner-html/src/index.ts index ee99bc234c..37272a12f2 100644 --- a/examples/hdom-inner-html/src/index.ts +++ b/examples/hdom-inner-html/src/index.ts @@ -41,10 +41,4 @@ const app = () => { }; // kick off -const cancel = start(app()); - -// HMR handling -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(cancel); -} +start(app()); diff --git a/examples/hdom-inner-html/src/static.d.ts b/examples/hdom-inner-html/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-inner-html/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-inner-html/tsconfig.json b/examples/hdom-inner-html/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/hdom-inner-html/tsconfig.json +++ b/examples/hdom-inner-html/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-local-render/.gitignore b/examples/hdom-local-render/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-local-render/.gitignore +++ b/examples/hdom-local-render/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-local-render/package.json b/examples/hdom-local-render/package.json index 3e91608a8e..a4a5583045 100644 --- a/examples/hdom-local-render/package.json +++ b/examples/hdom-local-render/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -26,5 +20,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-local-render/index.html b/examples/hdom-local-render/public/index.html similarity index 95% rename from examples/hdom-local-render/index.html rename to examples/hdom-local-render/public/index.html index c5860d45c5..ed210fd883 100644 --- a/examples/hdom-local-render/index.html +++ b/examples/hdom-local-render/public/index.html @@ -42,6 +42,6 @@

@thi.ng/hdom component local re-render

>Source code - + diff --git a/examples/hdom-local-render/snowpack.config.js b/examples/hdom-local-render/snowpack.config.js new file mode 100644 index 0000000000..828fdbaee5 --- /dev/null +++ b/examples/hdom-local-render/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-local-render", + }, +}; diff --git a/examples/hdom-local-render/src/static.d.ts b/examples/hdom-local-render/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-local-render/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-local-render/src/webpack.d.ts b/examples/hdom-local-render/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/hdom-local-render/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/hdom-local-render/tsconfig.json b/examples/hdom-local-render/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/hdom-local-render/tsconfig.json +++ b/examples/hdom-local-render/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-local-render/webpack.config.js b/examples/hdom-local-render/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hdom-local-render/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hdom-localstate/.gitignore b/examples/hdom-localstate/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-localstate/.gitignore +++ b/examples/hdom-localstate/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-localstate/package.json b/examples/hdom-localstate/package.json index 4b52c39971..76628f6f58 100644 --- a/examples/hdom-localstate/package.json +++ b/examples/hdom-localstate/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest", @@ -24,5 +19,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-localstate/index.html b/examples/hdom-localstate/public/index.html similarity index 90% rename from examples/hdom-localstate/index.html rename to examples/hdom-localstate/public/index.html index bcab675f73..cf4101ec65 100644 --- a/examples/hdom-localstate/index.html +++ b/examples/hdom-localstate/public/index.html @@ -19,6 +19,6 @@
- + diff --git a/examples/hdom-localstate/snowpack.config.js b/examples/hdom-localstate/snowpack.config.js new file mode 100644 index 0000000000..c2f3e124e9 --- /dev/null +++ b/examples/hdom-localstate/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-localstate", + }, +}; diff --git a/examples/hdom-localstate/src/index.ts b/examples/hdom-localstate/src/index.ts index 6e0e92b2b6..6770d4bba9 100644 --- a/examples/hdom-localstate/src/index.ts +++ b/examples/hdom-localstate/src/index.ts @@ -46,9 +46,4 @@ const APP = [ ]; // start app and define context object skeleton -const cancel = start(APP, { ctx: { __local: {} } }); - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(cancel); -} +start(APP, { ctx: { __local: {} } }); diff --git a/examples/hdom-localstate/src/static.d.ts b/examples/hdom-localstate/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-localstate/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-localstate/tsconfig.json b/examples/hdom-localstate/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/hdom-localstate/tsconfig.json +++ b/examples/hdom-localstate/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-skip-nested/.gitignore b/examples/hdom-skip-nested/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-skip-nested/.gitignore +++ b/examples/hdom-skip-nested/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-skip-nested/package.json b/examples/hdom-skip-nested/package.json index 987f90bd8e..2c47a17602 100644 --- a/examples/hdom-skip-nested/package.json +++ b/examples/hdom-skip-nested/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest" @@ -24,5 +18,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-skip-nested/index.html b/examples/hdom-skip-nested/public/index.html similarity index 95% rename from examples/hdom-skip-nested/index.html rename to examples/hdom-skip-nested/public/index.html index a92ef05c02..790050333b 100644 --- a/examples/hdom-skip-nested/index.html +++ b/examples/hdom-skip-nested/public/index.html @@ -37,6 +37,6 @@ >Source code - + diff --git a/examples/hdom-skip-nested/snowpack.config.js b/examples/hdom-skip-nested/snowpack.config.js new file mode 100644 index 0000000000..d6ede912e1 --- /dev/null +++ b/examples/hdom-skip-nested/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-skip-nested", + }, +}; diff --git a/examples/hdom-skip-nested/src/index.ts b/examples/hdom-skip-nested/src/index.ts index 3c34e1fbce..23bfd8e16f 100644 --- a/examples/hdom-skip-nested/src/index.ts +++ b/examples/hdom-skip-nested/src/index.ts @@ -34,7 +34,7 @@ const button = () => setTimeout(() => { this.id++; this.enabled = true; - }, 500); + }, 1000); }, }, this.id, @@ -84,9 +84,4 @@ const app = () => { return ["div.sans-serif", [bt1, 0], [bt2, 100]]; }; -const cancel = start(app()); - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(cancel); -} +start(app()); diff --git a/examples/hdom-skip-nested/src/static.d.ts b/examples/hdom-skip-nested/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-skip-nested/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-skip-nested/src/webpack.d.ts b/examples/hdom-skip-nested/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/hdom-skip-nested/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/hdom-skip-nested/tsconfig.json b/examples/hdom-skip-nested/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/hdom-skip-nested/tsconfig.json +++ b/examples/hdom-skip-nested/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-skip-nested/webpack.config.js b/examples/hdom-skip-nested/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hdom-skip-nested/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hdom-skip/.gitignore b/examples/hdom-skip/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-skip/.gitignore +++ b/examples/hdom-skip/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-skip/package.json b/examples/hdom-skip/package.json index 899372c594..8b931e11b0 100644 --- a/examples/hdom-skip/package.json +++ b/examples/hdom-skip/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest" @@ -23,5 +18,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-skip/index.html b/examples/hdom-skip/public/index.html similarity index 90% rename from examples/hdom-skip/index.html rename to examples/hdom-skip/public/index.html index 2e0ecc7bb8..5dac2864b1 100644 --- a/examples/hdom-skip/index.html +++ b/examples/hdom-skip/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/hdom-skip/snowpack.config.js b/examples/hdom-skip/snowpack.config.js new file mode 100644 index 0000000000..320ed35cc1 --- /dev/null +++ b/examples/hdom-skip/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-skip", + }, +}; diff --git a/examples/hdom-skip/src/index.ts b/examples/hdom-skip/src/index.ts index d97026f6bf..a81b87129f 100644 --- a/examples/hdom-skip/src/index.ts +++ b/examples/hdom-skip/src/index.ts @@ -55,10 +55,4 @@ const app = { }; // kick off -const cancel = start([app]); - -// HMR handling -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(cancel); -} +start([app]); diff --git a/examples/hdom-skip/src/static.d.ts b/examples/hdom-skip/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-skip/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-skip/tsconfig.json b/examples/hdom-skip/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-skip/tsconfig.json +++ b/examples/hdom-skip/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-theme-adr-0003/.gitignore b/examples/hdom-theme-adr-0003/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-theme-adr-0003/.gitignore +++ b/examples/hdom-theme-adr-0003/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-theme-adr-0003/package.json b/examples/hdom-theme-adr-0003/package.json index ea8847ebd9..974ce7691a 100644 --- a/examples/hdom-theme-adr-0003/package.json +++ b/examples/hdom-theme-adr-0003/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -25,5 +20,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-theme-adr-0003/index.html b/examples/hdom-theme-adr-0003/public/index.html similarity index 92% rename from examples/hdom-theme-adr-0003/index.html rename to examples/hdom-theme-adr-0003/public/index.html index fa651c4e73..0cb3590cdc 100644 --- a/examples/hdom-theme-adr-0003/index.html +++ b/examples/hdom-theme-adr-0003/public/index.html @@ -25,6 +25,6 @@
- + diff --git a/examples/hdom-theme-adr-0003/snowpack.config.js b/examples/hdom-theme-adr-0003/snowpack.config.js new file mode 100644 index 0000000000..6b16ac994d --- /dev/null +++ b/examples/hdom-theme-adr-0003/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-theme-adr-0003", + }, +}; diff --git a/examples/hdom-theme-adr-0003/src/static.d.ts b/examples/hdom-theme-adr-0003/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-theme-adr-0003/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-theme-adr-0003/tsconfig.json b/examples/hdom-theme-adr-0003/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-theme-adr-0003/tsconfig.json +++ b/examples/hdom-theme-adr-0003/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-toggle/.gitignore b/examples/hdom-toggle/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/hdom-toggle/.gitignore +++ b/examples/hdom-toggle/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-toggle/package.json b/examples/hdom-toggle/package.json index 5380018c44..eeac50417c 100644 --- a/examples/hdom-toggle/package.json +++ b/examples/hdom-toggle/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest", @@ -29,5 +23,8 @@ "thi.ng": { "readme": true, "screenshot": "examples/hdom-toggle.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-toggle/index.html b/examples/hdom-toggle/public/index.html similarity index 92% rename from examples/hdom-toggle/index.html rename to examples/hdom-toggle/public/index.html index 9733d7eb3f..60f142719a 100644 --- a/examples/hdom-toggle/index.html +++ b/examples/hdom-toggle/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/hdom-toggle/snowpack.config.js b/examples/hdom-toggle/snowpack.config.js new file mode 100644 index 0000000000..9e16165900 --- /dev/null +++ b/examples/hdom-toggle/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-toggle", + }, +}; diff --git a/examples/hdom-toggle/src/index.ts b/examples/hdom-toggle/src/index.ts index 9a5f00df88..a73af23bba 100644 --- a/examples/hdom-toggle/src/index.ts +++ b/examples/hdom-toggle/src/index.ts @@ -70,7 +70,7 @@ const toggleGroup = (_: any, toggle: any) => [ ]), ]; -const cancel = start(() => [ +start(() => [ "div", [toggleGroup, toggleH], [toggleGroup, toggleHStroke], @@ -81,8 +81,3 @@ const cancel = start(() => [ [toggleGroup, toggleVSq], [toggleGroup, toggleVSqStroke], ]); - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(cancel); -} diff --git a/examples/hdom-toggle/src/static.d.ts b/examples/hdom-toggle/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-toggle/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-toggle/src/webpack.d.ts b/examples/hdom-toggle/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/hdom-toggle/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/hdom-toggle/tsconfig.json b/examples/hdom-toggle/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/hdom-toggle/tsconfig.json +++ b/examples/hdom-toggle/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-toggle/webpack.config.js b/examples/hdom-toggle/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hdom-toggle/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hdom-vscroller/.gitignore b/examples/hdom-vscroller/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hdom-vscroller/.gitignore +++ b/examples/hdom-vscroller/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hdom-vscroller/package.json b/examples/hdom-vscroller/package.json index 322c82841f..ef2cd7b870 100644 --- a/examples/hdom-vscroller/package.json +++ b/examples/hdom-vscroller/package.json @@ -6,16 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "rimraf": "^2.6.3", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -27,5 +20,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hdom-vscroller/index.html b/examples/hdom-vscroller/public/index.html similarity index 90% rename from examples/hdom-vscroller/index.html rename to examples/hdom-vscroller/public/index.html index b0c13f8488..8d4b18f3f7 100644 --- a/examples/hdom-vscroller/index.html +++ b/examples/hdom-vscroller/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/hdom-vscroller/snowpack.config.js b/examples/hdom-vscroller/snowpack.config.js new file mode 100644 index 0000000000..8b219cfdce --- /dev/null +++ b/examples/hdom-vscroller/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hdom-vscroller", + }, +}; diff --git a/examples/hdom-vscroller/src/index.ts b/examples/hdom-vscroller/src/index.ts index 627f697859..a1635a8937 100644 --- a/examples/hdom-vscroller/src/index.ts +++ b/examples/hdom-vscroller/src/index.ts @@ -10,8 +10,8 @@ type Package = [string, string]; const LOGO = _logo; const REPO_BASE = "https://github.com/thi-ng/umbrella/"; -const COMMITS: Commit[] = _commits; -const PACKAGES: Package[] = _packages; +const COMMITS = _commits; +const PACKAGES = _packages; let query = ""; let filtered = COMMITS; @@ -97,9 +97,4 @@ const app = () => [ }), ]; -const cancel = start(app); - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(cancel); -} +start(app); diff --git a/examples/hdom-vscroller/src/static.d.ts b/examples/hdom-vscroller/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hdom-vscroller/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hdom-vscroller/src/webpack.d.ts b/examples/hdom-vscroller/src/webpack.d.ts deleted file mode 100644 index d9b7d4b9df..0000000000 --- a/examples/hdom-vscroller/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.json"; -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/hdom-vscroller/tsconfig.json b/examples/hdom-vscroller/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hdom-vscroller/tsconfig.json +++ b/examples/hdom-vscroller/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hdom-vscroller/webpack.config.js b/examples/hdom-vscroller/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hdom-vscroller/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hiccup-canvas-arcs/.gitignore b/examples/hiccup-canvas-arcs/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/hiccup-canvas-arcs/.gitignore +++ b/examples/hiccup-canvas-arcs/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hiccup-canvas-arcs/package.json b/examples/hiccup-canvas-arcs/package.json index 423eed62ff..81806d8242 100644 --- a/examples/hiccup-canvas-arcs/package.json +++ b/examples/hiccup-canvas-arcs/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/geom": "latest", @@ -35,5 +29,8 @@ "hiccup-canvas" ], "screenshot": "examples/hiccup-canvas-arcs.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hiccup-canvas-arcs/index.html b/examples/hiccup-canvas-arcs/public/index.html similarity index 93% rename from examples/hiccup-canvas-arcs/index.html rename to examples/hiccup-canvas-arcs/public/index.html index 3a9dd11abd..d842319fde 100644 --- a/examples/hiccup-canvas-arcs/index.html +++ b/examples/hiccup-canvas-arcs/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/hiccup-canvas-arcs/snowpack.config.js b/examples/hiccup-canvas-arcs/snowpack.config.js new file mode 100644 index 0000000000..2ba43400e2 --- /dev/null +++ b/examples/hiccup-canvas-arcs/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hiccup-canvas-arcs", + }, +}; diff --git a/examples/hiccup-canvas-arcs/src/static.d.ts b/examples/hiccup-canvas-arcs/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hiccup-canvas-arcs/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hiccup-canvas-arcs/src/webpack.d.ts b/examples/hiccup-canvas-arcs/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/hiccup-canvas-arcs/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/hiccup-canvas-arcs/tsconfig.json b/examples/hiccup-canvas-arcs/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/hiccup-canvas-arcs/tsconfig.json +++ b/examples/hiccup-canvas-arcs/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/hiccup-canvas-arcs/webpack.config.js b/examples/hiccup-canvas-arcs/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/hiccup-canvas-arcs/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/hydrate-basics/.gitignore b/examples/hydrate-basics/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/hydrate-basics/.gitignore +++ b/examples/hydrate-basics/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/hydrate-basics/package.json b/examples/hydrate-basics/package.json index fe51aba864..e86c7b32f1 100644 --- a/examples/hydrate-basics/package.json +++ b/examples/hydrate-basics/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -33,5 +28,8 @@ "hdom", "hiccup" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/hydrate-basics/index.html b/examples/hydrate-basics/public/index.html similarity index 90% rename from examples/hydrate-basics/index.html rename to examples/hydrate-basics/public/index.html index 6c8e1a0146..484d2f447f 100644 --- a/examples/hydrate-basics/index.html +++ b/examples/hydrate-basics/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/hydrate-basics/snowpack.config.js b/examples/hydrate-basics/snowpack.config.js new file mode 100644 index 0000000000..29a3893873 --- /dev/null +++ b/examples/hydrate-basics/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/hydrate-basics", + }, +}; diff --git a/examples/hydrate-basics/src/static.d.ts b/examples/hydrate-basics/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/hydrate-basics/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/hydrate-basics/tsconfig.json b/examples/hydrate-basics/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/hydrate-basics/tsconfig.json +++ b/examples/hydrate-basics/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/imgui-basics/.gitignore b/examples/imgui-basics/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/imgui-basics/.gitignore +++ b/examples/imgui-basics/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/imgui-basics/package.json b/examples/imgui-basics/package.json index a71af5bb0d..2828d70a68 100644 --- a/examples/imgui-basics/package.json +++ b/examples/imgui-basics/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest", @@ -37,5 +31,8 @@ "rstream-gestures" ], "screenshot": "examples/imgui-basics.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/imgui-basics/index.html b/examples/imgui-basics/public/index.html similarity index 93% rename from examples/imgui-basics/index.html rename to examples/imgui-basics/public/index.html index d741a75df6..909caa28ed 100644 --- a/examples/imgui-basics/index.html +++ b/examples/imgui-basics/public/index.html @@ -30,6 +30,6 @@ >Source code - + diff --git a/examples/imgui-basics/snowpack.config.js b/examples/imgui-basics/snowpack.config.js new file mode 100644 index 0000000000..789074bbe8 --- /dev/null +++ b/examples/imgui-basics/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/imgui-basics", + }, +}; diff --git a/examples/imgui-basics/src/static.d.ts b/examples/imgui-basics/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/imgui-basics/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/imgui-basics/src/webpack.d.ts b/examples/imgui-basics/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/imgui-basics/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/imgui-basics/tsconfig.json b/examples/imgui-basics/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/imgui-basics/tsconfig.json +++ b/examples/imgui-basics/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/imgui-basics/webpack.config.js b/examples/imgui-basics/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/imgui-basics/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/imgui/.gitignore b/examples/imgui/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/imgui/.gitignore +++ b/examples/imgui/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/imgui/package.json b/examples/imgui/package.json index da19bc9767..e3bec5feb4 100644 --- a/examples/imgui/package.json +++ b/examples/imgui/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/atom": "latest", @@ -53,5 +47,8 @@ "transducers-hdom" ], "screenshot": "imgui/imgui-all.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/imgui/index.html b/examples/imgui/public/index.html similarity index 96% rename from examples/imgui/index.html rename to examples/imgui/public/index.html index 76798ce4f3..c424c142ae 100644 --- a/examples/imgui/index.html +++ b/examples/imgui/public/index.html @@ -49,6 +49,6 @@ >Source code / Info - + diff --git a/examples/imgui/snowpack.config.js b/examples/imgui/snowpack.config.js new file mode 100644 index 0000000000..552281de88 --- /dev/null +++ b/examples/imgui/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/imgui", + }, +}; diff --git a/examples/imgui/src/index.ts b/examples/imgui/src/index.ts index 9239642865..743ddf5c43 100644 --- a/examples/imgui/src/index.ts +++ b/examples/imgui/src/index.ts @@ -559,9 +559,3 @@ main .subscribe(sidechainPartition(fromRAF())) // then apply main compoment function & apply hdom .transform(map(app()), updateDOM()); - -// HMR handling / cleanup -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(() => main.done()); -} diff --git a/examples/imgui/src/static.d.ts b/examples/imgui/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/imgui/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/imgui/src/webpack.d.ts b/examples/imgui/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/imgui/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/imgui/tsconfig.json b/examples/imgui/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/imgui/tsconfig.json +++ b/examples/imgui/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/imgui/webpack.config.js b/examples/imgui/webpack.config.js deleted file mode 100644 index 08baf21e9f..0000000000 --- a/examples/imgui/webpack.config.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: false -}; diff --git a/examples/interceptor-basics/.gitignore b/examples/interceptor-basics/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/interceptor-basics/.gitignore +++ b/examples/interceptor-basics/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/interceptor-basics/package.json b/examples/interceptor-basics/package.json index 6500eb894e..06edf0b8c5 100644 --- a/examples/interceptor-basics/package.json +++ b/examples/interceptor-basics/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/atom": "latest", @@ -31,5 +26,8 @@ "readme": [ "interceptors" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/interceptor-basics/index.html b/examples/interceptor-basics/public/index.html similarity index 90% rename from examples/interceptor-basics/index.html rename to examples/interceptor-basics/public/index.html index 0df1112be3..468bb22fab 100644 --- a/examples/interceptor-basics/index.html +++ b/examples/interceptor-basics/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/interceptor-basics/snowpack.config.js b/examples/interceptor-basics/snowpack.config.js new file mode 100644 index 0000000000..6398dfcc79 --- /dev/null +++ b/examples/interceptor-basics/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/interceptor-basics", + }, +}; diff --git a/examples/interceptor-basics/src/static.d.ts b/examples/interceptor-basics/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/interceptor-basics/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/interceptor-basics/tsconfig.json b/examples/interceptor-basics/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/interceptor-basics/tsconfig.json +++ b/examples/interceptor-basics/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/interceptor-basics2/.gitignore b/examples/interceptor-basics2/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/interceptor-basics2/.gitignore +++ b/examples/interceptor-basics2/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/interceptor-basics2/package.json b/examples/interceptor-basics2/package.json index 09cc8b2dd3..c6bfb23184 100644 --- a/examples/interceptor-basics2/package.json +++ b/examples/interceptor-basics2/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -33,5 +28,8 @@ "interceptors", "paths" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/interceptor-basics2/index.html b/examples/interceptor-basics2/public/index.html similarity index 96% rename from examples/interceptor-basics2/index.html rename to examples/interceptor-basics2/public/index.html index 565d83b3a2..44f21e37df 100644 --- a/examples/interceptor-basics2/index.html +++ b/examples/interceptor-basics2/public/index.html @@ -51,7 +51,7 @@

- + \ No newline at end of file diff --git a/examples/interceptor-basics2/snowpack.config.js b/examples/interceptor-basics2/snowpack.config.js new file mode 100644 index 0000000000..422a154b67 --- /dev/null +++ b/examples/interceptor-basics2/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/interceptor-basics2", + }, +}; diff --git a/examples/interceptor-basics2/src/static.d.ts b/examples/interceptor-basics2/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/interceptor-basics2/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/interceptor-basics2/tsconfig.json b/examples/interceptor-basics2/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/interceptor-basics2/tsconfig.json +++ b/examples/interceptor-basics2/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/iso-plasma/.gitignore b/examples/iso-plasma/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/iso-plasma/.gitignore +++ b/examples/iso-plasma/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/iso-plasma/package.json b/examples/iso-plasma/package.json index 03101d5a93..d36945a687 100644 --- a/examples/iso-plasma/package.json +++ b/examples/iso-plasma/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "rimraf": "^2.6.3", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -43,5 +37,8 @@ "vectors" ], "screenshot": "geom/geom-isoline.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/iso-plasma/index.html b/examples/iso-plasma/public/index.html similarity index 90% rename from examples/iso-plasma/index.html rename to examples/iso-plasma/public/index.html index fdc98b618c..c5a303bfdc 100644 --- a/examples/iso-plasma/index.html +++ b/examples/iso-plasma/public/index.html @@ -19,6 +19,6 @@
- + diff --git a/examples/iso-plasma/snowpack.config.js b/examples/iso-plasma/snowpack.config.js new file mode 100644 index 0000000000..570bac1f9d --- /dev/null +++ b/examples/iso-plasma/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/iso-plasma", + }, +}; diff --git a/examples/iso-plasma/src/index.ts b/examples/iso-plasma/src/index.ts index c9a438d66a..8940e1c51b 100644 --- a/examples/iso-plasma/src/index.ts +++ b/examples/iso-plasma/src/index.ts @@ -60,10 +60,4 @@ const app = () => { }; // kick off -const cancel = start(app); - -// HMR handling -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(cancel); -} +start(app); diff --git a/examples/iso-plasma/src/static.d.ts b/examples/iso-plasma/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/iso-plasma/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/iso-plasma/tsconfig.json b/examples/iso-plasma/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/iso-plasma/tsconfig.json +++ b/examples/iso-plasma/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/json-components/.gitignore b/examples/json-components/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/json-components/.gitignore +++ b/examples/json-components/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/json-components/package.json b/examples/json-components/package.json index f294c6e7c3..8577150eb4 100644 --- a/examples/json-components/package.json +++ b/examples/json-components/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest", @@ -28,5 +23,8 @@ "thi.ng": { "readme": true, "screenshot": "examples/json-components.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/json-components/assets/editme.png b/examples/json-components/public/assets/editme.png similarity index 100% rename from examples/json-components/assets/editme.png rename to examples/json-components/public/assets/editme.png diff --git a/examples/json-components/index.html b/examples/json-components/public/index.html similarity index 98% rename from examples/json-components/index.html rename to examples/json-components/public/index.html index 999d3b0887..e933665f2c 100644 --- a/examples/json-components/index.html +++ b/examples/json-components/public/index.html @@ -139,6 +139,6 @@

JSON driven components

>@thi.ng/hdom. - + diff --git a/examples/json-components/snowpack.config.js b/examples/json-components/snowpack.config.js new file mode 100644 index 0000000000..72e53f993e --- /dev/null +++ b/examples/json-components/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/json-components", + }, +}; diff --git a/examples/json-components/src/static.d.ts b/examples/json-components/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/json-components/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/json-components/tsconfig.json b/examples/json-components/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/json-components/tsconfig.json +++ b/examples/json-components/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/login-form/.gitignore b/examples/login-form/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/login-form/.gitignore +++ b/examples/login-form/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/login-form/package.json b/examples/login-form/package.json index 43b723ffd3..c89545a251 100644 --- a/examples/login-form/package.json +++ b/examples/login-form/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/atom": "latest", @@ -29,5 +24,8 @@ }, "thi.ng": { "readme": true + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/login-form/index.html b/examples/login-form/public/index.html similarity index 93% rename from examples/login-form/index.html rename to examples/login-form/public/index.html index 4b2a70489d..67b67b6452 100644 --- a/examples/login-form/index.html +++ b/examples/login-form/public/index.html @@ -33,6 +33,6 @@
- + diff --git a/examples/login-form/snowpack.config.js b/examples/login-form/snowpack.config.js new file mode 100644 index 0000000000..376e76cddb --- /dev/null +++ b/examples/login-form/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/login-form", + }, +}; diff --git a/examples/login-form/src/index.ts b/examples/login-form/src/index.ts index 5535b89558..0c75fc724e 100644 --- a/examples/login-form/src/index.ts +++ b/examples/login-form/src/index.ts @@ -1,4 +1,4 @@ -import type { Nullable, Path } from "@thi.ng/api"; +import { exposeGlobal, Nullable, Path } from "@thi.ng/api"; import { defAtom, defView } from "@thi.ng/atom"; import { start } from "@thi.ng/hdom"; import { capitalize } from "@thi.ng/strings"; @@ -39,7 +39,7 @@ const setUser = (e: Event) => setValue(user.path, (e.target).value); const setValue = (path: Path, val: any) => db.resetInUnsafe(path, val); const loginUser = () => { - if (user.deref() === "admin") { + if (user.deref() === "Admin") { setError(null); setState("main"); } else { @@ -99,3 +99,5 @@ const currView = defView( // app root component // embedded view (will auto-deref) start(() => ["div", currView]); + +exposeGlobal("db", db); diff --git a/examples/login-form/src/static.d.ts b/examples/login-form/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/login-form/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/login-form/tsconfig.json b/examples/login-form/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/login-form/tsconfig.json +++ b/examples/login-form/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/markdown/.gitignore b/examples/markdown/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/markdown/.gitignore +++ b/examples/markdown/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/markdown/package.json b/examples/markdown/package.json index c7a34fe466..5dbfaca078 100644 --- a/examples/markdown/package.json +++ b/examples/markdown/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report", - "build-parser": "yarn clean && parcel build src/parser.ts -d out --global md --public-url ./ --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --experimental-scope-hoisting", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/bench": "latest", @@ -37,5 +31,8 @@ "transducers-hdom" ], "screenshot": "examples/markdown-parser.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/markdown/index.html b/examples/markdown/public/index.html similarity index 94% rename from examples/markdown/index.html rename to examples/markdown/public/index.html index 1618d8dd96..7b78718e75 100644 --- a/examples/markdown/index.html +++ b/examples/markdown/public/index.html @@ -43,6 +43,6 @@
- + diff --git a/examples/markdown/snowpack.config.js b/examples/markdown/snowpack.config.js new file mode 100644 index 0000000000..f0bfed1a52 --- /dev/null +++ b/examples/markdown/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/markdown", + }, +}; diff --git a/examples/markdown/README.txt b/examples/markdown/src/README.md similarity index 100% rename from examples/markdown/README.txt rename to examples/markdown/src/README.md diff --git a/examples/markdown/src/index.ts b/examples/markdown/src/index.ts index 1d534f463c..196e3cc40e 100644 --- a/examples/markdown/src/index.ts +++ b/examples/markdown/src/index.ts @@ -3,7 +3,7 @@ import { parse, TagFactories } from "@thi.ng/hiccup-markdown"; import { reactive, Stream } from "@thi.ng/rstream"; import { iterator, map } from "@thi.ng/transducers"; import { updateDOM } from "@thi.ng/transducers-hdom"; -import readme from "../README.txt"; +import readme from "./README.md"; // ignore error, resolved by parcel // const readme = "README.af35c500.md" @@ -50,7 +50,7 @@ const app = (input: Stream) => ({ "div.w-100.h-50.w-50-l.vh-100-l.overflow-y-scroll.pa3.lh-copy", [ "div.pa2.bg-yellow.purple.f7", - `Parsed ${src.length} chars in ${time}ms`, + `Parsed ${src.length} chars in ${time | 0}ms`, ], ...hiccup, ], @@ -79,8 +79,8 @@ fetch(readme) .then((txt) => src.next(txt)) .catch((e) => src.next(`# Error loading file: ${e}`)); -// HMR handling -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(() => src.done()); -} +// // HMR handling +// if (process.env.NODE_ENV !== "production") { +// const hot = (module).hot; +// hot && hot.dispose(() => src.done()); +// } diff --git a/examples/markdown/src/static.d.ts b/examples/markdown/src/static.d.ts new file mode 100644 index 0000000000..6d2ddba995 --- /dev/null +++ b/examples/markdown/src/static.d.ts @@ -0,0 +1,64 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ + +declare module "*.md" { + const ref: string; + export default ref; +} diff --git a/examples/markdown/src/webpack.d.ts b/examples/markdown/src/webpack.d.ts deleted file mode 100644 index 5deedeaad4..0000000000 --- a/examples/markdown/src/webpack.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare module "*.txt"; -declare module "*.md"; diff --git a/examples/markdown/tsconfig.json b/examples/markdown/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/markdown/tsconfig.json +++ b/examples/markdown/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/multitouch/.gitignore b/examples/multitouch/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/multitouch/.gitignore +++ b/examples/multitouch/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/multitouch/package.json b/examples/multitouch/package.json index fecc0514c3..2ba3cfdfbe 100644 --- a/examples/multitouch/package.json +++ b/examples/multitouch/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom-canvas": "latest", @@ -37,5 +31,8 @@ "rstream-gestures", "transducers-hdom" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/multitouch/index.html b/examples/multitouch/public/index.html similarity index 92% rename from examples/multitouch/index.html rename to examples/multitouch/public/index.html index 0d4451f375..789d8de78e 100644 --- a/examples/multitouch/index.html +++ b/examples/multitouch/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/multitouch/snowpack.config.js b/examples/multitouch/snowpack.config.js new file mode 100644 index 0000000000..d2ccee4419 --- /dev/null +++ b/examples/multitouch/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/multitouch", + }, +}; diff --git a/examples/multitouch/src/static.d.ts b/examples/multitouch/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/multitouch/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/multitouch/src/webpack.d.ts b/examples/multitouch/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/multitouch/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/multitouch/tsconfig.json b/examples/multitouch/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/multitouch/tsconfig.json +++ b/examples/multitouch/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/multitouch/webpack.config.js b/examples/multitouch/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/multitouch/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/package-stats/package.json b/examples/package-stats/package.json index 41b7a532c3..c38f935fa1 100644 --- a/examples/package-stats/package.json +++ b/examples/package-stats/package.json @@ -7,13 +7,11 @@ "license": "Apache-2.0", "scripts": { "clean": "rm -rf *.js *.svg lib", - "build": "yarn clean && npx ts-node src/index.ts" + "build": "yarn clean && ../../node_modules/.bin/ts-node src/index.ts" }, "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2", - "ts-node": "^8.2.0" + "ts-node": "^9.1.0", + "typescript": "^4.1.2" }, "dependencies": { "@thi.ng/checks": "latest", @@ -33,6 +31,7 @@ "process": false }, "thi.ng": { + "skip": true, "online": false, "readme": [ "dgraph", diff --git a/examples/parse-playground/.gitignore b/examples/parse-playground/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/parse-playground/.gitignore +++ b/examples/parse-playground/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/parse-playground/package.json b/examples/parse-playground/package.json index aea1a73f68..f856b32fc2 100644 --- a/examples/parse-playground/package.json +++ b/examples/parse-playground/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -49,5 +43,8 @@ "transducers-binary" ], "screenshot": "examples/parse-playground.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/parse-playground/index.html b/examples/parse-playground/public/index.html similarity index 95% rename from examples/parse-playground/index.html rename to examples/parse-playground/public/index.html index 941ebce1ef..accace6af4 100644 --- a/examples/parse-playground/index.html +++ b/examples/parse-playground/public/index.html @@ -49,6 +49,6 @@ > - + diff --git a/examples/parse-playground/snowpack.config.js b/examples/parse-playground/snowpack.config.js new file mode 100644 index 0000000000..e9b0e20090 --- /dev/null +++ b/examples/parse-playground/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/parse-playground", + }, +}; diff --git a/examples/parse-playground/src/static.d.ts b/examples/parse-playground/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/parse-playground/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/parse-playground/src/webpack.d.ts b/examples/parse-playground/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/parse-playground/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/parse-playground/tsconfig.json b/examples/parse-playground/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/parse-playground/tsconfig.json +++ b/examples/parse-playground/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/parse-playground/webpack.config.js b/examples/parse-playground/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/parse-playground/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/pixel-basics/.gitignore b/examples/pixel-basics/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/pixel-basics/.gitignore +++ b/examples/pixel-basics/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/pixel-basics/package.json b/examples/pixel-basics/package.json index 5c1e663914..40ceb65914 100644 --- a/examples/pixel-basics/package.json +++ b/examples/pixel-basics/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/pixel": "latest", @@ -29,5 +23,8 @@ "thi.ng": { "readme": true, "screenshot": "pixel/pixel-basics.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/pixel-basics/index.html b/examples/pixel-basics/public/index.html similarity index 90% rename from examples/pixel-basics/index.html rename to examples/pixel-basics/public/index.html index 82a3690695..611377369e 100644 --- a/examples/pixel-basics/index.html +++ b/examples/pixel-basics/public/index.html @@ -19,6 +19,6 @@
- + diff --git a/examples/pixel-basics/snowpack.config.js b/examples/pixel-basics/snowpack.config.js new file mode 100644 index 0000000000..af66f4ffb7 --- /dev/null +++ b/examples/pixel-basics/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/pixel-basics", + }, +}; diff --git a/examples/pixel-basics/src/debug.png b/examples/pixel-basics/src/debug.png new file mode 100644 index 0000000000..3407ed6fc1 Binary files /dev/null and b/examples/pixel-basics/src/debug.png differ diff --git a/examples/pixel-basics/assets/haystack.jpg b/examples/pixel-basics/src/haystack.jpg similarity index 100% rename from examples/pixel-basics/assets/haystack.jpg rename to examples/pixel-basics/src/haystack.jpg diff --git a/examples/pixel-basics/src/index.ts b/examples/pixel-basics/src/index.ts index b6c7849cf4..57182d0452 100644 --- a/examples/pixel-basics/src/index.ts +++ b/examples/pixel-basics/src/index.ts @@ -7,8 +7,8 @@ import { RGB565, } from "@thi.ng/pixel"; import { SRC_OVER_I } from "@thi.ng/porter-duff"; -import IMG from "../assets/haystack.jpg"; -import LOGO from "../assets/logo-64.png"; +import IMG from "./haystack.jpg"; +import LOGO from "./logo-64.png"; Promise.all([IMG, LOGO].map(imagePromise)).then(([img, logo]) => { // init 16bit packed RGB pixel buffer from image (resized to 256x256) diff --git a/examples/pixel-basics/assets/logo-64.png b/examples/pixel-basics/src/logo-64.png similarity index 100% rename from examples/pixel-basics/assets/logo-64.png rename to examples/pixel-basics/src/logo-64.png diff --git a/examples/pixel-basics/src/static.d.ts b/examples/pixel-basics/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/pixel-basics/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/pixel-basics/src/webpack.d.ts b/examples/pixel-basics/src/webpack.d.ts deleted file mode 100644 index 891c762327..0000000000 --- a/examples/pixel-basics/src/webpack.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; diff --git a/examples/pixel-basics/tsconfig.json b/examples/pixel-basics/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/pixel-basics/tsconfig.json +++ b/examples/pixel-basics/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/pixel-basics/webpack.config.js b/examples/pixel-basics/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/pixel-basics/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/pointfree-svg/package.json b/examples/pointfree-svg/package.json index 9ec12f80e3..c90e563a45 100644 --- a/examples/pointfree-svg/package.json +++ b/examples/pointfree-svg/package.json @@ -6,8 +6,8 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && ts-node src/index.ts", - "clean": "rm -rf *.js" + "clean": "rm -rf *.js", + "build": "yarn clean && ../../node_modules/.bin/ts-node src/index.ts" }, "dependencies": { "@thi.ng/hiccup": "latest", @@ -16,7 +16,7 @@ "@thi.ng/pointfree-lang": "latest" }, "devDependencies": { - "ts-node": "^8.2.0", + "ts-node": "^9.1.0", "typescript": "^4.1.2" }, "thi.ng": { diff --git a/examples/poisson-circles/.gitignore b/examples/poisson-circles/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/poisson-circles/.gitignore +++ b/examples/poisson-circles/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/poisson-circles/package.json b/examples/poisson-circles/package.json index 4677132c92..dbca07105f 100644 --- a/examples/poisson-circles/package.json +++ b/examples/poisson-circles/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/geom": "latest", @@ -35,5 +29,8 @@ "poisson" ], "screenshot": "poisson/poisson.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/poisson-circles/index.html b/examples/poisson-circles/public/index.html similarity index 92% rename from examples/poisson-circles/index.html rename to examples/poisson-circles/public/index.html index e30a5fb1c1..18759c43bd 100644 --- a/examples/poisson-circles/index.html +++ b/examples/poisson-circles/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/poisson-circles/snowpack.config.js b/examples/poisson-circles/snowpack.config.js new file mode 100644 index 0000000000..e10517418f --- /dev/null +++ b/examples/poisson-circles/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/poisson-circles", + }, +}; diff --git a/examples/poisson-circles/src/static.d.ts b/examples/poisson-circles/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/poisson-circles/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/poisson-circles/src/webpack.d.ts b/examples/poisson-circles/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/poisson-circles/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/poisson-circles/tsconfig.json b/examples/poisson-circles/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/poisson-circles/tsconfig.json +++ b/examples/poisson-circles/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/poisson-circles/webpack.config.js b/examples/poisson-circles/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/poisson-circles/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/poly-spline/.gitignore b/examples/poly-spline/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/poly-spline/.gitignore +++ b/examples/poly-spline/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/poly-spline/package.json b/examples/poly-spline/package.json index e5f3efde11..3d057db840 100644 --- a/examples/poly-spline/package.json +++ b/examples/poly-spline/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/dsp": "latest", @@ -39,5 +33,8 @@ "transducers-hdom" ], "screenshot": "examples/poly-spline.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/poly-spline/index.html b/examples/poly-spline/public/index.html similarity index 90% rename from examples/poly-spline/index.html rename to examples/poly-spline/public/index.html index ac23bd744d..7c09ea595c 100644 --- a/examples/poly-spline/index.html +++ b/examples/poly-spline/public/index.html @@ -19,6 +19,6 @@
- + diff --git a/examples/poly-spline/snowpack.config.js b/examples/poly-spline/snowpack.config.js new file mode 100644 index 0000000000..6b77db262b --- /dev/null +++ b/examples/poly-spline/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/poly-spline", + }, +}; diff --git a/examples/poly-spline/src/index.ts b/examples/poly-spline/src/index.ts index 713e442ed8..761a58e73e 100644 --- a/examples/poly-spline/src/index.ts +++ b/examples/poly-spline/src/index.ts @@ -197,8 +197,8 @@ const main = sync({ // transform to create & apply UI main.transform(map(app(mode, uniform, scale, uniScale)), updateDOM()); -// HMR handling (dev builds only) -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(() => main.done()); -} +// // HMR handling (dev builds only) +// if (process.env.NODE_ENV !== "production") { +// const hot = (module).hot; +// hot && hot.dispose(() => main.done()); +// } diff --git a/examples/poly-spline/src/static.d.ts b/examples/poly-spline/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/poly-spline/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/poly-spline/tsconfig.json b/examples/poly-spline/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/poly-spline/tsconfig.json +++ b/examples/poly-spline/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/poly-spline/webpack.config.js b/examples/poly-spline/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/poly-spline/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/porter-duff/.gitignore b/examples/porter-duff/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/porter-duff/.gitignore +++ b/examples/porter-duff/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/porter-duff/package.json b/examples/porter-duff/package.json index 84fbf67683..032a092efe 100644 --- a/examples/porter-duff/package.json +++ b/examples/porter-duff/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/pixel": "latest", @@ -29,5 +23,8 @@ "thi.ng": { "readme": true, "screenshot": "porter-duff/porter-duff2.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/porter-duff/index.html b/examples/porter-duff/public/index.html similarity index 93% rename from examples/porter-duff/index.html rename to examples/porter-duff/public/index.html index 6d1a637779..51fc88e843 100644 --- a/examples/porter-duff/index.html +++ b/examples/porter-duff/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/porter-duff/snowpack.config.js b/examples/porter-duff/snowpack.config.js new file mode 100644 index 0000000000..d1de7753b8 --- /dev/null +++ b/examples/porter-duff/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/porter-duff", + }, +}; diff --git a/examples/porter-duff/src/index.ts b/examples/porter-duff/src/index.ts index d21c60f6b6..65ea28d830 100644 --- a/examples/porter-duff/src/index.ts +++ b/examples/porter-duff/src/index.ts @@ -13,8 +13,8 @@ import { SRC_OVER_I, XOR_I, } from "@thi.ng/porter-duff"; -import IMG2 from "../assets/plus.png"; -import IMG from "../assets/ring.png"; +import IMG2 from "./plus.png"; +import IMG from "./ring.png"; const MODES: any = { SRC: SRC_I, @@ -70,8 +70,3 @@ Promise.all([IMG, IMG2].map(imagePromise)) } }) .catch((e) => console.log(e)); - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(() => {}); -} diff --git a/examples/porter-duff/assets/plus.png b/examples/porter-duff/src/plus.png similarity index 100% rename from examples/porter-duff/assets/plus.png rename to examples/porter-duff/src/plus.png diff --git a/examples/porter-duff/assets/ring.png b/examples/porter-duff/src/ring.png similarity index 100% rename from examples/porter-duff/assets/ring.png rename to examples/porter-duff/src/ring.png diff --git a/examples/porter-duff/src/static.d.ts b/examples/porter-duff/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/porter-duff/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/porter-duff/src/webpack.d.ts b/examples/porter-duff/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/porter-duff/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/porter-duff/tsconfig.json b/examples/porter-duff/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/porter-duff/tsconfig.json +++ b/examples/porter-duff/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/porter-duff/webpack.config.js b/examples/porter-duff/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/porter-duff/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/ramp-synth/.gitignore b/examples/ramp-synth/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/ramp-synth/.gitignore +++ b/examples/ramp-synth/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/ramp-synth/package.json b/examples/ramp-synth/package.json index cec614872a..688d0db6fc 100644 --- a/examples/ramp-synth/package.json +++ b/examples/ramp-synth/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/arrays": "latest", @@ -40,5 +34,8 @@ "transducers" ], "screenshot": "examples/ramp-synth.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/ramp-synth/index.html b/examples/ramp-synth/public/index.html similarity index 93% rename from examples/ramp-synth/index.html rename to examples/ramp-synth/public/index.html index 118f2de0d5..3dbbbad136 100644 --- a/examples/ramp-synth/index.html +++ b/examples/ramp-synth/public/index.html @@ -28,6 +28,6 @@ > for info & keyboard shortcuts. - + diff --git a/examples/ramp-synth/snowpack.config.js b/examples/ramp-synth/snowpack.config.js new file mode 100644 index 0000000000..f8635a7cc6 --- /dev/null +++ b/examples/ramp-synth/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/ramp-synth", + }, +}; diff --git a/examples/ramp-synth/src/static.d.ts b/examples/ramp-synth/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/ramp-synth/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/ramp-synth/tsconfig.json b/examples/ramp-synth/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/ramp-synth/tsconfig.json +++ b/examples/ramp-synth/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/ramp-synth/webpack.config.js b/examples/ramp-synth/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/ramp-synth/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/rdom-basics/.gitignore b/examples/rdom-basics/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/rdom-basics/.gitignore +++ b/examples/rdom-basics/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rdom-basics/package.json b/examples/rdom-basics/package.json index f01ff9d34f..c75f2fd11c 100644 --- a/examples/rdom-basics/package.json +++ b/examples/rdom-basics/package.json @@ -6,16 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache", - "start2": "parcel --version" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -37,5 +30,8 @@ "rstream", "transducers" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rdom-basics/index.html b/examples/rdom-basics/public/index.html similarity index 93% rename from examples/rdom-basics/index.html rename to examples/rdom-basics/public/index.html index 8300301dfb..cef058d0e4 100644 --- a/examples/rdom-basics/index.html +++ b/examples/rdom-basics/public/index.html @@ -30,6 +30,6 @@ >Source code - + diff --git a/examples/rdom-basics/snowpack.config.js b/examples/rdom-basics/snowpack.config.js new file mode 100644 index 0000000000..17aea3096c --- /dev/null +++ b/examples/rdom-basics/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rdom-basics", + }, +}; diff --git a/examples/rdom-basics/src/static.d.ts b/examples/rdom-basics/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rdom-basics/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rdom-basics/src/webpack.d.ts b/examples/rdom-basics/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/rdom-basics/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/rdom-basics/tsconfig.json b/examples/rdom-basics/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/rdom-basics/tsconfig.json +++ b/examples/rdom-basics/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rdom-basics/webpack.config.js b/examples/rdom-basics/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/rdom-basics/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/rdom-dnd/.gitignore b/examples/rdom-dnd/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/rdom-dnd/.gitignore +++ b/examples/rdom-dnd/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rdom-dnd/package.json b/examples/rdom-dnd/package.json index f5ca624efd..c5f8c5f9e2 100644 --- a/examples/rdom-dnd/package.json +++ b/examples/rdom-dnd/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -35,5 +29,8 @@ "hiccup-carbon-icons" ], "screenshot": "examples/rdom-dnd.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rdom-dnd/index.html b/examples/rdom-dnd/public/index.html similarity index 94% rename from examples/rdom-dnd/index.html rename to examples/rdom-dnd/public/index.html index 6a8f3a66aa..217e1e91e7 100644 --- a/examples/rdom-dnd/index.html +++ b/examples/rdom-dnd/public/index.html @@ -35,6 +35,6 @@ >Source code - + diff --git a/examples/rdom-dnd/snowpack.config.js b/examples/rdom-dnd/snowpack.config.js new file mode 100644 index 0000000000..0deb860804 --- /dev/null +++ b/examples/rdom-dnd/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rdom-dnd", + }, +}; diff --git a/examples/rdom-dnd/src/static.d.ts b/examples/rdom-dnd/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rdom-dnd/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rdom-dnd/src/webpack.d.ts b/examples/rdom-dnd/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/rdom-dnd/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/rdom-dnd/tsconfig.json b/examples/rdom-dnd/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/rdom-dnd/tsconfig.json +++ b/examples/rdom-dnd/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rdom-dnd/webpack.config.js b/examples/rdom-dnd/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/rdom-dnd/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/rdom-lissajous/.gitignore b/examples/rdom-lissajous/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/rdom-lissajous/.gitignore +++ b/examples/rdom-lissajous/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rdom-lissajous/package.json b/examples/rdom-lissajous/package.json index c74b435dc3..24e826c470 100644 --- a/examples/rdom-lissajous/package.json +++ b/examples/rdom-lissajous/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -39,5 +33,8 @@ "transducers" ], "screenshot": "examples/rdom-lissajous.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rdom-lissajous/index.html b/examples/rdom-lissajous/public/index.html similarity index 95% rename from examples/rdom-lissajous/index.html rename to examples/rdom-lissajous/public/index.html index 48154ac7c2..853885f436 100644 --- a/examples/rdom-lissajous/index.html +++ b/examples/rdom-lissajous/public/index.html @@ -49,6 +49,6 @@ >Source code - + diff --git a/examples/rdom-lissajous/snowpack.config.js b/examples/rdom-lissajous/snowpack.config.js new file mode 100644 index 0000000000..f5ac4e1750 --- /dev/null +++ b/examples/rdom-lissajous/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rdom-lissajous", + }, +}; diff --git a/examples/rdom-lissajous/src/static.d.ts b/examples/rdom-lissajous/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rdom-lissajous/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rdom-lissajous/src/webpack.d.ts b/examples/rdom-lissajous/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/rdom-lissajous/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/rdom-lissajous/tsconfig.json b/examples/rdom-lissajous/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/rdom-lissajous/tsconfig.json +++ b/examples/rdom-lissajous/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rdom-lissajous/webpack.config.js b/examples/rdom-lissajous/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/rdom-lissajous/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/rdom-search-docs/.gitignore b/examples/rdom-search-docs/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/rdom-search-docs/.gitignore +++ b/examples/rdom-search-docs/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rdom-search-docs/package.json b/examples/rdom-search-docs/package.json index c314a19fad..1ea1c5cd7c 100644 --- a/examples/rdom-search-docs/package.json +++ b/examples/rdom-search-docs/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -41,5 +35,8 @@ "rstream", "transducers" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rdom-search-docs/index.html b/examples/rdom-search-docs/public/index.html similarity index 91% rename from examples/rdom-search-docs/index.html rename to examples/rdom-search-docs/public/index.html index f84b1eea93..d0e618fcd1 100644 --- a/examples/rdom-search-docs/index.html +++ b/examples/rdom-search-docs/public/index.html @@ -19,6 +19,6 @@
- + diff --git a/examples/rdom-search-docs/snowpack.config.js b/examples/rdom-search-docs/snowpack.config.js new file mode 100644 index 0000000000..d7e30c3e03 --- /dev/null +++ b/examples/rdom-search-docs/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rdom-search-docs", + }, +}; diff --git a/examples/rdom-search-docs/src/static.d.ts b/examples/rdom-search-docs/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rdom-search-docs/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rdom-search-docs/src/webpack.d.ts b/examples/rdom-search-docs/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/rdom-search-docs/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/rdom-search-docs/tsconfig.json b/examples/rdom-search-docs/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/rdom-search-docs/tsconfig.json +++ b/examples/rdom-search-docs/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rdom-search-docs/webpack.config.js b/examples/rdom-search-docs/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/rdom-search-docs/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/rdom-svg-nodes/.gitignore b/examples/rdom-svg-nodes/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/rdom-svg-nodes/.gitignore +++ b/examples/rdom-svg-nodes/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rdom-svg-nodes/package.json b/examples/rdom-svg-nodes/package.json index 3468d2eb6f..d38f534bec 100644 --- a/examples/rdom-svg-nodes/package.json +++ b/examples/rdom-svg-nodes/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/atom": "latest", @@ -38,5 +32,8 @@ "rstream" ], "screenshot": "examples/rdom-svg-nodes.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rdom-svg-nodes/index.html b/examples/rdom-svg-nodes/public/index.html similarity index 92% rename from examples/rdom-svg-nodes/index.html rename to examples/rdom-svg-nodes/public/index.html index c28cf56173..f8bf642aab 100644 --- a/examples/rdom-svg-nodes/index.html +++ b/examples/rdom-svg-nodes/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/rdom-svg-nodes/snowpack.config.js b/examples/rdom-svg-nodes/snowpack.config.js new file mode 100644 index 0000000000..0b79d25904 --- /dev/null +++ b/examples/rdom-svg-nodes/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rdom-svg-nodes", + }, +}; diff --git a/examples/rdom-svg-nodes/src/static.d.ts b/examples/rdom-svg-nodes/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rdom-svg-nodes/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rdom-svg-nodes/src/webpack.d.ts b/examples/rdom-svg-nodes/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/rdom-svg-nodes/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/rdom-svg-nodes/tsconfig.json b/examples/rdom-svg-nodes/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/rdom-svg-nodes/tsconfig.json +++ b/examples/rdom-svg-nodes/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rdom-svg-nodes/webpack.config.js b/examples/rdom-svg-nodes/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/rdom-svg-nodes/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/rotating-voronoi/.gitignore b/examples/rotating-voronoi/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/rotating-voronoi/.gitignore +++ b/examples/rotating-voronoi/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rotating-voronoi/dist/index.html b/examples/rotating-voronoi/dist/index.html deleted file mode 100644 index ee569af231..0000000000 --- a/examples/rotating-voronoi/dist/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - rotating-voronoi - - - - -
- - - diff --git a/examples/rotating-voronoi/package.json b/examples/rotating-voronoi/package.json index 9c047d42e0..f38e222e45 100644 --- a/examples/rotating-voronoi/package.json +++ b/examples/rotating-voronoi/package.json @@ -14,15 +14,9 @@ "rstream" ], "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/dl-asset": "latest", @@ -58,5 +52,8 @@ "vectors" ], "screenshot": "examples/rotating-voronoi.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rotating-voronoi/index.html b/examples/rotating-voronoi/public/index.html similarity index 90% rename from examples/rotating-voronoi/index.html rename to examples/rotating-voronoi/public/index.html index aeb50daf9d..ab521e3664 100644 --- a/examples/rotating-voronoi/index.html +++ b/examples/rotating-voronoi/public/index.html @@ -19,6 +19,6 @@
- + diff --git a/examples/rotating-voronoi/snowpack.config.js b/examples/rotating-voronoi/snowpack.config.js new file mode 100644 index 0000000000..b7007c300f --- /dev/null +++ b/examples/rotating-voronoi/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rotating-voronoi", + }, +}; diff --git a/examples/rotating-voronoi/src/index.ts b/examples/rotating-voronoi/src/index.ts index 7326bbd897..f86ea8185a 100644 --- a/examples/rotating-voronoi/src/index.ts +++ b/examples/rotating-voronoi/src/index.ts @@ -173,7 +173,7 @@ function appRender(state: AppState) { ]; } -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(() => mainStream.done()); -} +// if (process.env.NODE_ENV !== "production") { +// const hot = (module).hot; +// hot && hot.dispose(() => mainStream.done()); +// } diff --git a/examples/rotating-voronoi/src/static.d.ts b/examples/rotating-voronoi/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rotating-voronoi/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rotating-voronoi/tsconfig.json b/examples/rotating-voronoi/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/rotating-voronoi/tsconfig.json +++ b/examples/rotating-voronoi/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rotating-voronoi/webpack.config.js b/examples/rotating-voronoi/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/rotating-voronoi/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/router-basics/.gitignore b/examples/router-basics/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/router-basics/.gitignore +++ b/examples/router-basics/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/router-basics/package.json b/examples/router-basics/package.json index 2bd8238c7c..719441ecc9 100644 --- a/examples/router-basics/package.json +++ b/examples/router-basics/package.json @@ -6,11 +6,9 @@ "author": "Karsten Schmidt", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "prep": "yarn clean && mkdir -p out && cp -R assets out", - "build": "yarn prep && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "yarn prep && parcel index.html -p 8080 --open -d out" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -20,11 +18,6 @@ "@thi.ng/interceptors": "latest", "@thi.ng/router": "latest" }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" - }, "browserslist": [ "last 3 Chrome versions" ], @@ -39,5 +32,8 @@ "router" ], "screenshot": "examples/router-basics.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/router-basics/assets/manomine-1.jpg b/examples/router-basics/public/assets/manomine-1.jpg similarity index 100% rename from examples/router-basics/assets/manomine-1.jpg rename to examples/router-basics/public/assets/manomine-1.jpg diff --git a/examples/router-basics/assets/manomine-2.jpg b/examples/router-basics/public/assets/manomine-2.jpg similarity index 100% rename from examples/router-basics/assets/manomine-2.jpg rename to examples/router-basics/public/assets/manomine-2.jpg diff --git a/examples/router-basics/assets/manomine-3.jpg b/examples/router-basics/public/assets/manomine-3.jpg similarity index 100% rename from examples/router-basics/assets/manomine-3.jpg rename to examples/router-basics/public/assets/manomine-3.jpg diff --git a/examples/router-basics/assets/user-1.json b/examples/router-basics/public/assets/user-1.json similarity index 100% rename from examples/router-basics/assets/user-1.json rename to examples/router-basics/public/assets/user-1.json diff --git a/examples/router-basics/assets/user-2.json b/examples/router-basics/public/assets/user-2.json similarity index 100% rename from examples/router-basics/assets/user-2.json rename to examples/router-basics/public/assets/user-2.json diff --git a/examples/router-basics/assets/users.json b/examples/router-basics/public/assets/users.json similarity index 100% rename from examples/router-basics/assets/users.json rename to examples/router-basics/public/assets/users.json diff --git a/examples/router-basics/index.html b/examples/router-basics/public/index.html similarity index 96% rename from examples/router-basics/index.html rename to examples/router-basics/public/index.html index 308b56e978..77598db5c1 100644 --- a/examples/router-basics/index.html +++ b/examples/router-basics/public/index.html @@ -69,6 +69,6 @@ >@manomine - + diff --git a/examples/router-basics/snowpack.config.js b/examples/router-basics/snowpack.config.js new file mode 100644 index 0000000000..5e2818643d --- /dev/null +++ b/examples/router-basics/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/router-basics", + }, +}; diff --git a/examples/router-basics/src/api.ts b/examples/router-basics/src/api.ts index 642e93cd4e..6f4546cb09 100644 --- a/examples/router-basics/src/api.ts +++ b/examples/router-basics/src/api.ts @@ -1,6 +1,6 @@ import type { Fn, IObjectOf, Path } from "@thi.ng/api"; import type { IView } from "@thi.ng/atom"; -import { EffectDef, EventBus, EventDef } from "@thi.ng/interceptors"; +import type { EffectDef, EventBus, EventDef } from "@thi.ng/interceptors"; import type { HTMLRouterConfig, RouteMatch } from "@thi.ng/router"; // general types defined for the base app diff --git a/examples/router-basics/src/static.d.ts b/examples/router-basics/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/router-basics/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/router-basics/tsconfig.json b/examples/router-basics/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/router-basics/tsconfig.json +++ b/examples/router-basics/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/router-basics/webpack.config.js b/examples/router-basics/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/router-basics/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/rstream-dataflow/.gitignore b/examples/rstream-dataflow/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/rstream-dataflow/.gitignore +++ b/examples/rstream-dataflow/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rstream-dataflow/package.json b/examples/rstream-dataflow/package.json index 7502d49fe0..7664aa59b3 100644 --- a/examples/rstream-dataflow/package.json +++ b/examples/rstream-dataflow/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/atom": "latest", @@ -39,5 +33,8 @@ "hdom", "rstream-graph" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rstream-dataflow/index.html b/examples/rstream-dataflow/public/index.html similarity index 94% rename from examples/rstream-dataflow/index.html rename to examples/rstream-dataflow/public/index.html index 1313cef941..647140df05 100644 --- a/examples/rstream-dataflow/index.html +++ b/examples/rstream-dataflow/public/index.html @@ -40,6 +40,6 @@ >Source - + diff --git a/examples/rstream-dataflow/snowpack.config.js b/examples/rstream-dataflow/snowpack.config.js new file mode 100644 index 0000000000..ff49999aad --- /dev/null +++ b/examples/rstream-dataflow/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rstream-dataflow", + }, +}; diff --git a/examples/rstream-dataflow/src/index.ts b/examples/rstream-dataflow/src/index.ts index 638f221264..cf9fb70d66 100644 --- a/examples/rstream-dataflow/src/index.ts +++ b/examples/rstream-dataflow/src/index.ts @@ -94,11 +94,13 @@ const graph = initGraph(db, { // with multiple inputs circle: { fn: node( - map(({ click, radius, color }) => - click && radius && color + map((ins) => { + console.log(ins); + const { click, radius, color } = ins; + return click && radius && color ? circle(color, click[0], click[1], radius * 2) - : undefined - ) + : undefined; + }) ), ins: { click: { stream: "/clickpos/node" }, diff --git a/examples/rstream-dataflow/src/static.d.ts b/examples/rstream-dataflow/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rstream-dataflow/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rstream-dataflow/tsconfig.json b/examples/rstream-dataflow/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/rstream-dataflow/tsconfig.json +++ b/examples/rstream-dataflow/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rstream-dataflow/webpack.config.js b/examples/rstream-dataflow/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/rstream-dataflow/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/rstream-event-loop/.gitignore b/examples/rstream-event-loop/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/rstream-event-loop/.gitignore +++ b/examples/rstream-event-loop/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rstream-event-loop/package.json b/examples/rstream-event-loop/package.json index 17e24a3f50..6ed0bfc216 100644 --- a/examples/rstream-event-loop/package.json +++ b/examples/rstream-event-loop/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -39,5 +33,8 @@ "transducers-hdom" ], "screenshot": "examples/rstream-event-loop.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rstream-event-loop/index.html b/examples/rstream-event-loop/public/index.html similarity index 93% rename from examples/rstream-event-loop/index.html rename to examples/rstream-event-loop/public/index.html index f8b123caa3..fa44102111 100644 --- a/examples/rstream-event-loop/index.html +++ b/examples/rstream-event-loop/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/rstream-event-loop/snowpack.config.js b/examples/rstream-event-loop/snowpack.config.js new file mode 100644 index 0000000000..8bb6b25589 --- /dev/null +++ b/examples/rstream-event-loop/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rstream-event-loop", + }, +}; diff --git a/examples/rstream-event-loop/src/static.d.ts b/examples/rstream-event-loop/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rstream-event-loop/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rstream-event-loop/tsconfig.json b/examples/rstream-event-loop/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/rstream-event-loop/tsconfig.json +++ b/examples/rstream-event-loop/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rstream-event-loop/webpack.config.js b/examples/rstream-event-loop/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/rstream-event-loop/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/rstream-grid/.gitignore b/examples/rstream-grid/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/rstream-grid/.gitignore +++ b/examples/rstream-grid/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rstream-grid/notes.md b/examples/rstream-grid/notes.md new file mode 100644 index 0000000000..77cbcf04f1 --- /dev/null +++ b/examples/rstream-grid/notes.md @@ -0,0 +1,15 @@ +# Rewire dataflow + +```ts +export const useScale = (graph: IObjectOf>, bus: EventBus) => { + const node = rsg.addNode(graph, bus.state, "scale", { + fn: scale, + ins: { + shapes: { stream: "grid" }, + scale: { path: "params.scale" }, + } + }); + (>graph.svg).removeID("shapes"); + (>graph.svg).add(node.subscribe(null, "shapes")); +}; +``` \ No newline at end of file diff --git a/examples/rstream-grid/package.json b/examples/rstream-grid/package.json index da9dbb0a2c..fd954bf98b 100644 --- a/examples/rstream-grid/package.json +++ b/examples/rstream-grid/package.json @@ -6,10 +6,9 @@ "author": "Karsten Schmidt", "license": "MIT", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -25,12 +24,6 @@ "@thi.ng/rstream-graph": "latest", "@thi.ng/transducers": "latest" }, - "devDependencies": { - "@types/node": "^13.7.4", - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" - }, "browserslist": [ "last 3 Chrome versions" ], @@ -50,5 +43,8 @@ "transducers" ], "screenshot": "examples/rstream-grid.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rstream-grid/index.html b/examples/rstream-grid/public/index.html similarity index 98% rename from examples/rstream-grid/index.html rename to examples/rstream-grid/public/index.html index a947814e7a..4b598659fe 100644 --- a/examples/rstream-grid/index.html +++ b/examples/rstream-grid/public/index.html @@ -127,6 +127,6 @@
- + diff --git a/examples/rstream-grid/snowpack.config.js b/examples/rstream-grid/snowpack.config.js new file mode 100644 index 0000000000..2e2f280f99 --- /dev/null +++ b/examples/rstream-grid/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rstream-grid", + }, +}; diff --git a/examples/rstream-grid/src/api.ts b/examples/rstream-grid/src/api.ts index ff3fe683e9..f5e3561990 100644 --- a/examples/rstream-grid/src/api.ts +++ b/examples/rstream-grid/src/api.ts @@ -1,6 +1,6 @@ import type { Fn, IObjectOf, Path } from "@thi.ng/api"; import type { IView } from "@thi.ng/atom"; -import { EffectDef, EventBus, EventDef } from "@thi.ng/interceptors"; +import type { EffectDef, EventBus, EventDef } from "@thi.ng/interceptors"; /** * Function signature for main app components. diff --git a/examples/rstream-grid/src/dataflow.ts b/examples/rstream-grid/src/dataflow.ts index 17a6ac090d..c357e30747 100644 --- a/examples/rstream-grid/src/dataflow.ts +++ b/examples/rstream-grid/src/dataflow.ts @@ -1,5 +1,5 @@ import { group, rect, svg } from "@thi.ng/hiccup-svg"; -import { EventBus } from "@thi.ng/interceptors"; +import type { EventBus } from "@thi.ng/interceptors"; import { initGraph, node } from "@thi.ng/rstream-graph"; import { map, range2d } from "@thi.ng/transducers"; import * as ev from "./events"; diff --git a/examples/rstream-grid/src/index.ts b/examples/rstream-grid/src/index.ts index edc3088d0b..700546a668 100644 --- a/examples/rstream-grid/src/index.ts +++ b/examples/rstream-grid/src/index.ts @@ -1,10 +1,8 @@ +import { exposeGlobal } from "@thi.ng/api"; import { App } from "./app"; import { CONFIG } from "./config"; -// export app to global var in dev mode -// (for interaction via browser dev tools) -if (process.env.NODE_ENV === "development") { - ((window)["APP"] = new App(CONFIG)).start(); -} else { - new App(CONFIG).start(); -} +const APP = new App(CONFIG); +exposeGlobal("APP", APP); + +APP.start(); diff --git a/examples/rstream-grid/src/static.d.ts b/examples/rstream-grid/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rstream-grid/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rstream-grid/tsconfig.json b/examples/rstream-grid/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/rstream-grid/tsconfig.json +++ b/examples/rstream-grid/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rstream-grid/webpack.config.js b/examples/rstream-grid/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/rstream-grid/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/rstream-hdom/.gitignore b/examples/rstream-hdom/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/rstream-hdom/.gitignore +++ b/examples/rstream-hdom/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rstream-hdom/package.json b/examples/rstream-hdom/package.json index b55309b28e..80a24e5e86 100644 --- a/examples/rstream-hdom/package.json +++ b/examples/rstream-hdom/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/arrays": "latest", @@ -26,5 +21,8 @@ ], "browser": { "process": false + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rstream-hdom/index.html b/examples/rstream-hdom/public/index.html similarity index 91% rename from examples/rstream-hdom/index.html rename to examples/rstream-hdom/public/index.html index bdc1d79c48..79b09a0c01 100644 --- a/examples/rstream-hdom/index.html +++ b/examples/rstream-hdom/public/index.html @@ -21,6 +21,6 @@
- + diff --git a/examples/rstream-hdom/snowpack.config.js b/examples/rstream-hdom/snowpack.config.js new file mode 100644 index 0000000000..e85d7fa7be --- /dev/null +++ b/examples/rstream-hdom/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rstream-hdom", + }, +}; diff --git a/examples/rstream-hdom/src/static.d.ts b/examples/rstream-hdom/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rstream-hdom/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rstream-hdom/tsconfig.json b/examples/rstream-hdom/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/rstream-hdom/tsconfig.json +++ b/examples/rstream-hdom/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rstream-spreadsheet/.gitignore b/examples/rstream-spreadsheet/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/rstream-spreadsheet/.gitignore +++ b/examples/rstream-spreadsheet/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/rstream-spreadsheet/package.json b/examples/rstream-spreadsheet/package.json index c430dddcdf..da8f566c64 100644 --- a/examples/rstream-spreadsheet/package.json +++ b/examples/rstream-spreadsheet/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -52,5 +46,8 @@ "transducers-hdom" ], "screenshot": "examples/rstream-spreadsheet.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/rstream-spreadsheet/index.html b/examples/rstream-spreadsheet/public/index.html similarity index 97% rename from examples/rstream-spreadsheet/index.html rename to examples/rstream-spreadsheet/public/index.html index 1e8ae7ccb1..8170476e96 100644 --- a/examples/rstream-spreadsheet/index.html +++ b/examples/rstream-spreadsheet/public/index.html @@ -62,6 +62,6 @@

S-expression formula syntax

cell value A1 from interval A2-A3 to A4-A5 - + diff --git a/examples/rstream-spreadsheet/snowpack.config.js b/examples/rstream-spreadsheet/snowpack.config.js new file mode 100644 index 0000000000..bfdbe21727 --- /dev/null +++ b/examples/rstream-spreadsheet/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/rstream-spreadsheet", + }, +}; diff --git a/examples/rstream-spreadsheet/src/index.ts b/examples/rstream-spreadsheet/src/index.ts index 028bce6ae8..a27ef6d118 100644 --- a/examples/rstream-spreadsheet/src/index.ts +++ b/examples/rstream-spreadsheet/src/index.ts @@ -1,3 +1,4 @@ +import { exposeGlobal } from "@thi.ng/api"; import { isNumber } from "@thi.ng/checks"; import { fromAtom } from "@thi.ng/rstream"; import { charRange } from "@thi.ng/strings"; @@ -143,10 +144,5 @@ const main = fromAtom(DB); // in hdom main.transform(map(app()), updateDOM({ span: false })); -(window)["DB"] = DB; -(window)["graph"] = graph; - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(() => main.done()); -} +exposeGlobal("DB", DB); +exposeGlobal("graph", graph); diff --git a/examples/rstream-spreadsheet/src/static.d.ts b/examples/rstream-spreadsheet/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/rstream-spreadsheet/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/rstream-spreadsheet/src/webpack.d.ts b/examples/rstream-spreadsheet/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/rstream-spreadsheet/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/rstream-spreadsheet/tsconfig.json b/examples/rstream-spreadsheet/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/rstream-spreadsheet/tsconfig.json +++ b/examples/rstream-spreadsheet/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/rstream-spreadsheet/webpack.config.js b/examples/rstream-spreadsheet/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/rstream-spreadsheet/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/scenegraph-image/.gitignore b/examples/scenegraph-image/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/scenegraph-image/.gitignore +++ b/examples/scenegraph-image/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/scenegraph-image/package.json b/examples/scenegraph-image/package.json index da7f5a11dc..4f2e5ef122 100644 --- a/examples/scenegraph-image/package.json +++ b/examples/scenegraph-image/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -45,5 +39,8 @@ "vectors" ], "screenshot": "examples/scenegraph-image.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/scenegraph-image/index.html b/examples/scenegraph-image/public/index.html similarity index 91% rename from examples/scenegraph-image/index.html rename to examples/scenegraph-image/public/index.html index 38e34c8e15..e09938c229 100644 --- a/examples/scenegraph-image/index.html +++ b/examples/scenegraph-image/public/index.html @@ -19,6 +19,6 @@
- + diff --git a/examples/scenegraph-image/snowpack.config.js b/examples/scenegraph-image/snowpack.config.js new file mode 100644 index 0000000000..8be49694bd --- /dev/null +++ b/examples/scenegraph-image/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/scenegraph-image", + }, +}; diff --git a/examples/scenegraph-image/src/index.ts b/examples/scenegraph-image/src/index.ts index f7cf1e888a..f17d3477a8 100644 --- a/examples/scenegraph-image/src/index.ts +++ b/examples/scenegraph-image/src/index.ts @@ -8,7 +8,7 @@ import { GRAY8, imagePromise, PackedBuffer } from "@thi.ng/pixel"; import { Node2D } from "@thi.ng/scenegraph"; import { map, range } from "@thi.ng/transducers"; import { ReadonlyVec, setN2, Vec } from "@thi.ng/vectors"; -import LOGO from "../assets/logo-256.png"; +import LOGO from "./logo-256.png"; /** * Specialized scene graph node for images. @@ -135,10 +135,5 @@ imagePromise(LOGO).then((img) => { ]; }; - cancel = start(app); + start(app); }); - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && cancel! && hot.dispose(cancel!); -} diff --git a/examples/scenegraph-image/assets/logo-256.png b/examples/scenegraph-image/src/logo-256.png similarity index 100% rename from examples/scenegraph-image/assets/logo-256.png rename to examples/scenegraph-image/src/logo-256.png diff --git a/examples/scenegraph-image/src/static.d.ts b/examples/scenegraph-image/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/scenegraph-image/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/scenegraph-image/src/webpack.d.ts b/examples/scenegraph-image/src/webpack.d.ts deleted file mode 100644 index 65e20c0a38..0000000000 --- a/examples/scenegraph-image/src/webpack.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare module "*.png"; -declare module "*.jpg"; diff --git a/examples/scenegraph-image/tsconfig.json b/examples/scenegraph-image/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/scenegraph-image/tsconfig.json +++ b/examples/scenegraph-image/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/scenegraph-image/webpack.config.js b/examples/scenegraph-image/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/scenegraph-image/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/scenegraph/.gitignore b/examples/scenegraph/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/scenegraph/.gitignore +++ b/examples/scenegraph/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/scenegraph/package.json b/examples/scenegraph/package.json index 9438ea4ab5..53c4ab3174 100644 --- a/examples/scenegraph/package.json +++ b/examples/scenegraph/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/geom": "latest", @@ -43,5 +37,8 @@ "vectors" ], "screenshot": "examples/scenegraph.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/scenegraph/index.html b/examples/scenegraph/public/index.html similarity index 90% rename from examples/scenegraph/index.html rename to examples/scenegraph/public/index.html index cc77999cfb..23b5bfe711 100644 --- a/examples/scenegraph/index.html +++ b/examples/scenegraph/public/index.html @@ -19,6 +19,6 @@
- + diff --git a/examples/scenegraph/snowpack.config.js b/examples/scenegraph/snowpack.config.js new file mode 100644 index 0000000000..3974526e07 --- /dev/null +++ b/examples/scenegraph/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/scenegraph", + }, +}; diff --git a/examples/scenegraph/src/index.ts b/examples/scenegraph/src/index.ts index 5aff3839db..5e64a62e5f 100644 --- a/examples/scenegraph/src/index.ts +++ b/examples/scenegraph/src/index.ts @@ -157,9 +157,4 @@ const app = () => { ]; }; -const cancel = start(app); - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(cancel); -} +start(app); diff --git a/examples/scenegraph/src/static.d.ts b/examples/scenegraph/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/scenegraph/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/scenegraph/tsconfig.json b/examples/scenegraph/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/scenegraph/tsconfig.json +++ b/examples/scenegraph/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/scenegraph/webpack.config.js b/examples/scenegraph/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/scenegraph/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/search/package.json b/examples/search/package.json new file mode 100644 index 0000000000..c69484f950 --- /dev/null +++ b/examples/search/package.json @@ -0,0 +1,27 @@ +{ + "name": "search", + "version": "0.0.1", + "description": "TODO", + "repository": "https://github.com/thi-ng/umbrella", + "author": "Karsten Schmidt ", + "license": "Apache-2.0", + "scripts": { + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" + }, + "dependencies": { + "@thi.ng/api": "latest", + "@thi.ng/rstream": "latest", + "@thi.ng/transducers-hdom": "latest" + }, + "browserslist": [ + "last 3 Chrome versions" + ], + "browser": { + "process": false + }, + "thi.ng": { + "skip": true + } +} diff --git a/examples/shader-ast-canvas2d/.gitignore b/examples/shader-ast-canvas2d/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/shader-ast-canvas2d/.gitignore +++ b/examples/shader-ast-canvas2d/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/shader-ast-canvas2d/package.json b/examples/shader-ast-canvas2d/package.json index f143455efc..2493cad8e8 100644 --- a/examples/shader-ast-canvas2d/package.json +++ b/examples/shader-ast-canvas2d/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/shader-ast": "latest", @@ -30,5 +25,8 @@ "thi.ng": { "readme": true, "screenshot": "shader-ast/shader-ast-01.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/shader-ast-canvas2d/index.html b/examples/shader-ast-canvas2d/public/index.html similarity index 90% rename from examples/shader-ast-canvas2d/index.html rename to examples/shader-ast-canvas2d/public/index.html index df698480a0..ca01523ce3 100644 --- a/examples/shader-ast-canvas2d/index.html +++ b/examples/shader-ast-canvas2d/public/index.html @@ -19,6 +19,6 @@
- + diff --git a/examples/shader-ast-canvas2d/snowpack.config.js b/examples/shader-ast-canvas2d/snowpack.config.js new file mode 100644 index 0000000000..71cbf59590 --- /dev/null +++ b/examples/shader-ast-canvas2d/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/shader-ast-canvas2d", + }, +}; diff --git a/examples/shader-ast-canvas2d/src/static.d.ts b/examples/shader-ast-canvas2d/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/shader-ast-canvas2d/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/shader-ast-canvas2d/tsconfig.json b/examples/shader-ast-canvas2d/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/shader-ast-canvas2d/tsconfig.json +++ b/examples/shader-ast-canvas2d/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/shader-ast-evo/.gitignore b/examples/shader-ast-evo/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/shader-ast-evo/.gitignore +++ b/examples/shader-ast-evo/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/shader-ast-evo/package.json b/examples/shader-ast-evo/package.json index 97b20787f7..fd4b41d46f 100644 --- a/examples/shader-ast-evo/package.json +++ b/examples/shader-ast-evo/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/gp": "latest", @@ -41,5 +35,8 @@ "webgl-shadertoy" ], "screenshot": "examples/shader-ast-evo.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/shader-ast-evo/index.html b/examples/shader-ast-evo/public/index.html similarity index 93% rename from examples/shader-ast-evo/index.html rename to examples/shader-ast-evo/public/index.html index f5b3bfb484..db03500b5b 100644 --- a/examples/shader-ast-evo/index.html +++ b/examples/shader-ast-evo/public/index.html @@ -27,6 +27,6 @@ >Source code - + diff --git a/examples/shader-ast-evo/snowpack.config.js b/examples/shader-ast-evo/snowpack.config.js new file mode 100644 index 0000000000..55c83af024 --- /dev/null +++ b/examples/shader-ast-evo/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/shader-ast-evo", + }, +}; diff --git a/examples/shader-ast-evo/src/static.d.ts b/examples/shader-ast-evo/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/shader-ast-evo/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/shader-ast-evo/src/webpack.d.ts b/examples/shader-ast-evo/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/shader-ast-evo/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/shader-ast-evo/tsconfig.json b/examples/shader-ast-evo/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/shader-ast-evo/tsconfig.json +++ b/examples/shader-ast-evo/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/shader-ast-evo/webpack.config.js b/examples/shader-ast-evo/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/shader-ast-evo/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/shader-ast-noise/.gitignore b/examples/shader-ast-noise/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/shader-ast-noise/.gitignore +++ b/examples/shader-ast-noise/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/shader-ast-noise/package.json b/examples/shader-ast-noise/package.json index 451ce72ce7..3c12fe13de 100644 --- a/examples/shader-ast-noise/package.json +++ b/examples/shader-ast-noise/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/shader-ast": "latest", @@ -32,5 +26,8 @@ "thi.ng": { "readme": true, "screenshot": "examples/shader-ast-noise.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/shader-ast-noise/index.html b/examples/shader-ast-noise/public/index.html similarity index 95% rename from examples/shader-ast-noise/index.html rename to examples/shader-ast-noise/public/index.html index ced540c713..740988ba0d 100644 --- a/examples/shader-ast-noise/index.html +++ b/examples/shader-ast-noise/public/index.html @@ -38,6 +38,6 @@ >

- + diff --git a/examples/shader-ast-noise/snowpack.config.js b/examples/shader-ast-noise/snowpack.config.js new file mode 100644 index 0000000000..2e478138a3 --- /dev/null +++ b/examples/shader-ast-noise/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/shader-ast-noise", + }, +}; diff --git a/examples/shader-ast-noise/src/static.d.ts b/examples/shader-ast-noise/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/shader-ast-noise/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/shader-ast-noise/tsconfig.json b/examples/shader-ast-noise/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/shader-ast-noise/tsconfig.json +++ b/examples/shader-ast-noise/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/shader-ast-noise/webpack.config.js b/examples/shader-ast-noise/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/shader-ast-noise/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/shader-ast-raymarch/.gitignore b/examples/shader-ast-raymarch/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/shader-ast-raymarch/.gitignore +++ b/examples/shader-ast-raymarch/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/shader-ast-raymarch/package.json b/examples/shader-ast-raymarch/package.json index fa9a7a8bc2..f57517b8dc 100644 --- a/examples/shader-ast-raymarch/package.json +++ b/examples/shader-ast-raymarch/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/shader-ast": "latest", @@ -32,5 +26,8 @@ "thi.ng": { "readme": true, "screenshot": "shader-ast/shader-ast-raymarch.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/shader-ast-raymarch/index.html b/examples/shader-ast-raymarch/public/index.html similarity index 95% rename from examples/shader-ast-raymarch/index.html rename to examples/shader-ast-raymarch/public/index.html index 62261bd267..3193ab4570 100644 --- a/examples/shader-ast-raymarch/index.html +++ b/examples/shader-ast-raymarch/public/index.html @@ -38,6 +38,6 @@ >

- + diff --git a/examples/shader-ast-raymarch/snowpack.config.js b/examples/shader-ast-raymarch/snowpack.config.js new file mode 100644 index 0000000000..b7f728c807 --- /dev/null +++ b/examples/shader-ast-raymarch/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/shader-ast-raymarch", + }, +}; diff --git a/examples/shader-ast-raymarch/src/static.d.ts b/examples/shader-ast-raymarch/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/shader-ast-raymarch/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/shader-ast-raymarch/tsconfig.json b/examples/shader-ast-raymarch/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/shader-ast-raymarch/tsconfig.json +++ b/examples/shader-ast-raymarch/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/shader-ast-raymarch/webpack.config.js b/examples/shader-ast-raymarch/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/shader-ast-raymarch/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/shader-ast-sdf2d/.gitignore b/examples/shader-ast-sdf2d/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/shader-ast-sdf2d/.gitignore +++ b/examples/shader-ast-sdf2d/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/shader-ast-sdf2d/assets/tex.jpg b/examples/shader-ast-sdf2d/assets/tex.jpg deleted file mode 100644 index d9ee61d1c0..0000000000 Binary files a/examples/shader-ast-sdf2d/assets/tex.jpg and /dev/null differ diff --git a/examples/shader-ast-sdf2d/package.json b/examples/shader-ast-sdf2d/package.json index 8f454243d6..d4a0098763 100644 --- a/examples/shader-ast-sdf2d/package.json +++ b/examples/shader-ast-sdf2d/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/shader-ast": "latest", @@ -32,5 +26,8 @@ "thi.ng": { "readme": true, "screenshot": "examples/shader-ast-sdf2d.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/shader-ast-sdf2d/index.html b/examples/shader-ast-sdf2d/public/index.html similarity index 95% rename from examples/shader-ast-sdf2d/index.html rename to examples/shader-ast-sdf2d/public/index.html index 5c62c6bbc0..6862ca53fe 100644 --- a/examples/shader-ast-sdf2d/index.html +++ b/examples/shader-ast-sdf2d/public/index.html @@ -38,6 +38,6 @@ >

- + diff --git a/examples/shader-ast-sdf2d/snowpack.config.js b/examples/shader-ast-sdf2d/snowpack.config.js new file mode 100644 index 0000000000..d14c02ffa9 --- /dev/null +++ b/examples/shader-ast-sdf2d/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/shader-ast-sdf2d", + }, +}; diff --git a/examples/shader-ast-sdf2d/src/static.d.ts b/examples/shader-ast-sdf2d/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/shader-ast-sdf2d/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/shader-ast-sdf2d/tsconfig.json b/examples/shader-ast-sdf2d/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/shader-ast-sdf2d/tsconfig.json +++ b/examples/shader-ast-sdf2d/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/shader-ast-sdf2d/webpack.config.js b/examples/shader-ast-sdf2d/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/shader-ast-sdf2d/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/shader-ast-tunnel/.gitignore b/examples/shader-ast-tunnel/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/shader-ast-tunnel/.gitignore +++ b/examples/shader-ast-tunnel/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/shader-ast-tunnel/assets/tex.jpg b/examples/shader-ast-tunnel/assets/tex.jpg deleted file mode 100644 index d9ee61d1c0..0000000000 Binary files a/examples/shader-ast-tunnel/assets/tex.jpg and /dev/null differ diff --git a/examples/shader-ast-tunnel/package.json b/examples/shader-ast-tunnel/package.json index 1642ab3fb6..479077dc25 100644 --- a/examples/shader-ast-tunnel/package.json +++ b/examples/shader-ast-tunnel/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/binary": "latest", @@ -39,5 +33,8 @@ "webgl" ], "screenshot": "examples/shader-ast-tunnel.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/shader-ast-tunnel/index.html b/examples/shader-ast-tunnel/public/index.html similarity index 95% rename from examples/shader-ast-tunnel/index.html rename to examples/shader-ast-tunnel/public/index.html index 4d4421654e..9080f1d26f 100644 --- a/examples/shader-ast-tunnel/index.html +++ b/examples/shader-ast-tunnel/public/index.html @@ -38,6 +38,6 @@ >

- + diff --git a/examples/shader-ast-tunnel/snowpack.config.js b/examples/shader-ast-tunnel/snowpack.config.js new file mode 100644 index 0000000000..fe00fecc47 --- /dev/null +++ b/examples/shader-ast-tunnel/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/shader-ast-tunnel", + }, +}; diff --git a/examples/shader-ast-tunnel/src/index.ts b/examples/shader-ast-tunnel/src/index.ts index dad5993b05..346039f5d0 100644 --- a/examples/shader-ast-tunnel/src/index.ts +++ b/examples/shader-ast-tunnel/src/index.ts @@ -40,7 +40,7 @@ import { TextureFilter, TextureRepeat, } from "@thi.ng/webgl"; -import TEX_URL from "../assets/tex.jpg"; +import TEX_URL from "./tex.jpg"; // set URL hash to "#2d" to enable JS Canvas2D version const JS_MODE = location.hash.indexOf("2d") >= 0; diff --git a/examples/shader-ast-tunnel/src/static.d.ts b/examples/shader-ast-tunnel/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/shader-ast-tunnel/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/shader-ast-raymarch/assets/tex.jpg b/examples/shader-ast-tunnel/src/tex.jpg similarity index 100% rename from examples/shader-ast-raymarch/assets/tex.jpg rename to examples/shader-ast-tunnel/src/tex.jpg diff --git a/examples/shader-ast-tunnel/src/webpack.d.ts b/examples/shader-ast-tunnel/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/shader-ast-tunnel/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/shader-ast-tunnel/tsconfig.json b/examples/shader-ast-tunnel/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/shader-ast-tunnel/tsconfig.json +++ b/examples/shader-ast-tunnel/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/shader-ast-tunnel/webpack.config.js b/examples/shader-ast-tunnel/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/shader-ast-tunnel/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/shader-graph/.gitignore b/examples/shader-graph/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/shader-graph/.gitignore +++ b/examples/shader-graph/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/shader-graph/package.json b/examples/shader-graph/package.json index 59c31c5677..eaf36b6330 100644 --- a/examples/shader-graph/package.json +++ b/examples/shader-graph/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -43,5 +37,8 @@ "webgl" ], "screenshot": "examples/shader-graph.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/shader-graph/index.html b/examples/shader-graph/public/index.html similarity index 92% rename from examples/shader-graph/index.html rename to examples/shader-graph/public/index.html index dc9032c448..0357011a0e 100644 --- a/examples/shader-graph/index.html +++ b/examples/shader-graph/public/index.html @@ -25,6 +25,6 @@ >Source code - + diff --git a/examples/shader-graph/snowpack.config.js b/examples/shader-graph/snowpack.config.js new file mode 100644 index 0000000000..88f67b623b --- /dev/null +++ b/examples/shader-graph/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/shader-graph", + }, +}; diff --git a/examples/shader-graph/src/api.ts b/examples/shader-graph/src/api.ts index d1f7cd1d06..63e960fdf3 100644 --- a/examples/shader-graph/src/api.ts +++ b/examples/shader-graph/src/api.ts @@ -1,6 +1,6 @@ -import { Fn4 } from "@thi.ng/api"; -import { Node2D } from "@thi.ng/scenegraph"; -import { +import type { Fn4 } from "@thi.ng/api"; +import type { Node2D } from "@thi.ng/scenegraph"; +import type { FloatSym, Func, Sampler2DSym, @@ -8,8 +8,8 @@ import { Vec2Sym, Vec4Sym, } from "@thi.ng/shader-ast"; -import { GLSLTarget } from "@thi.ng/shader-ast-glsl"; -import { ModelSpec, Texture } from "@thi.ng/webgl"; +import type { GLSLTarget } from "@thi.ng/shader-ast-glsl"; +import type { ModelSpec, Texture } from "@thi.ng/webgl"; export interface AppCtx { /** diff --git a/examples/shader-graph/src/index.ts b/examples/shader-graph/src/index.ts index 1da9538105..adce8c9d11 100644 --- a/examples/shader-graph/src/index.ts +++ b/examples/shader-graph/src/index.ts @@ -32,7 +32,7 @@ import { glCanvas, GLMat4, } from "@thi.ng/webgl"; -import { AppCtx } from "./api"; +import type { AppCtx } from "./api"; import { OpNode } from "./opnode"; // setLogger(new ConsoleLogger("webgl", LogLevel.DEBUG)); diff --git a/examples/shader-graph/src/opnode.ts b/examples/shader-graph/src/opnode.ts index 0d4e32edcf..567b998636 100644 --- a/examples/shader-graph/src/opnode.ts +++ b/examples/shader-graph/src/opnode.ts @@ -1,4 +1,4 @@ -import { IObjectOf } from "@thi.ng/api"; +import type { IObjectOf } from "@thi.ng/api"; import { mat23to44 } from "@thi.ng/matrices"; import { defFBO, @@ -14,7 +14,7 @@ import { Texture, TextureFilter, } from "@thi.ng/webgl"; -import { AppCtx, OpSpec, UserUniforms } from "./api"; +import type { AppCtx, OpSpec, UserUniforms } from "./api"; export class OpNode { tex: Texture; diff --git a/examples/shader-graph/src/static.d.ts b/examples/shader-graph/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/shader-graph/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/shader-graph/src/webpack.d.ts b/examples/shader-graph/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/shader-graph/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/shader-graph/tsconfig.json b/examples/shader-graph/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/shader-graph/tsconfig.json +++ b/examples/shader-graph/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/shader-graph/webpack.config.js b/examples/shader-graph/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/shader-graph/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/soa-ecs/.gitignore b/examples/soa-ecs/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/soa-ecs/.gitignore +++ b/examples/soa-ecs/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/soa-ecs/package.json b/examples/soa-ecs/package.json index 0cc93ae962..124c699ff2 100644 --- a/examples/soa-ecs/package.json +++ b/examples/soa-ecs/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/adapt-dpi": "latest", @@ -32,7 +26,8 @@ "last 3 Chrome versions" ], "browser": { - "process": false + "process": false, + "setTimeout": false }, "thi.ng": { "readme": [ @@ -47,5 +42,8 @@ "webgl" ], "screenshot": "examples/soa-ecs-100k.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/soa-ecs/index.html b/examples/soa-ecs/public/index.html similarity index 93% rename from examples/soa-ecs/index.html rename to examples/soa-ecs/public/index.html index 4febbffc64..43ed6b95cb 100644 --- a/examples/soa-ecs/index.html +++ b/examples/soa-ecs/public/index.html @@ -27,6 +27,6 @@ >Source code --> - + diff --git a/examples/soa-ecs/snowpack.config.js b/examples/soa-ecs/snowpack.config.js new file mode 100644 index 0000000000..765eced3f5 --- /dev/null +++ b/examples/soa-ecs/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/soa-ecs", + }, +}; diff --git a/examples/soa-ecs/src/static.d.ts b/examples/soa-ecs/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/soa-ecs/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/soa-ecs/src/webpack.d.ts b/examples/soa-ecs/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/soa-ecs/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/soa-ecs/tsconfig.json b/examples/soa-ecs/tsconfig.json index 4fee6fa2b0..48d558b4f8 100644 --- a/examples/soa-ecs/tsconfig.json +++ b/examples/soa-ecs/tsconfig.json @@ -1,11 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true, - "noUnusedLocals": false, - "noUnusedParameters": false - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/soa-ecs/webpack.config.js b/examples/soa-ecs/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/soa-ecs/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/stratified-grid/.gitignore b/examples/stratified-grid/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/stratified-grid/.gitignore +++ b/examples/stratified-grid/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/stratified-grid/package.json b/examples/stratified-grid/package.json index 68feba0d78..ee1e299474 100644 --- a/examples/stratified-grid/package.json +++ b/examples/stratified-grid/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/geom": "latest", @@ -35,5 +29,8 @@ "poisson" ], "screenshot": "poisson/stratified-grid.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/stratified-grid/index.html b/examples/stratified-grid/public/index.html similarity index 92% rename from examples/stratified-grid/index.html rename to examples/stratified-grid/public/index.html index 2fc94d56e1..c9f59c2335 100644 --- a/examples/stratified-grid/index.html +++ b/examples/stratified-grid/public/index.html @@ -26,6 +26,6 @@ >Source code - + diff --git a/examples/stratified-grid/snowpack.config.js b/examples/stratified-grid/snowpack.config.js new file mode 100644 index 0000000000..318ed0a9ee --- /dev/null +++ b/examples/stratified-grid/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/stratified-grid", + }, +}; diff --git a/examples/stratified-grid/src/static.d.ts b/examples/stratified-grid/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/stratified-grid/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/stratified-grid/src/webpack.d.ts b/examples/stratified-grid/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/stratified-grid/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/stratified-grid/tsconfig.json b/examples/stratified-grid/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/stratified-grid/tsconfig.json +++ b/examples/stratified-grid/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/stratified-grid/webpack.config.js b/examples/stratified-grid/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/stratified-grid/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/svg-barchart/.gitignore b/examples/svg-barchart/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/svg-barchart/.gitignore +++ b/examples/svg-barchart/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/svg-barchart/package.json b/examples/svg-barchart/package.json index ce54409e5a..d2c5fd4a6b 100644 --- a/examples/svg-barchart/package.json +++ b/examples/svg-barchart/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest", @@ -29,5 +24,8 @@ "thi.ng": { "readme": true, "screenshot": "examples/svg-barchart.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/svg-barchart/index.html b/examples/svg-barchart/public/index.html similarity index 90% rename from examples/svg-barchart/index.html rename to examples/svg-barchart/public/index.html index 3f7d31415b..4e0791247a 100644 --- a/examples/svg-barchart/index.html +++ b/examples/svg-barchart/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/svg-barchart/snowpack.config.js b/examples/svg-barchart/snowpack.config.js new file mode 100644 index 0000000000..5466adb6ad --- /dev/null +++ b/examples/svg-barchart/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/svg-barchart", + }, +}; diff --git a/examples/svg-barchart/src/index.ts b/examples/svg-barchart/src/index.ts index cd27828409..a4fb01b923 100644 --- a/examples/svg-barchart/src/index.ts +++ b/examples/svg-barchart/src/index.ts @@ -106,8 +106,3 @@ renderOnce([ map((year) => [year, Math.random() * 100], range(1980, 2020, 2)), ], ]); - -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && hot.dispose(() => clearDOM(document.getElementById("app")!)); -} diff --git a/examples/svg-barchart/src/static.d.ts b/examples/svg-barchart/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/svg-barchart/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/svg-barchart/tsconfig.json b/examples/svg-barchart/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/svg-barchart/tsconfig.json +++ b/examples/svg-barchart/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/svg-particles/.gitignore b/examples/svg-particles/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/svg-particles/.gitignore +++ b/examples/svg-particles/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/svg-particles/package.json b/examples/svg-particles/package.json index 19cd75d4cb..c907f23b20 100644 --- a/examples/svg-particles/package.json +++ b/examples/svg-particles/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest", @@ -26,5 +21,8 @@ "browser": { "process": false }, - "thi.ng": {} + "thi.ng": {}, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" + } } diff --git a/examples/svg-particles/index.html b/examples/svg-particles/public/index.html similarity index 93% rename from examples/svg-particles/index.html rename to examples/svg-particles/public/index.html index 47d2c1fb20..d930089f57 100644 --- a/examples/svg-particles/index.html +++ b/examples/svg-particles/public/index.html @@ -38,6 +38,6 @@ >@thi.ng/hdom. - + diff --git a/examples/svg-particles/snowpack.config.js b/examples/svg-particles/snowpack.config.js new file mode 100644 index 0000000000..e46b4d2b07 --- /dev/null +++ b/examples/svg-particles/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/svg-particles", + }, +}; diff --git a/examples/svg-particles/src/static.d.ts b/examples/svg-particles/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/svg-particles/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/svg-particles/tsconfig.json b/examples/svg-particles/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/svg-particles/tsconfig.json +++ b/examples/svg-particles/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/svg-waveform/.gitignore b/examples/svg-waveform/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/svg-waveform/.gitignore +++ b/examples/svg-waveform/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/svg-waveform/package.json b/examples/svg-waveform/package.json index 6d0f2103a1..1f2af98afb 100644 --- a/examples/svg-waveform/package.json +++ b/examples/svg-waveform/package.json @@ -6,10 +6,9 @@ "author": "Karsten Schmidt", "license": "MIT", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -20,12 +19,6 @@ "@thi.ng/interceptors": "latest", "@thi.ng/transducers": "latest" }, - "devDependencies": { - "@types/node": "^13.7.4", - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" - }, "browserslist": [ "last 3 Chrome versions" ], @@ -41,5 +34,8 @@ "transducers" ], "screenshot": "examples/svg-waveform.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/svg-waveform/index.html b/examples/svg-waveform/public/index.html similarity index 92% rename from examples/svg-waveform/index.html rename to examples/svg-waveform/public/index.html index 7a4252a809..a39c39a0ec 100644 --- a/examples/svg-waveform/index.html +++ b/examples/svg-waveform/public/index.html @@ -28,6 +28,6 @@
- + diff --git a/examples/svg-waveform/snowpack.config.js b/examples/svg-waveform/snowpack.config.js new file mode 100644 index 0000000000..9a9f18026f --- /dev/null +++ b/examples/svg-waveform/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/svg-waveform", + }, +}; diff --git a/examples/svg-waveform/src/api.ts b/examples/svg-waveform/src/api.ts index 5aa4dd7043..cc4ae69b57 100644 --- a/examples/svg-waveform/src/api.ts +++ b/examples/svg-waveform/src/api.ts @@ -1,6 +1,6 @@ import type { Fn, IObjectOf, Path } from "@thi.ng/api"; import type { IView } from "@thi.ng/atom"; -import { EffectDef, EventBus, EventDef } from "@thi.ng/interceptors"; +import type { EffectDef, EventBus, EventDef } from "@thi.ng/interceptors"; /** * Function signature for main app components. diff --git a/examples/svg-waveform/src/config.ts b/examples/svg-waveform/src/config.ts index 31ffb264f1..2de845b3a2 100644 --- a/examples/svg-waveform/src/config.ts +++ b/examples/svg-waveform/src/config.ts @@ -1,5 +1,5 @@ import { ensureParamRange, snapshot, valueSetter } from "@thi.ng/interceptors"; -import { AppConfig } from "./api"; +import type { AppConfig } from "./api"; import { main } from "./components/main"; import { SLIDERS } from "./sliders"; // import * as ev from "./events"; diff --git a/examples/svg-waveform/src/effects.ts b/examples/svg-waveform/src/effects.ts index 65dd20a07c..7b4efbbe9a 100644 --- a/examples/svg-waveform/src/effects.ts +++ b/examples/svg-waveform/src/effects.ts @@ -7,3 +7,5 @@ * Effect description */ // export const FOO = "foo"; + +export {}; diff --git a/examples/svg-waveform/src/index.ts b/examples/svg-waveform/src/index.ts index d72f64a3bc..700546a668 100644 --- a/examples/svg-waveform/src/index.ts +++ b/examples/svg-waveform/src/index.ts @@ -1,10 +1,8 @@ +import { exposeGlobal } from "@thi.ng/api"; import { App } from "./app"; import { CONFIG } from "./config"; -// export app to global var in dev mode -// (for interaction via browser dev tools) -if (process.env.NODE_ENV == "development") { - ((window)["APP"] = new App(CONFIG)).start(); -} else { - new App(CONFIG).start(); -} +const APP = new App(CONFIG); +exposeGlobal("APP", APP); + +APP.start(); diff --git a/examples/svg-waveform/src/static.d.ts b/examples/svg-waveform/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/svg-waveform/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/svg-waveform/tsconfig.json b/examples/svg-waveform/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/svg-waveform/tsconfig.json +++ b/examples/svg-waveform/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/svg-waveform/webpack.config.js b/examples/svg-waveform/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/svg-waveform/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/talk-slides/.gitignore b/examples/talk-slides/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/talk-slides/.gitignore +++ b/examples/talk-slides/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/talk-slides/package.json b/examples/talk-slides/package.json index 4b6f273041..5b55cf367b 100644 --- a/examples/talk-slides/package.json +++ b/examples/talk-slides/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/hdom": "latest", @@ -37,5 +31,8 @@ "transducers-hdom" ], "screenshot": "examples/talk-slides.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/talk-slides/index.html b/examples/talk-slides/public/index.html similarity index 94% rename from examples/talk-slides/index.html rename to examples/talk-slides/public/index.html index 494f18629f..33d9a951b4 100644 --- a/examples/talk-slides/index.html +++ b/examples/talk-slides/public/index.html @@ -42,6 +42,6 @@
- + diff --git a/examples/talk-slides/snowpack.config.js b/examples/talk-slides/snowpack.config.js new file mode 100644 index 0000000000..ed8dbf5a41 --- /dev/null +++ b/examples/talk-slides/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/talk-slides", + }, +}; diff --git a/examples/talk-slides/src/index.ts b/examples/talk-slides/src/index.ts index a521b91653..06b41635a4 100644 --- a/examples/talk-slides/src/index.ts +++ b/examples/talk-slides/src/index.ts @@ -72,11 +72,11 @@ if (INTERACTIVE) { renderOnce(() => [printApp, SLIDES], { ctx }); } -if (process.env.NODE_ENV !== "production") { - const hot = (module).hot; - hot && - hot.dispose(() => { - slideCTRL.done(); - main.done(); - }); -} +// if (process.env.NODE_ENV !== "production") { +// const hot = (module).hot; +// hot && +// hot.dispose(() => { +// slideCTRL.done(); +// main.done(); +// }); +// } diff --git a/examples/talk-slides/src/static.d.ts b/examples/talk-slides/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/talk-slides/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/talk-slides/tsconfig.json b/examples/talk-slides/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/talk-slides/tsconfig.json +++ b/examples/talk-slides/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/talk-slides/webpack.config.js b/examples/talk-slides/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/talk-slides/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/texgen/src/webpack.d.ts b/examples/texgen/src/webpack.d.ts deleted file mode 100644 index 6e39ca7616..0000000000 --- a/examples/texgen/src/webpack.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; diff --git a/examples/text-canvas/.gitignore b/examples/text-canvas/.gitignore index 5d62218c54..e228563433 100644 --- a/examples/text-canvas/.gitignore +++ b/examples/text-canvas/.gitignore @@ -1,8 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js -*.map -!src/*.d.ts -!*.config.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/text-canvas/package.json b/examples/text-canvas/package.json index f45905ccf8..6a1524fc96 100644 --- a/examples/text-canvas/package.json +++ b/examples/text-canvas/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/dsp": "latest", @@ -32,5 +26,8 @@ "thi.ng": { "readme": true, "screenshot": "examples/text-canvas.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/text-canvas/index.html b/examples/text-canvas/public/index.html similarity index 94% rename from examples/text-canvas/index.html rename to examples/text-canvas/public/index.html index f410d9f266..ac70022eb8 100644 --- a/examples/text-canvas/index.html +++ b/examples/text-canvas/public/index.html @@ -37,6 +37,6 @@ >Source code - + diff --git a/examples/text-canvas/snowpack.config.js b/examples/text-canvas/snowpack.config.js new file mode 100644 index 0000000000..dea95ded68 --- /dev/null +++ b/examples/text-canvas/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/text-canvas", + }, +}; diff --git a/examples/text-canvas/src/static.d.ts b/examples/text-canvas/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/text-canvas/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/text-canvas/src/webpack.d.ts b/examples/text-canvas/src/webpack.d.ts deleted file mode 100644 index 2966449833..0000000000 --- a/examples/text-canvas/src/webpack.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.jpg"; -declare module "*.png"; -declare module "*.svg"; -declare module "*.json"; diff --git a/examples/text-canvas/tsconfig.json b/examples/text-canvas/tsconfig.json index 742fca52a4..48d558b4f8 100644 --- a/examples/text-canvas/tsconfig.json +++ b/examples/text-canvas/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/text-canvas/webpack.config.js b/examples/text-canvas/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/text-canvas/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/todo-list/.gitignore b/examples/todo-list/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/todo-list/.gitignore +++ b/examples/todo-list/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/todo-list/package.json b/examples/todo-list/package.json index 74a270599c..839206a090 100644 --- a/examples/todo-list/package.json +++ b/examples/todo-list/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -35,5 +30,8 @@ "paths" ], "screenshot": "examples/todo-list.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/todo-list/index.html b/examples/todo-list/public/index.html similarity index 96% rename from examples/todo-list/index.html rename to examples/todo-list/public/index.html index 2c7b4dfcd1..0b09559d4b 100644 --- a/examples/todo-list/index.html +++ b/examples/todo-list/public/index.html @@ -78,6 +78,6 @@
- + diff --git a/examples/todo-list/snowpack.config.js b/examples/todo-list/snowpack.config.js new file mode 100644 index 0000000000..f4fbd8ee77 --- /dev/null +++ b/examples/todo-list/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/todo-list", + }, +}; diff --git a/examples/todo-list/src/static.d.ts b/examples/todo-list/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/todo-list/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/todo-list/tsconfig.json b/examples/todo-list/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/todo-list/tsconfig.json +++ b/examples/todo-list/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/transducers-hdom/.gitignore b/examples/transducers-hdom/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/transducers-hdom/.gitignore +++ b/examples/transducers-hdom/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/transducers-hdom/package.json b/examples/transducers-hdom/package.json index 0264cbda9d..ae025221cc 100644 --- a/examples/transducers-hdom/package.json +++ b/examples/transducers-hdom/package.json @@ -6,14 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/rstream": "latest", @@ -31,5 +26,8 @@ "rstream", "transducers-hdom" ] + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/transducers-hdom/index.html b/examples/transducers-hdom/public/index.html similarity index 90% rename from examples/transducers-hdom/index.html rename to examples/transducers-hdom/public/index.html index 1a73e1ed7f..342159fa9a 100644 --- a/examples/transducers-hdom/index.html +++ b/examples/transducers-hdom/public/index.html @@ -20,6 +20,6 @@
- + diff --git a/examples/transducers-hdom/snowpack.config.js b/examples/transducers-hdom/snowpack.config.js new file mode 100644 index 0000000000..cf15009c8a --- /dev/null +++ b/examples/transducers-hdom/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/transducers-hdom", + }, +}; diff --git a/examples/transducers-hdom/src/static.d.ts b/examples/transducers-hdom/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/transducers-hdom/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/transducers-hdom/tsconfig.json b/examples/transducers-hdom/tsconfig.json index 41f786f571..48d558b4f8 100644 --- a/examples/transducers-hdom/tsconfig.json +++ b/examples/transducers-hdom/tsconfig.json @@ -1,10 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/triple-query/.gitignore b/examples/triple-query/.gitignore index 0c5abcab62..e228563433 100644 --- a/examples/triple-query/.gitignore +++ b/examples/triple-query/.gitignore @@ -1,5 +1,6 @@ -.cache -out +build +dev node_modules yarn.lock -*.js +!snowpack.config.js +!*.d.ts \ No newline at end of file diff --git a/examples/triple-query/package.json b/examples/triple-query/package.json index 9478830bdf..a8b0069be1 100644 --- a/examples/triple-query/package.json +++ b/examples/triple-query/package.json @@ -6,15 +6,9 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "clean": "rm -rf .cache build out", - "build": "yarn clean && parcel build index.html -d out --no-source-maps --no-cache --experimental-scope-hoisting --detailed-report --public-url ./", - "build:webpack": "../../node_modules/.bin/webpack --mode production", - "start": "parcel index.html -p 8080 --open --no-cache" - }, - "devDependencies": { - "parcel-bundler": "^1.12.4", - "terser": "^5.2.1", - "typescript": "^4.1.2" + "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", + "start": "../../node_modules/.bin/snowpack dev", + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/api": "latest", @@ -45,5 +39,8 @@ "transducers" ], "screenshot": "examples/triple-query.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/triple-query/index.html b/examples/triple-query/public/index.html similarity index 92% rename from examples/triple-query/index.html rename to examples/triple-query/public/index.html index 317ad8c2c6..08db3aec4b 100644 --- a/examples/triple-query/index.html +++ b/examples/triple-query/public/index.html @@ -28,6 +28,6 @@
- + diff --git a/examples/triple-query/snowpack.config.js b/examples/triple-query/snowpack.config.js new file mode 100644 index 0000000000..800d272938 --- /dev/null +++ b/examples/triple-query/snowpack.config.js @@ -0,0 +1,29 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ +module.exports = { + mount: { + public: "/", + src: "/_dist_", + }, + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], + installOptions: { + installTypes: true, + }, + buildOptions: { + baseUrl: "/triple-query", + }, +}; diff --git a/examples/triple-query/src/api.ts b/examples/triple-query/src/api.ts index 00bab12138..dc77a28de9 100644 --- a/examples/triple-query/src/api.ts +++ b/examples/triple-query/src/api.ts @@ -1,12 +1,12 @@ import type { Fn, IObjectOf, Path } from "@thi.ng/api"; import type { IView } from "@thi.ng/atom"; -import { +import type { EffectDef, EventBus, EventDef, InterceptorContext, } from "@thi.ng/interceptors"; -import { QuerySpec, TripleStore } from "@thi.ng/rstream-query"; +import type { QuerySpec, TripleStore } from "@thi.ng/rstream-query"; /** * Function signature for main app components. diff --git a/examples/triple-query/src/handlers.ts b/examples/triple-query/src/handlers.ts index d41a177526..e931d5ec5b 100644 --- a/examples/triple-query/src/handlers.ts +++ b/examples/triple-query/src/handlers.ts @@ -55,7 +55,7 @@ export const EVENTS: IObjectOf = { [ev.SET_PAGE]: [valueSetter("page"), dispatchNow([ev.UPDATE_PAGE])], - [ev.UPDATE_PAGE]: (state, _, __, ctx: AppInterceptorContext) => { + [ev.UPDATE_PAGE]: (state, _, __, ctx) => { const maxPage = Math.floor( Math.max(0, ctx.store.triples.length - 1) / PAGE_LEN ); @@ -71,7 +71,7 @@ export const EVENTS: IObjectOf = { [ ...iterator( comp( - page(curr, PAGE_LEN), + page(curr, PAGE_LEN), mapIndexed( (i, x: Triple) => [i + 1, ...x], curr * PAGE_LEN @@ -89,11 +89,11 @@ export const EVENTS: IObjectOf = { }; export const EFFECTS: IObjectOf = { - [fx.ADD_TRIPLE]: (triple: Triple, bus, ctx: AppInterceptorContext) => { + [fx.ADD_TRIPLE]: (triple: Triple, bus, ctx) => { ctx.store.add(triple); bus.dispatch([ev.UPDATE_PAGE]); }, - [fx.REMOVE_TRIPLE]: (triple: Triple, bus, ctx: AppInterceptorContext) => { + [fx.REMOVE_TRIPLE]: (triple: Triple, bus, ctx) => { ctx.store.delete(triple); bus.dispatch([ev.UPDATE_PAGE]); }, diff --git a/examples/triple-query/src/index.ts b/examples/triple-query/src/index.ts index d72f64a3bc..700546a668 100644 --- a/examples/triple-query/src/index.ts +++ b/examples/triple-query/src/index.ts @@ -1,10 +1,8 @@ +import { exposeGlobal } from "@thi.ng/api"; import { App } from "./app"; import { CONFIG } from "./config"; -// export app to global var in dev mode -// (for interaction via browser dev tools) -if (process.env.NODE_ENV == "development") { - ((window)["APP"] = new App(CONFIG)).start(); -} else { - new App(CONFIG).start(); -} +const APP = new App(CONFIG); +exposeGlobal("APP", APP); + +APP.start(); diff --git a/examples/triple-query/src/static.d.ts b/examples/triple-query/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/triple-query/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/triple-query/tsconfig.json b/examples/triple-query/tsconfig.json index 0f5da53283..48d558b4f8 100644 --- a/examples/triple-query/tsconfig.json +++ b/examples/triple-query/tsconfig.json @@ -1,11 +1,8 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", + "include": ["src"], "compilerOptions": { - "outDir": ".", - "module": "es2020", - "target": "es2017", - "sourceMap": true, - "strictFunctionTypes": false - }, - "include": ["./src/**/*.ts"] + "baseUrl": "./", + "paths": { "*": ["web_modules/.types/*"] } + } } diff --git a/examples/triple-query/webpack.config.js b/examples/triple-query/webpack.config.js deleted file mode 100644 index bf16021356..0000000000 --- a/examples/triple-query/webpack.config.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - entry: "./src/index.ts", - output: { - filename: "bundle.[hash].js", - path: __dirname + "/out" - }, - resolve: { - extensions: [".ts", ".js"] - }, - module: { - rules: [ - { - test: /\.(png|jpg|gif)$/, - loader: "file-loader", - options: { name: "[path][hash].[ext]" } - }, - { test: /\.ts$/, use: "ts-loader" } - ] - }, - node: { - process: false - } -}; diff --git a/examples/tsconfig.json b/examples/tsconfig.json new file mode 100644 index 0000000000..ccebab392a --- /dev/null +++ b/examples/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "esnext", + "target": "esnext", + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "importsNotUsedAsValues": "error", + "isolatedModules": true, + "noEmit": true, + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "useDefineForClassFields": true, + "experimentalDecorators": true + } +} diff --git a/examples/webgl-cube/package.json b/examples/webgl-cube/package.json index 325c0f929b..5f09b4dff6 100644 --- a/examples/webgl-cube/package.json +++ b/examples/webgl-cube/package.json @@ -34,5 +34,8 @@ "webgl" ], "screenshot": "examples/webgl-cube.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/webgl-cube/snowpack.config.js b/examples/webgl-cube/snowpack.config.js index 31e0774caa..80a069a0a7 100644 --- a/examples/webgl-cube/snowpack.config.js +++ b/examples/webgl-cube/snowpack.config.js @@ -4,7 +4,22 @@ module.exports = { public: "/", src: "/_dist_", }, - plugins: ["@snowpack/plugin-typescript", "@snowpack/plugin-webpack"], + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], installOptions: { installTypes: true, }, diff --git a/examples/webgl-cube/src/static.d.ts b/examples/webgl-cube/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/webgl-cube/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/webgl-cubemap/package.json b/examples/webgl-cubemap/package.json index f8c6cb2070..7b72b4c5f1 100644 --- a/examples/webgl-cubemap/package.json +++ b/examples/webgl-cubemap/package.json @@ -35,5 +35,8 @@ "webgl" ], "screenshot": "examples/webgl-cubemap.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/webgl-cubemap/snowpack.config.js b/examples/webgl-cubemap/snowpack.config.js index 3e644d8484..272173c640 100644 --- a/examples/webgl-cubemap/snowpack.config.js +++ b/examples/webgl-cubemap/snowpack.config.js @@ -4,7 +4,22 @@ module.exports = { public: "/", src: "/_dist_", }, - plugins: ["@snowpack/plugin-typescript", "@snowpack/plugin-webpack"], + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], installOptions: { installTypes: true, }, diff --git a/examples/webgl-cubemap/src/static.d.ts b/examples/webgl-cubemap/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/webgl-cubemap/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/webgl-grid/package.json b/examples/webgl-grid/package.json index c72f327d7e..85c5a3d052 100644 --- a/examples/webgl-grid/package.json +++ b/examples/webgl-grid/package.json @@ -37,5 +37,8 @@ "webgl" ], "screenshot": "examples/webgl-grid.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/webgl-grid/snowpack.config.js b/examples/webgl-grid/snowpack.config.js index e7696d4f54..6bdf2f25a1 100644 --- a/examples/webgl-grid/snowpack.config.js +++ b/examples/webgl-grid/snowpack.config.js @@ -4,7 +4,22 @@ module.exports = { public: "/", src: "/_dist_", }, - plugins: ["@snowpack/plugin-typescript", "@snowpack/plugin-webpack"], + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], installOptions: { installTypes: true, }, diff --git a/examples/webgl-grid/src/static.d.ts b/examples/webgl-grid/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/webgl-grid/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/webgl-msdf/.gitignore b/examples/webgl-msdf/.gitignore index 211b157174..e228563433 100644 --- a/examples/webgl-msdf/.gitignore +++ b/examples/webgl-msdf/.gitignore @@ -3,4 +3,4 @@ dev node_modules yarn.lock !snowpack.config.js -!*.d.ts +!*.d.ts \ No newline at end of file diff --git a/examples/webgl-msdf/package.json b/examples/webgl-msdf/package.json index a0bd359110..5daed837d1 100644 --- a/examples/webgl-msdf/package.json +++ b/examples/webgl-msdf/package.json @@ -44,5 +44,8 @@ "webgl-msdf" ], "screenshot": "examples/webgl-msdf.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/webgl-msdf/snowpack.config.js b/examples/webgl-msdf/snowpack.config.js index 8041c61a60..c1f0980412 100644 --- a/examples/webgl-msdf/snowpack.config.js +++ b/examples/webgl-msdf/snowpack.config.js @@ -4,7 +4,22 @@ module.exports = { public: "/", src: "/_dist_", }, - plugins: ["@snowpack/plugin-typescript", "@snowpack/plugin-webpack"], + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], installOptions: { installTypes: true, }, diff --git a/examples/webgl-multipass/package.json b/examples/webgl-multipass/package.json index ab9ee2d11d..118b9a94df 100644 --- a/examples/webgl-multipass/package.json +++ b/examples/webgl-multipass/package.json @@ -24,5 +24,8 @@ }, "thi.ng": { "readme": true + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/webgl-multipass/snowpack.config.js b/examples/webgl-multipass/snowpack.config.js index fd03c38f75..6abf0d57a3 100644 --- a/examples/webgl-multipass/snowpack.config.js +++ b/examples/webgl-multipass/snowpack.config.js @@ -4,7 +4,22 @@ module.exports = { public: "/", src: "/_dist_", }, - plugins: ["@snowpack/plugin-typescript", "@snowpack/plugin-webpack"], + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], installOptions: { installTypes: true, }, diff --git a/examples/webgl-multipass/src/static.d.ts b/examples/webgl-multipass/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/webgl-multipass/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/webgl-shadertoy/package.json b/examples/webgl-shadertoy/package.json index 9d30ef74c9..78a539290a 100644 --- a/examples/webgl-shadertoy/package.json +++ b/examples/webgl-shadertoy/package.json @@ -25,5 +25,8 @@ "thi.ng": { "readme": true, "screenshot": "examples/webgl-shadertoy.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/webgl-shadertoy/snowpack.config.js b/examples/webgl-shadertoy/snowpack.config.js index a67e8cc197..4b22fb5c72 100644 --- a/examples/webgl-shadertoy/snowpack.config.js +++ b/examples/webgl-shadertoy/snowpack.config.js @@ -4,7 +4,22 @@ module.exports = { public: "/", src: "/_dist_", }, - plugins: ["@snowpack/plugin-typescript", "@snowpack/plugin-webpack"], + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], installOptions: { installTypes: true, }, diff --git a/examples/webgl-shadertoy/src/static.d.ts b/examples/webgl-shadertoy/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/webgl-shadertoy/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/webgl-ssao/package.json b/examples/webgl-ssao/package.json index 7963357a55..8550a7b208 100644 --- a/examples/webgl-ssao/package.json +++ b/examples/webgl-ssao/package.json @@ -38,5 +38,8 @@ "webgl" ], "screenshot": "examples/webgl-ssao.jpg" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/webgl-ssao/snowpack.config.js b/examples/webgl-ssao/snowpack.config.js index fcc61f086d..062270df56 100644 --- a/examples/webgl-ssao/snowpack.config.js +++ b/examples/webgl-ssao/snowpack.config.js @@ -4,7 +4,22 @@ module.exports = { public: "/", src: "/_dist_", }, - plugins: ["@snowpack/plugin-typescript", "@snowpack/plugin-webpack"], + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], installOptions: { installTypes: true, }, diff --git a/examples/webgl-ssao/src/static.d.ts b/examples/webgl-ssao/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/webgl-ssao/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/wolfram/package.json b/examples/wolfram/package.json index 19d7e467b9..2c6001679b 100644 --- a/examples/wolfram/package.json +++ b/examples/wolfram/package.json @@ -32,5 +32,8 @@ "transducers-binary" ], "screenshot": "examples/wolfram.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/wolfram/snowpack.config.js b/examples/wolfram/snowpack.config.js index 4154e57989..5d4f31dca7 100644 --- a/examples/wolfram/snowpack.config.js +++ b/examples/wolfram/snowpack.config.js @@ -4,7 +4,22 @@ module.exports = { public: "/", src: "/_dist_", }, - plugins: ["@snowpack/plugin-typescript", "@snowpack/plugin-webpack"], + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], installOptions: { installTypes: true, }, diff --git a/examples/wolfram/src/static.d.ts b/examples/wolfram/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/wolfram/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */ diff --git a/examples/xml-converter/package.json b/examples/xml-converter/package.json index 50e63d694d..87bca487a0 100644 --- a/examples/xml-converter/package.json +++ b/examples/xml-converter/package.json @@ -8,8 +8,7 @@ "scripts": { "clean": "../../node_modules/.bin/rimraf build node_modules/.cache", "start": "../../node_modules/.bin/snowpack dev", - "build": "../../node_modules/.bin/snowpack build", - "build-cli": "tsc -p tsconfig-cli.json" + "build": "../../node_modules/.bin/snowpack build" }, "dependencies": { "@thi.ng/arrays": "latest", @@ -36,5 +35,8 @@ "transducers" ], "screenshot": "examples/xml-converter.png" + }, + "devDependencies": { + "@types/snowpack-env": "^2.3.2" } } diff --git a/examples/xml-converter/snowpack.config.js b/examples/xml-converter/snowpack.config.js index 00c793b486..0a75b08722 100644 --- a/examples/xml-converter/snowpack.config.js +++ b/examples/xml-converter/snowpack.config.js @@ -4,7 +4,22 @@ module.exports = { public: "/", src: "/_dist_", }, - plugins: ["@snowpack/plugin-typescript", "@snowpack/plugin-webpack"], + plugins: [ + "@snowpack/plugin-typescript", + [ + "@snowpack/plugin-webpack", + { + extendConfig: (config) => { + config.node = { + process: false, + setImmediate: false, + util: "empty", + }; + return config; + }, + }, + ], + ], installOptions: { installTypes: true, }, diff --git a/examples/xml-converter/src/static.d.ts b/examples/xml-converter/src/static.d.ts new file mode 100644 index 0000000000..071978b8c0 --- /dev/null +++ b/examples/xml-converter/src/static.d.ts @@ -0,0 +1,59 @@ +/* Use this file to declare any custom file extensions for importing */ +/* Use this folder to also add/extend a package d.ts file, if needed. */ + +/* CSS MODULES */ +declare module "*.module.css" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.scss" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.sass" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.less" { + const classes: { [key: string]: string }; + export default classes; +} +declare module "*.module.styl" { + const classes: { [key: string]: string }; + export default classes; +} + +/* CSS */ +declare module "*.css"; +declare module "*.scss"; +declare module "*.sass"; +declare module "*.less"; +declare module "*.styl"; + +/* IMAGES */ +declare module "*.svg" { + const ref: string; + export default ref; +} +declare module "*.bmp" { + const ref: string; + export default ref; +} +declare module "*.gif" { + const ref: string; + export default ref; +} +declare module "*.jpg" { + const ref: string; + export default ref; +} +declare module "*.jpeg" { + const ref: string; + export default ref; +} +declare module "*.png" { + const ref: string; + export default ref; +} + +/* CUSTOM: ADD YOUR OWN HERE */