stacks 0.1.0 → 0.37.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/.gitignore +10 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +53 -104
  4. package/auto-imports.d.ts +826 -0
  5. package/bin/stacks.mjs +4 -0
  6. package/components.d.ts +22 -0
  7. package/core/actions/README.md +59 -0
  8. package/core/actions/node_modules/.bin/markdown-it +17 -0
  9. package/core/actions/node_modules/.bin/mkdist +17 -0
  10. package/core/actions/package.json +64 -0
  11. package/core/actions/src/copy-types.ts +22 -0
  12. package/core/actions/src/generate/component-meta.ts +94 -0
  13. package/core/actions/src/generate/index.ts +4 -0
  14. package/core/actions/src/generate/lib-entries.ts +106 -0
  15. package/core/actions/src/generate/package-json.ts +87 -0
  16. package/core/actions/src/generate/vscode-custom-data.ts +28 -0
  17. package/core/actions/src/generate/vue-compat.ts +17 -0
  18. package/core/actions/src/generate-component-meta.ts +19 -0
  19. package/core/actions/src/generate-ide-helpers.ts +23 -0
  20. package/core/actions/src/generate-lib-entries.ts +22 -0
  21. package/core/actions/src/generate-package-json.ts +15 -0
  22. package/core/actions/src/generate-vscode-custom-data.ts +20 -0
  23. package/core/actions/src/generate-vue-compat.ts +10 -0
  24. package/core/arrays/README.md +59 -0
  25. package/core/arrays/node_modules/.bin/mkdist +17 -0
  26. package/core/arrays/node_modules/.bin/tsc +17 -0
  27. package/core/arrays/node_modules/.bin/tsserver +17 -0
  28. package/core/arrays/package.json +50 -0
  29. package/core/arrays/src/index.ts +3 -0
  30. package/core/build/README.md +59 -0
  31. package/core/build/entries/README.md +7 -0
  32. package/core/build/node_modules/.bin/jiti +17 -0
  33. package/core/build/node_modules/.bin/mkdist +17 -0
  34. package/core/build/node_modules/.bin/vite +17 -0
  35. package/core/build/node_modules/.bin/vite-ssg +17 -0
  36. package/core/build/node_modules/.bin/vue-docgen-web-types +17 -0
  37. package/core/build/package.json +71 -0
  38. package/core/build/src/example-vue.ts +26 -0
  39. package/core/build/src/example-wc.ts +26 -0
  40. package/core/build/src/functions.ts +56 -0
  41. package/core/build/src/index.ts +7 -0
  42. package/core/build/src/pages.ts +50 -0
  43. package/core/build/src/stacks.ts +204 -0
  44. package/core/build/src/vue-components.ts +76 -0
  45. package/core/build/src/web-components.ts +63 -0
  46. package/core/build/web-types.config.cjs +4 -0
  47. package/core/build/web-types.ts +14 -0
  48. package/core/collections/README.md +59 -0
  49. package/core/collections/node_modules/.bin/mkdist +17 -0
  50. package/core/collections/node_modules/.bin/tsc +17 -0
  51. package/core/collections/node_modules/.bin/tsserver +17 -0
  52. package/core/collections/package.json +54 -0
  53. package/core/collections/src/index.ts +1 -0
  54. package/core/fs/README.md +59 -0
  55. package/core/fs/node_modules/.bin/mkdist +17 -0
  56. package/core/fs/package.json +56 -0
  57. package/core/fs/src/index.ts +170 -0
  58. package/core/helpers/node_modules/.bin/mkdist +17 -0
  59. package/core/helpers/package.json +58 -0
  60. package/core/helpers/src/index.ts +129 -0
  61. package/core/modules/README.md +61 -0
  62. package/core/modules/node_modules/.bin/mkdist +17 -0
  63. package/core/modules/package.json +51 -0
  64. package/core/modules/src/i18n.ts +23 -0
  65. package/core/modules/src/nprogress.ts +12 -0
  66. package/core/modules/src/pwa.ts +12 -0
  67. package/core/objects/README.md +59 -0
  68. package/core/objects/node_modules/.bin/mkdist +17 -0
  69. package/core/objects/node_modules/.bin/tsc +17 -0
  70. package/core/objects/node_modules/.bin/tsserver +17 -0
  71. package/core/objects/package.json +51 -0
  72. package/core/objects/src/index.ts +1 -0
  73. package/core/paths/node_modules/.bin/mkdist +17 -0
  74. package/core/paths/node_modules/.bin/tsc +17 -0
  75. package/core/paths/node_modules/.bin/tsserver +17 -0
  76. package/core/paths/package.json +51 -0
  77. package/core/paths/src/index.ts +178 -0
  78. package/core/router/README.md +59 -0
  79. package/core/router/node_modules/.bin/mkdist +17 -0
  80. package/core/router/package.json +51 -0
  81. package/core/router/src/index.ts +14 -0
  82. package/core/security/README.md +59 -0
  83. package/core/security/node_modules/.bin/mkdist +17 -0
  84. package/core/security/package.json +56 -0
  85. package/core/security/src/crypt.ts +14 -0
  86. package/core/security/src/hash.ts +52 -0
  87. package/core/security/src/index.ts +3 -0
  88. package/core/security/src/key.ts +11 -0
  89. package/core/strings/README.md +59 -0
  90. package/core/strings/node_modules/.bin/mkdist +17 -0
  91. package/core/strings/node_modules/.bin/tsc +17 -0
  92. package/core/strings/node_modules/.bin/tsserver +17 -0
  93. package/core/strings/package.json +63 -0
  94. package/core/strings/src/index.ts +14 -0
  95. package/core/types/README.md +59 -0
  96. package/core/types/node_modules/.bin/markdown-it +17 -0
  97. package/core/types/node_modules/.bin/mkdist +17 -0
  98. package/core/types/node_modules/.bin/vite +17 -0
  99. package/core/types/node_modules/.bin/vitepress +17 -0
  100. package/core/types/package.json +60 -0
  101. package/core/types/src/app.ts +131 -0
  102. package/core/types/src/auto-imports.ts +3 -0
  103. package/core/types/src/build.ts +3 -0
  104. package/core/types/src/cli.ts +49 -0
  105. package/core/types/src/components.ts +66 -0
  106. package/core/types/src/deploy.ts +11 -0
  107. package/core/types/src/docs.ts +3 -0
  108. package/core/types/src/exit-code.ts +10 -0
  109. package/core/types/src/fs.ts +17 -0
  110. package/core/types/src/git.ts +131 -0
  111. package/core/types/src/hashing.ts +107 -0
  112. package/core/types/src/i18n.ts +19 -0
  113. package/core/types/src/index.ts +21 -0
  114. package/core/types/src/inspect.ts +10 -0
  115. package/core/types/src/layout.ts +8 -0
  116. package/core/types/src/library.ts +148 -0
  117. package/core/types/src/manifest.ts +9 -0
  118. package/core/types/src/markdown.ts +198 -0
  119. package/core/types/src/pages.ts +8 -0
  120. package/core/types/src/pwa.ts +8 -0
  121. package/core/types/src/ssg.ts +3 -0
  122. package/core/types/src/ui.ts +141 -0
  123. package/core/ui/README.md +60 -0
  124. package/core/ui/node_modules/.bin/mkdist +17 -0
  125. package/core/ui/node_modules/.bin/tsc +17 -0
  126. package/core/ui/node_modules/.bin/tsserver +17 -0
  127. package/core/ui/node_modules/.bin/vue-tsc +17 -0
  128. package/core/ui/package.json +62 -0
  129. package/core/ui/src/index.ts +60 -0
  130. package/custom-elements.json +14 -0
  131. package/examples/vue-components/App.vue +12 -0
  132. package/examples/vue-components/favicon.png +0 -0
  133. package/examples/vue-components/index.html +20 -0
  134. package/examples/web-components/favicon.png +0 -0
  135. package/examples/web-components/index.html +13 -0
  136. package/functions/node_modules/.bin/artisan +17 -0
  137. package/functions/node_modules/.bin/stacks +17 -0
  138. package/functions/node_modules/.bin/stx +17 -0
  139. package/functions/package.json +40 -0
  140. package/netlify.toml +18 -0
  141. package/nitro.config.ts +6 -0
  142. package/package.json +224 -27
  143. package/pages/App.vue +26 -0
  144. package/pages/index.html +23 -0
  145. package/pages/main.ts +26 -0
  146. package/pages/public/_headers +3 -0
  147. package/pages/public/favicon-dark.svg +3 -0
  148. package/pages/public/favicon.svg +3 -0
  149. package/pages/public/pwa-192x192.png +0 -0
  150. package/pages/public/pwa-512x512.png +0 -0
  151. package/pages/public/safari-pinned-tab.svg +41 -0
  152. package/pages/styles/main.css +29 -0
  153. package/pages/styles/markdown.css +28 -0
  154. package/scripts/ensure-env.sh +248 -0
  155. package/shims.d.ts +29 -0
  156. package/simple-git-hooks.cjs +4 -0
  157. package/src/cli/actions/build.ts +160 -0
  158. package/src/cli/actions/commit.ts +9 -0
  159. package/src/cli/actions/dev.ts +47 -0
  160. package/src/cli/actions/examples.ts +74 -0
  161. package/src/cli/actions/fresh.ts +9 -0
  162. package/src/cli/actions/generate.ts +159 -0
  163. package/src/cli/actions/index.ts +12 -0
  164. package/src/cli/actions/key.ts +31 -0
  165. package/src/cli/actions/lint.ts +19 -0
  166. package/src/cli/actions/make.ts +116 -0
  167. package/src/cli/actions/release.ts +9 -0
  168. package/src/cli/actions/test.ts +39 -0
  169. package/src/cli/actions/types.ts +180 -0
  170. package/src/cli/actions/update.ts +90 -0
  171. package/src/cli/build.ts +49 -0
  172. package/src/cli/create.ts +71 -0
  173. package/src/cli/dev.ts +28 -0
  174. package/src/cli/example.ts +28 -0
  175. package/src/cli/generate.ts +64 -0
  176. package/src/cli/index.ts +13 -0
  177. package/src/cli/key.ts +12 -0
  178. package/src/cli/make.ts +47 -0
  179. package/src/cli/test.ts +24 -0
  180. package/src/cli/types.ts +18 -0
  181. package/src/cli/update.ts +17 -0
  182. package/src/cli/utility.ts +39 -0
  183. package/src/cli.ts +48 -0
  184. package/src/docs.ts +4 -0
  185. package/src/index.ts +22 -0
  186. package/tsconfig.json +96 -0
  187. package/vitest.config.ts +22 -0
  188. package/vue-components/dist/.gitkeep +0 -0
  189. package/vue-components/index.html +13 -0
  190. package/vue-components/main.ts +18 -0
  191. package/vue-components/node_modules/.bin/artisan +17 -0
  192. package/vue-components/node_modules/.bin/stacks +17 -0
  193. package/vue-components/node_modules/.bin/stx +17 -0
  194. package/vue-components/package.json +40 -0
  195. package/web-components/dist/.gitkeep +0 -0
  196. package/web-components/node_modules/.bin/artisan +17 -0
  197. package/web-components/node_modules/.bin/stacks +17 -0
  198. package/web-components/node_modules/.bin/stx +17 -0
  199. package/web-components/package.json +40 -0
  200. package/web-types.json +67 -0
  201. package/.npmignore +0 -1
  202. package/.travis.yml +0 -4
  203. package/examples/stringReverse.js +0 -41
  204. package/examples/sumServer.js +0 -21
  205. package/examples/sumWorker.js +0 -23
  206. package/index.js +0 -1
  207. package/lib/stacks.js +0 -413
  208. package/test/test.stacks.js +0 -148
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@stacksjs/objects",
3
+ "type": "module",
4
+ "version": "0.37.4",
5
+ "packageManager": "pnpm@7.13.6",
6
+ "description": "The Stacks objects.",
7
+ "author": "Chris Breuer",
8
+ "license": "MIT",
9
+ "funding": "https://github.com/sponsors/chrisbbreuer",
10
+ "homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/objects#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/stacksjs/stacks.git",
14
+ "directory": "./.stacks/core/objects"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/stacksjs/stacks/issues"
18
+ },
19
+ "keywords": [
20
+ "objects",
21
+ "utilities",
22
+ "functions",
23
+ "stacks"
24
+ ],
25
+ "main": "dist/index.mjs",
26
+ "module": "dist/index.mjs",
27
+ "types": "dist/index.d.ts",
28
+ "contributors": [
29
+ "Chris Breuer <chris@ow3.org>"
30
+ ],
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "engines": {
35
+ "node": ">=v18.10.0",
36
+ "pnpm": ">=7.13.6"
37
+ },
38
+ "scripts": {
39
+ "build": "mkdist -d",
40
+ "dev": "mkdist -d",
41
+ "prepublishOnly": "pnpm run build",
42
+ "typecheck": "tsc --noEmit"
43
+ },
44
+ "dependencies": {
45
+ "@stacksjs/collections": "workspace:*"
46
+ },
47
+ "devDependencies": {
48
+ "mkdist": "^0.3.13",
49
+ "typescript": "^4.8.4"
50
+ }
51
+ }
@@ -0,0 +1 @@
1
+ export { Collection, collect } from '@stacksjs/collections'
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/mkdist@0.3.13_typescript@4.8.4/node_modules/mkdist/dist/cli.cjs" "$@"
15
+ else
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/mkdist@0.3.13_typescript@4.8.4/node_modules/mkdist/dist/cli.cjs" "$@"
17
+ fi
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/bin/tsc" "$@"
15
+ else
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/bin/tsc" "$@"
17
+ fi
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/bin/tsserver" "$@"
15
+ else
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/bin/tsserver" "$@"
17
+ fi
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@stacksjs/paths",
3
+ "type": "module",
4
+ "version": "0.37.4",
5
+ "packageManager": "pnpm@7.13.6",
6
+ "description": "The Stacks paths.",
7
+ "author": "Chris Breuer",
8
+ "license": "MIT",
9
+ "funding": "https://github.com/sponsors/chrisbbreuer",
10
+ "homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/paths#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/stacksjs/stacks.git",
14
+ "directory": "./.stacks/core/paths"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/stacksjs/stacks/issues"
18
+ },
19
+ "keywords": [
20
+ "paths",
21
+ "utilities",
22
+ "functions",
23
+ "stacks"
24
+ ],
25
+ "main": "dist/index.mjs",
26
+ "module": "dist/index.mjs",
27
+ "types": "dist/index.d.ts",
28
+ "contributors": [
29
+ "Chris Breuer <chris@ow3.org>"
30
+ ],
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "engines": {
35
+ "node": ">=v18.10.0",
36
+ "pnpm": ">=7.13.6"
37
+ },
38
+ "scripts": {
39
+ "build": "mkdist -d",
40
+ "dev": "mkdist -d",
41
+ "prepublishOnly": "pnpm run build",
42
+ "typecheck": "tsc --noEmit"
43
+ },
44
+ "dependencies": {
45
+ "pathe": "^0.3.9"
46
+ },
47
+ "devDependencies": {
48
+ "mkdist": "^0.3.13",
49
+ "typescript": "^4.8.4"
50
+ }
51
+ }
@@ -0,0 +1,178 @@
1
+ import { resolve as r } from 'pathe'
2
+
3
+ export * from 'pathe'
4
+
5
+ /**
6
+ * Returns the path to the `actions` directory. The actions directory
7
+ * contains the core Stacks' actions. An action
8
+ *
9
+ * @param path string - relative path to the file or directory
10
+ * @returns string - absolute path to the file or directory
11
+ * @example
12
+ * ```ts
13
+ * import { buildPath } from '@stacks/paths'
14
+ *
15
+ * buildPath('functions.vue')
16
+ * buildPath('any-path.ts')
17
+ * ```
18
+ */
19
+ export function actionsPath(path?: string) {
20
+ return corePath(`actions/${path || ''}`)
21
+ }
22
+
23
+ /**
24
+ * Returns the path to the build directory. The build directory
25
+ * contains Stacks' build engine & its tooling integrations.
26
+ *
27
+ * @param path string - relative path to the file or directory
28
+ * @returns string - absolute path to the file or directory
29
+ * @example
30
+ * ```ts
31
+ * buildPath('functions.vue')
32
+ * buildPath('vue-components.ts')
33
+ * ```
34
+ */
35
+ export function buildPath(path?: string) {
36
+ return corePath(`build/${path || ''}`)
37
+ }
38
+
39
+ export function buildEnginePath(path?: string) {
40
+ return buildPath(`${path || ''}`)
41
+ }
42
+
43
+ export function buildEntriesPath(path?: string) {
44
+ return buildPath(`entries/${path || ''}`)
45
+ }
46
+
47
+ export function cliPath(path?: string) {
48
+ return stacksPath(`cli/${path || ''}`)
49
+ }
50
+
51
+ export function stacksPath(path?: string) {
52
+ return frameworkPath(`src/${path || ''}`)
53
+ }
54
+
55
+ export function customElementsDataPath() {
56
+ return frameworkPath('custom-elements.json')
57
+ }
58
+
59
+ export function componentsPath(path?: string) {
60
+ return projectPath(`components/${path || ''}`)
61
+ }
62
+
63
+ export function configPath() {
64
+ return frameworkPath('config.ts')
65
+ }
66
+
67
+ export function examplesPath(type: 'vue-components' | 'web-components') {
68
+ return frameworkPath(`examples/${type || ''}`)
69
+ }
70
+
71
+ export function frameworkPath(path?: string) {
72
+ return projectPath(`.stacks/${path || ''}`)
73
+ }
74
+
75
+ export function corePath(path?: string) {
76
+ return frameworkPath(`core/${path || ''}`)
77
+ }
78
+
79
+ export function functionsPath(path?: string) {
80
+ return projectPath(`functions/${path || ''}`)
81
+ }
82
+
83
+ export function langPath(path?: string) {
84
+ return projectPath(`lang/${path || ''}`)
85
+ }
86
+
87
+ export function libraryEntryPath(type: 'vue-components' | 'web-components' | 'functions') {
88
+ return buildEntriesPath(`${type}.ts`)
89
+ }
90
+
91
+ export function modulesPath(path?: string) {
92
+ return corePath(`modules/${path || ''}`)
93
+ }
94
+
95
+ export function routerPath(path?: string) {
96
+ return corePath(`router/${path || ''}`)
97
+ }
98
+
99
+ export function securityPath(path?: string) {
100
+ return corePath(`security/${path || ''}`)
101
+ }
102
+
103
+ export function typesPath(path?: string) {
104
+ return corePath(`types/${path || ''}`)
105
+ }
106
+
107
+ export function uiPath(path?: string) {
108
+ return corePath(`ui/${path || ''}`)
109
+ }
110
+
111
+ export function arraysPath(path?: string) {
112
+ return corePath(`arrays/${path || ''}`)
113
+ }
114
+
115
+ export function collectionsPath(path?: string) {
116
+ return corePath(`collections/${path || ''}`)
117
+ }
118
+
119
+ export function pathsPath(path?: string) {
120
+ return corePath(`paths/${path || ''}`)
121
+ }
122
+
123
+ export function objectsPath(path?: string) {
124
+ return corePath(`objects/${path || ''}`)
125
+ }
126
+
127
+ export function stringsPath(path?: string) {
128
+ return corePath(`strings/${path || ''}`)
129
+ }
130
+
131
+ export function fsPath(path?: string) {
132
+ return corePath(`fs/${path || ''}`)
133
+ }
134
+
135
+ export function helpersPath(path?: string) {
136
+ return corePath(`helpers/${path || ''}`)
137
+ }
138
+
139
+ export function aliasPath() {
140
+ return frameworkPath('alias.ts')
141
+ }
142
+
143
+ export function scriptsPath(path?: string) {
144
+ return frameworkPath(`scripts/${path || ''}`)
145
+ }
146
+
147
+ export function packageJsonPath(type: 'vue-components' | 'web-components' | 'functions') {
148
+ return frameworkPath(`./${type}/package.json`)
149
+ }
150
+
151
+ export function pagesPath(path?: string) {
152
+ return projectPath(`pages/${path || ''}`)
153
+ }
154
+
155
+ export function projectPath(filePath = '') {
156
+ let path = process.cwd()
157
+
158
+ // workaround: run the follow command a few times because there is chance
159
+ // that the cwd is a few dirs up, like in the case when a release happens
160
+ // from a GitHub Action/workflow
161
+ if (path.includes('.stacks'))
162
+ path = r(path, '..')
163
+
164
+ if (path.includes('.stacks'))
165
+ path = r(path, '..')
166
+
167
+ if (path.includes('.stacks'))
168
+ path = r(path, '..')
169
+
170
+ if (!path.includes('.stacks'))
171
+ path = r(path, '.')
172
+
173
+ return r(path, filePath)
174
+ }
175
+
176
+ export function routesPath(path?: string) {
177
+ return projectPath(`routes/${path || ''}`)
178
+ }
@@ -0,0 +1,59 @@
1
+ # Stacks Router
2
+
3
+ This package contains the Stacks Router.
4
+
5
+ ## ☘️ Features
6
+
7
+ wip
8
+
9
+ - ⚡️
10
+
11
+ wip
12
+
13
+ ## 🤖 Usage
14
+
15
+ wip
16
+
17
+ ```bash
18
+ pnpm i -D @stacksjs/actions
19
+ ```
20
+
21
+ Now, you can use it in your project:
22
+
23
+ ```js
24
+ import * as router from '@stacksjs/router'
25
+
26
+ // wip
27
+ ```
28
+
29
+ Learn more in the docs.
30
+
31
+ ## 🧪 Testing
32
+
33
+ ```bash
34
+ pnpm test
35
+ ```
36
+
37
+ ## 📈 Changelog
38
+
39
+ Please see our [releases](https://github.com/stacksjs/stacksjs/releases) page for more information on what has changed recently.
40
+
41
+ ## 💪🏼 Contributing
42
+
43
+ Please see [CONTRIBUTING](../../.github/CONTRIBUTING.md) for details.
44
+
45
+ ## 🏝 Community
46
+
47
+ For help, discussion about best practices, or any other conversation that would benefit from being searchable:
48
+
49
+ [Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)
50
+
51
+ For casual chit-chat with others using this package:
52
+
53
+ [Join the Open Web Discord Server](https://discord.ow3.org)
54
+
55
+ ## 📄 License
56
+
57
+ The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
58
+
59
+ Made with ❤️
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/mkdist@0.3.13/node_modules/mkdist/dist/cli.cjs" "$@"
15
+ else
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/mkdist@0.3.13/node_modules/mkdist/dist/cli.cjs" "$@"
17
+ fi
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@stacksjs/router",
3
+ "type": "module",
4
+ "version": "0.37.4",
5
+ "packageManager": "pnpm@7.13.6",
6
+ "description": "The Stacks framework router.",
7
+ "author": "Chris Breuer",
8
+ "license": "MIT",
9
+ "funding": "https://github.com/sponsors/chrisbbreuer",
10
+ "homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/router#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/stacksjs/stacks.git",
14
+ "directory": "./.stacks/core/router"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/stacksjs/stacks/issues"
18
+ },
19
+ "keywords": [
20
+ "router",
21
+ "stacks",
22
+ "framework",
23
+ "typescript",
24
+ "javascript"
25
+ ],
26
+ "main": "dist/index.mjs",
27
+ "module": "dist/index.mjs",
28
+ "types": "dist/index.d.ts",
29
+ "contributors": [
30
+ "Chris Breuer <chris@ow3.org>"
31
+ ],
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "engines": {
36
+ "node": ">=v18.10.0",
37
+ "pnpm": ">=7.13.6"
38
+ },
39
+ "scripts": {
40
+ "build": "mkdist -d",
41
+ "dev": "mkdist -d",
42
+ "prepublishOnly": "pnpm run build",
43
+ "typecheck": "tsc --noEmit"
44
+ },
45
+ "dependencies": {
46
+ "vue-router": "^4.1.5"
47
+ },
48
+ "devDependencies": {
49
+ "mkdist": "^0.3.13"
50
+ }
51
+ }
@@ -0,0 +1,14 @@
1
+ // wip - router that generates files for nitro engine
2
+ // via a Laravel like syntax on the Stacks interface
3
+ // check: Nitro's routing system to see the goal we want
4
+ // -> to generate our Laravel source into their API
5
+ // -> todo: alias `useHead` to `metaTags` or something more readable
6
+
7
+ export function router() {
8
+ return ''
9
+ }
10
+
11
+ // those would be the serve commands because
12
+ // "you serve functions (apis), you develop components (and pages), you build libraries and/or apps & apis
13
+
14
+ export {}
@@ -0,0 +1,59 @@
1
+ # Stacks Router
2
+
3
+ This package contains the Stacks Security.
4
+
5
+ ## ☘️ Features
6
+
7
+ wip
8
+
9
+ - ⚡️
10
+
11
+ wip
12
+
13
+ ## 🤖 Usage
14
+
15
+ wip
16
+
17
+ ```bash
18
+ pnpm i -D @stacksjs/security
19
+ ```
20
+
21
+ Now, you can use it in your project:
22
+
23
+ ```js
24
+ import * as security from '@stacksjs/security'
25
+
26
+ // wip
27
+ ```
28
+
29
+ Learn more in the docs.
30
+
31
+ ## 🧪 Testing
32
+
33
+ ```bash
34
+ pnpm test
35
+ ```
36
+
37
+ ## 📈 Changelog
38
+
39
+ Please see our [releases](https://github.com/stacksjs/stacksjs/releases) page for more information on what has changed recently.
40
+
41
+ ## 💪🏼 Contributing
42
+
43
+ Please see [CONTRIBUTING](../../.github/CONTRIBUTING.md) for details.
44
+
45
+ ## 🏝 Community
46
+
47
+ For help, discussion about best practices, or any other conversation that would benefit from being searchable:
48
+
49
+ [Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)
50
+
51
+ For casual chit-chat with others using this package:
52
+
53
+ [Join the Open Web Discord Server](https://discord.ow3.org)
54
+
55
+ ## 📄 License
56
+
57
+ The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
58
+
59
+ Made with ❤️
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/mkdist@0.3.13/node_modules/mkdist/dist/cli.cjs" "$@"
15
+ else
16
+ exec node "$basedir/../../../../../node_modules/.pnpm/mkdist@0.3.13/node_modules/mkdist/dist/cli.cjs" "$@"
17
+ fi
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@stacksjs/security",
3
+ "type": "module",
4
+ "version": "0.37.4",
5
+ "packageManager": "pnpm@7.13.6",
6
+ "description": "The Stacks framework security.",
7
+ "author": "Chris Breuer",
8
+ "license": "MIT",
9
+ "funding": "https://github.com/sponsors/chrisbbreuer",
10
+ "homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/security#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/stacksjs/stacks.git",
14
+ "directory": "./.stacks/core/security"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/stacksjs/stacks/issues"
18
+ },
19
+ "keywords": [
20
+ "security",
21
+ "framework",
22
+ "typescript",
23
+ "javascript"
24
+ ],
25
+ "main": "dist/index.mjs",
26
+ "module": "dist/index.mjs",
27
+ "types": "dist/index.d.ts",
28
+ "contributors": [
29
+ "Chris Breuer <chris@ow3.org>"
30
+ ],
31
+ "files": [
32
+ "dist",
33
+ "src",
34
+ "README.md"
35
+ ],
36
+ "engines": {
37
+ "node": ">=v18.10.0",
38
+ "pnpm": ">=7.13.6"
39
+ },
40
+ "scripts": {
41
+ "build": "mkdist -d",
42
+ "dev": "mkdist -d",
43
+ "prepublishOnly": "pnpm run build",
44
+ "typecheck": "tsc --noEmit"
45
+ },
46
+ "dependencies": {
47
+ "@types/bcryptjs": "^2.4.2",
48
+ "@types/crypto-js": "^4.1.1",
49
+ "bcryptjs": "^2.4.3",
50
+ "crypto-js": "^4.1.1",
51
+ "js-base64": "^3.7.2"
52
+ },
53
+ "devDependencies": {
54
+ "mkdist": "^0.3.13"
55
+ }
56
+ }
@@ -0,0 +1,14 @@
1
+ import aes from 'crypto-js/aes'
2
+ import utf8 from 'crypto-js/enc-utf8'
3
+
4
+ const passphrase = import.meta.env.APP_KEY as string
5
+
6
+ function encrypt(message: string): string {
7
+ return aes.encrypt(message, passphrase).toString()
8
+ }
9
+
10
+ function decrypt(encrypted: string): string {
11
+ return aes.decrypt(encrypted, passphrase).toString(utf8)
12
+ }
13
+
14
+ export { encrypt, decrypt }
@@ -0,0 +1,52 @@
1
+ import bcryptjs from 'bcryptjs'
2
+ import { Base64 } from 'js-base64'
3
+ import md5 from 'crypto-js/md5'
4
+ import { hashing } from '../../../config'
5
+
6
+ async function make(password: string, algorithm = 'bcrypt') {
7
+ if (algorithm === 'bcrypt')
8
+ return bcryptEncode(password)
9
+
10
+ if (algorithm === 'base64')
11
+ return base64Encode(password)
12
+
13
+ throw new Error('Unsupported algorithm')
14
+ }
15
+
16
+ async function verify(password: string, hash: string, algorithm = 'bcrypt') {
17
+ if (algorithm === 'bcrypt')
18
+ return bcryptVerify(password, hash)
19
+
20
+ if (algorithm === 'base64')
21
+ return base64Verify(password, hash)
22
+
23
+ throw new Error('Unsupported algorithm')
24
+ }
25
+
26
+ async function bcryptEncode(password: string) {
27
+ if (!hashing.bcrypt)
28
+ throw new Error('Bcrypt hashing is not configured')
29
+
30
+ const salt = await bcryptjs.genSaltSync(hashing.bcrypt.rounds)
31
+ const hash = await bcryptjs.hash(password, salt)
32
+
33
+ return hash
34
+ }
35
+
36
+ async function bcryptVerify(password: string, hash: string) {
37
+ return await bcryptjs.compare(password, hash)
38
+ }
39
+
40
+ async function base64Encode(password: string) {
41
+ return await Base64.encode(password)
42
+ }
43
+
44
+ async function base64Verify(password: string, hash: string) {
45
+ return Base64.decode(hash) === password
46
+ }
47
+
48
+ async function md5Encode(password: string) {
49
+ return md5(password)
50
+ }
51
+
52
+ export { make as makeHash, verify as verifyHash, base64Encode, base64Verify, bcryptEncode, bcryptVerify, md5Encode }