diff --git a/package-lock.json b/package-lock.json index 69da34f..12c2cbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,9 +6,17 @@ "": { "name": "pro-router-imba2", "dependencies": { - "pro-router": "^4.3.2" + "pro-router": "^4.3.2", + "lodash.chunk": "^4.2.0", + "lodash.compact": "^3.0.1", + "lodash.flatten": "^4.4.0", + "lodash.frompairs": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.reject": "^4.6.0", + "lodash.topairs": "^4.3.0" }, "devDependencies": { + "commander": "^6.2.1", "imba": "^2.0.0-alpha.226", "vite": "^3.2.5", "vite-plugin-imba": "^0.10.1" @@ -316,6 +324,13 @@ "node": ">=8" } }, + "node_modules/@testing-library/jest-dom/node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "peer": true + }, "node_modules/@types/aria-query": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", @@ -709,6 +724,15 @@ "node": ">=0.1.90" } }, + "node_modules/commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -2111,12 +2135,40 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true, - "peer": true + "node_modules/lodash.chunk": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.chunk/-/lodash.chunk-4.2.0.tgz", + "integrity": "sha512-ZzydJKfUHJwHa+hF5X66zLFCBrWn5GeF28OHEr4WVWtNDXlQ/IjWKPBiikqKo2ne0+v6JgCgJ0GzJp8k8bHC7w==" + }, + "node_modules/lodash.compact": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash.compact/-/lodash.compact-3.0.1.tgz", + "integrity": "sha512-2ozeiPi+5eBXW1CLtzjk8XQFhQOEMwwfxblqeq6EGyTxZJ1bPATqilY0e6g2SLQpP4KuMeuioBhEnWz5Pr7ICQ==" + }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==" + }, + "node_modules/lodash.frompairs": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.frompairs/-/lodash.frompairs-4.0.1.tgz", + "integrity": "sha512-dvqe2I+cO5MzXCMhUnfYFa9MD+/760yx2aTAN1lqEcEkf896TxgrX373igVdqSJj6tQd0jnSLE1UMuKufqqxFw==" + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + }, + "node_modules/lodash.reject": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz", + "integrity": "sha512-qkTuvgEzYdyhiJBx42YPzPo71R1aEr0z79kAv7Ixg8wPFEjgRgJdUsGMG3Hf3OYSF/kHI79XhNlt+5Ar6OzwxQ==" + }, + "node_modules/lodash.topairs": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.topairs/-/lodash.topairs-4.3.0.tgz", + "integrity": "sha512-qrRMbykBSEGdOgQLJJqVSdPWMD7Q+GJJ5jMRfQYb+LTLsw3tYVIabnCzRqTJb2WTo17PG5gNzXuFaZgYH/9SAQ==" }, "node_modules/loupe": { "version": "2.3.6", @@ -3293,6 +3345,13 @@ "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "peer": true } } }, @@ -3605,6 +3664,12 @@ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", "dev": true }, + "commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true + }, "cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -4533,11 +4598,9 @@ } }, "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true, - "peer": true + "version": "4.11.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.11.1.tgz", + "integrity": "sha512-zQXZjpw5m367A/MrkEIx1xEJISQmZykAJ5EzCPznYZiVLK211R1hDiye+TU4eyWKDfsaBsLW6/7gH5juuZ4J6Q==" }, "loupe": { "version": "2.3.6", diff --git a/package.json b/package.json index ce8bceb..2024603 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,16 @@ }, "dependencies": { "pro-router": "^4.3.2", - "lodash": "4.11.1" + "lodash.chunk": "^4.2.0", + "lodash.compact": "^3.0.1", + "lodash.flatten": "^4.4.0", + "lodash.frompairs": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.reject": "^4.6.0", + "lodash.topairs": "^4.3.0" }, "devDependencies": { + "commander": "^6.2.1", "imba": "^2.0.0-alpha.226", "vite": "^3.2.5", "vite-plugin-imba": "^0.10.1" diff --git a/src/main.imba b/src/main.imba index e9be03c..60769fe 100644 --- a/src/main.imba +++ b/src/main.imba @@ -1,5 +1,12 @@ import "./router_tag.imba" -import { compact, fromPairs, chunk, includes, reject, toPairs, flatten } from 'lodash' + +import compact from 'lodash.compact' +import fromPairs from 'lodash.frompairs' +import chunk from 'lodash.chunk' +import includes from 'lodash.includes' +import reject from 'lodash.reject' +import toPairs from 'lodash.topairs' +import flatten from 'lodash.flatten' let helpers = compact: compact @@ -10,23 +17,17 @@ let helpers = toPairs: toPairs flatten: flatten -R.init(helpers: helpers, root: 'a', render: imba.commit) - -tag view-a -

'a' +# EDIT BELOW -tag view-b -

'b' +R.init(helpers: helpers, root: 'home', render: imba.commit) -tag view-c -

'c' +tag view-home +

'Imba2 on Pro Router is working...' -R.setters.e = do |v| "--{v}" if v -R.getters.e = do |v| v.slice(2) -tag view-e -

'e' +tag view-not_found +

"Page not found :(" -tag app +tag App v for v in R.views 'd' @@ -38,5 +39,4 @@ tag app -if import.meta.env.MODE is 'development' - imba.mount +imba.mount if import.meta.env.MODE is 'development' \ No newline at end of file diff --git a/src/router_tag.imba b/src/router_tag.imba index 7cfdc19..fa655cf 100644 --- a/src/router_tag.imba +++ b/src/router_tag.imba @@ -27,7 +27,4 @@ tag pro-ref < pro-ref-f get url #params = JSON.parse JSON.stringify(params) # duplicate object #params[k] ||= v for own k, v of R.safe_params - R.to_path view, #params - -tag view-not_found -

"Page not found :(" \ No newline at end of file + R.to_path view, #params \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 02e9b39..3c972cd 100644 --- a/vite.config.js +++ b/vite.config.js @@ -19,7 +19,8 @@ function proRouterViews() { let result = null let views = "" while(result = viewRegExp.exec(src)) { - views += "Views.push(\""+ result[1] +"\");" + if(result[1] != 'not_found') + views += "Views.push(\""+ result[1] +"\");" } return { code: views+src, map: null } }