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.
- package/.gitignore +10 -0
- package/LICENSE.md +21 -0
- package/README.md +53 -104
- package/auto-imports.d.ts +826 -0
- package/bin/stacks.mjs +4 -0
- package/components.d.ts +22 -0
- package/core/actions/README.md +59 -0
- package/core/actions/node_modules/.bin/markdown-it +17 -0
- package/core/actions/node_modules/.bin/mkdist +17 -0
- package/core/actions/package.json +64 -0
- package/core/actions/src/copy-types.ts +22 -0
- package/core/actions/src/generate/component-meta.ts +94 -0
- package/core/actions/src/generate/index.ts +4 -0
- package/core/actions/src/generate/lib-entries.ts +106 -0
- package/core/actions/src/generate/package-json.ts +87 -0
- package/core/actions/src/generate/vscode-custom-data.ts +28 -0
- package/core/actions/src/generate/vue-compat.ts +17 -0
- package/core/actions/src/generate-component-meta.ts +19 -0
- package/core/actions/src/generate-ide-helpers.ts +23 -0
- package/core/actions/src/generate-lib-entries.ts +22 -0
- package/core/actions/src/generate-package-json.ts +15 -0
- package/core/actions/src/generate-vscode-custom-data.ts +20 -0
- package/core/actions/src/generate-vue-compat.ts +10 -0
- package/core/arrays/README.md +59 -0
- package/core/arrays/node_modules/.bin/mkdist +17 -0
- package/core/arrays/node_modules/.bin/tsc +17 -0
- package/core/arrays/node_modules/.bin/tsserver +17 -0
- package/core/arrays/package.json +50 -0
- package/core/arrays/src/index.ts +3 -0
- package/core/build/README.md +59 -0
- package/core/build/entries/README.md +7 -0
- package/core/build/node_modules/.bin/jiti +17 -0
- package/core/build/node_modules/.bin/mkdist +17 -0
- package/core/build/node_modules/.bin/vite +17 -0
- package/core/build/node_modules/.bin/vite-ssg +17 -0
- package/core/build/node_modules/.bin/vue-docgen-web-types +17 -0
- package/core/build/package.json +71 -0
- package/core/build/src/example-vue.ts +26 -0
- package/core/build/src/example-wc.ts +26 -0
- package/core/build/src/functions.ts +56 -0
- package/core/build/src/index.ts +7 -0
- package/core/build/src/pages.ts +50 -0
- package/core/build/src/stacks.ts +204 -0
- package/core/build/src/vue-components.ts +76 -0
- package/core/build/src/web-components.ts +63 -0
- package/core/build/web-types.config.cjs +4 -0
- package/core/build/web-types.ts +14 -0
- package/core/collections/README.md +59 -0
- package/core/collections/node_modules/.bin/mkdist +17 -0
- package/core/collections/node_modules/.bin/tsc +17 -0
- package/core/collections/node_modules/.bin/tsserver +17 -0
- package/core/collections/package.json +54 -0
- package/core/collections/src/index.ts +1 -0
- package/core/fs/README.md +59 -0
- package/core/fs/node_modules/.bin/mkdist +17 -0
- package/core/fs/package.json +56 -0
- package/core/fs/src/index.ts +170 -0
- package/core/helpers/node_modules/.bin/mkdist +17 -0
- package/core/helpers/package.json +58 -0
- package/core/helpers/src/index.ts +129 -0
- package/core/modules/README.md +61 -0
- package/core/modules/node_modules/.bin/mkdist +17 -0
- package/core/modules/package.json +51 -0
- package/core/modules/src/i18n.ts +23 -0
- package/core/modules/src/nprogress.ts +12 -0
- package/core/modules/src/pwa.ts +12 -0
- package/core/objects/README.md +59 -0
- package/core/objects/node_modules/.bin/mkdist +17 -0
- package/core/objects/node_modules/.bin/tsc +17 -0
- package/core/objects/node_modules/.bin/tsserver +17 -0
- package/core/objects/package.json +51 -0
- package/core/objects/src/index.ts +1 -0
- package/core/paths/node_modules/.bin/mkdist +17 -0
- package/core/paths/node_modules/.bin/tsc +17 -0
- package/core/paths/node_modules/.bin/tsserver +17 -0
- package/core/paths/package.json +51 -0
- package/core/paths/src/index.ts +178 -0
- package/core/router/README.md +59 -0
- package/core/router/node_modules/.bin/mkdist +17 -0
- package/core/router/package.json +51 -0
- package/core/router/src/index.ts +14 -0
- package/core/security/README.md +59 -0
- package/core/security/node_modules/.bin/mkdist +17 -0
- package/core/security/package.json +56 -0
- package/core/security/src/crypt.ts +14 -0
- package/core/security/src/hash.ts +52 -0
- package/core/security/src/index.ts +3 -0
- package/core/security/src/key.ts +11 -0
- package/core/strings/README.md +59 -0
- package/core/strings/node_modules/.bin/mkdist +17 -0
- package/core/strings/node_modules/.bin/tsc +17 -0
- package/core/strings/node_modules/.bin/tsserver +17 -0
- package/core/strings/package.json +63 -0
- package/core/strings/src/index.ts +14 -0
- package/core/types/README.md +59 -0
- package/core/types/node_modules/.bin/markdown-it +17 -0
- package/core/types/node_modules/.bin/mkdist +17 -0
- package/core/types/node_modules/.bin/vite +17 -0
- package/core/types/node_modules/.bin/vitepress +17 -0
- package/core/types/package.json +60 -0
- package/core/types/src/app.ts +131 -0
- package/core/types/src/auto-imports.ts +3 -0
- package/core/types/src/build.ts +3 -0
- package/core/types/src/cli.ts +49 -0
- package/core/types/src/components.ts +66 -0
- package/core/types/src/deploy.ts +11 -0
- package/core/types/src/docs.ts +3 -0
- package/core/types/src/exit-code.ts +10 -0
- package/core/types/src/fs.ts +17 -0
- package/core/types/src/git.ts +131 -0
- package/core/types/src/hashing.ts +107 -0
- package/core/types/src/i18n.ts +19 -0
- package/core/types/src/index.ts +21 -0
- package/core/types/src/inspect.ts +10 -0
- package/core/types/src/layout.ts +8 -0
- package/core/types/src/library.ts +148 -0
- package/core/types/src/manifest.ts +9 -0
- package/core/types/src/markdown.ts +198 -0
- package/core/types/src/pages.ts +8 -0
- package/core/types/src/pwa.ts +8 -0
- package/core/types/src/ssg.ts +3 -0
- package/core/types/src/ui.ts +141 -0
- package/core/ui/README.md +60 -0
- package/core/ui/node_modules/.bin/mkdist +17 -0
- package/core/ui/node_modules/.bin/tsc +17 -0
- package/core/ui/node_modules/.bin/tsserver +17 -0
- package/core/ui/node_modules/.bin/vue-tsc +17 -0
- package/core/ui/package.json +62 -0
- package/core/ui/src/index.ts +60 -0
- package/custom-elements.json +14 -0
- package/examples/vue-components/App.vue +12 -0
- package/examples/vue-components/favicon.png +0 -0
- package/examples/vue-components/index.html +20 -0
- package/examples/web-components/favicon.png +0 -0
- package/examples/web-components/index.html +13 -0
- package/functions/node_modules/.bin/artisan +17 -0
- package/functions/node_modules/.bin/stacks +17 -0
- package/functions/node_modules/.bin/stx +17 -0
- package/functions/package.json +40 -0
- package/netlify.toml +18 -0
- package/nitro.config.ts +6 -0
- package/package.json +224 -27
- package/pages/App.vue +26 -0
- package/pages/index.html +23 -0
- package/pages/main.ts +26 -0
- package/pages/public/_headers +3 -0
- package/pages/public/favicon-dark.svg +3 -0
- package/pages/public/favicon.svg +3 -0
- package/pages/public/pwa-192x192.png +0 -0
- package/pages/public/pwa-512x512.png +0 -0
- package/pages/public/safari-pinned-tab.svg +41 -0
- package/pages/styles/main.css +29 -0
- package/pages/styles/markdown.css +28 -0
- package/scripts/ensure-env.sh +248 -0
- package/shims.d.ts +29 -0
- package/simple-git-hooks.cjs +4 -0
- package/src/cli/actions/build.ts +160 -0
- package/src/cli/actions/commit.ts +9 -0
- package/src/cli/actions/dev.ts +47 -0
- package/src/cli/actions/examples.ts +74 -0
- package/src/cli/actions/fresh.ts +9 -0
- package/src/cli/actions/generate.ts +159 -0
- package/src/cli/actions/index.ts +12 -0
- package/src/cli/actions/key.ts +31 -0
- package/src/cli/actions/lint.ts +19 -0
- package/src/cli/actions/make.ts +116 -0
- package/src/cli/actions/release.ts +9 -0
- package/src/cli/actions/test.ts +39 -0
- package/src/cli/actions/types.ts +180 -0
- package/src/cli/actions/update.ts +90 -0
- package/src/cli/build.ts +49 -0
- package/src/cli/create.ts +71 -0
- package/src/cli/dev.ts +28 -0
- package/src/cli/example.ts +28 -0
- package/src/cli/generate.ts +64 -0
- package/src/cli/index.ts +13 -0
- package/src/cli/key.ts +12 -0
- package/src/cli/make.ts +47 -0
- package/src/cli/test.ts +24 -0
- package/src/cli/types.ts +18 -0
- package/src/cli/update.ts +17 -0
- package/src/cli/utility.ts +39 -0
- package/src/cli.ts +48 -0
- package/src/docs.ts +4 -0
- package/src/index.ts +22 -0
- package/tsconfig.json +96 -0
- package/vitest.config.ts +22 -0
- package/vue-components/dist/.gitkeep +0 -0
- package/vue-components/index.html +13 -0
- package/vue-components/main.ts +18 -0
- package/vue-components/node_modules/.bin/artisan +17 -0
- package/vue-components/node_modules/.bin/stacks +17 -0
- package/vue-components/node_modules/.bin/stx +17 -0
- package/vue-components/package.json +40 -0
- package/web-components/dist/.gitkeep +0 -0
- package/web-components/node_modules/.bin/artisan +17 -0
- package/web-components/node_modules/.bin/stacks +17 -0
- package/web-components/node_modules/.bin/stx +17 -0
- package/web-components/package.json +40 -0
- package/web-types.json +67 -0
- package/.npmignore +0 -1
- package/.travis.yml +0 -4
- package/examples/stringReverse.js +0 -41
- package/examples/sumServer.js +0 -21
- package/examples/sumWorker.js +0 -23
- package/index.js +0 -1
- package/lib/stacks.js +0 -413
- package/test/test.stacks.js +0 -148
package/.gitignore
ADDED
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Open Web Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,118 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
$ (sudo) npm install --save stacks
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
And add it to your project
|
|
34
|
-
```javascript
|
|
35
|
-
var stacks = require('stacks');
|
|
36
|
-
...
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
* * *
|
|
40
|
-
|
|
41
|
-
making requests
|
|
42
|
-
===============
|
|
43
|
-
The master node makes requests to stacks. The requests are automatically handled by clients.
|
|
44
|
-
```javascript
|
|
45
|
-
var stacks = require('stacks');
|
|
46
|
-
// Listen for clients on port 3000
|
|
47
|
-
stacks.listen(3000);
|
|
48
|
-
|
|
49
|
-
stacks.request('string reverse', 'hello', { maxRetries: 5 }, function (error, reversedString) {
|
|
50
|
-
if (error) {
|
|
51
|
-
console.error('Failed to reverse string after 5 retries. Error:', error);
|
|
52
|
-
} else {
|
|
53
|
-
console.log('Reversed string:', reversedString); // Reversed string: olleh
|
|
54
|
-
}
|
|
55
|
-
});
|
|
1
|
+
# Rapid Application Development
|
|
2
|
+
|
|
3
|
+
This Stacks.js framework/package contains the core logic—its runtime, helpers, and CLI (excluding the IDE setup).
|
|
4
|
+
|
|
5
|
+
## ☘️ Features
|
|
6
|
+
|
|
7
|
+
The ultimate goal of the framework is to _help you_ build applications rapidly. Whether it's APIs, a component and/or function library, or simply a statically generate site. Stacks is a toolkit of composables, methods, and other goodies required to build optimized outputs. It's a highly optimized build process that automatically generates `.mjs` & `.cjs` library distributions for you, including its TypeScript types.
|
|
8
|
+
|
|
9
|
+
Other included core features are:
|
|
10
|
+
|
|
11
|
+
- ⚡️ Vite powered, optimized for speed
|
|
12
|
+
- 🚜 Create one component, automatically generate a Vue & Web Component library
|
|
13
|
+
- 🎨 Optimized CSS engine for Vue & Web Components, and SSG pages _(defaults to Tailwind CSS utility classes)_
|
|
14
|
+
- 👣 Tiny foot-print in production builds
|
|
15
|
+
- 🌳 Treeshaking for Vue & Web Components, and function libraries
|
|
16
|
+
- 💬 Fully-typed TypeScript definitions
|
|
17
|
+
- 📰 Automatically publishes your libraries to npm & creates your changelogs
|
|
18
|
+
- 🧙🏼♀️ Unified way to access hundreds of [icon sets](https://icon-sets.iconify.design)
|
|
19
|
+
— [Icons in Pure CSS](https://antfu.me/posts/icons-in-pure-css)
|
|
20
|
+
|
|
21
|
+
And all of this in a zero-config, yet highly-configurable, way.
|
|
22
|
+
|
|
23
|
+
## 🤖 Usage
|
|
24
|
+
|
|
25
|
+
If you want to use Stacks outside of this framework, install it as a dev dependency:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm i -D stacks
|
|
56
29
|
```
|
|
57
30
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
// connect to stacks server
|
|
63
|
-
stacks.connect(3000, function(client) {
|
|
64
|
-
|
|
65
|
-
client.on('string reverse', function(string, reply) {
|
|
66
|
-
var reversedString = string.split("").reverse().join("");
|
|
67
|
-
var error = null;
|
|
68
|
-
reply(error, reversedString);
|
|
69
|
-
}, 15); // handle only 15 concurrent string reverse requests at a time
|
|
70
|
-
|
|
71
|
-
});
|
|
31
|
+
Now, you can use it in your project:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import * as stacks from 'stacks'
|
|
72
35
|
```
|
|
73
36
|
|
|
74
|
-
|
|
37
|
+
You may easily import any of the exported methods. Learn more in the docs.
|
|
38
|
+
|
|
39
|
+
## 🧪 Testing
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pnpm test
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 📈 Changelog
|
|
46
|
+
|
|
47
|
+
Please see our [releases](https://github.com/stacksjs/vue-components-library-starter/releases) page for more information on what has changed recently.
|
|
75
48
|
|
|
76
|
-
|
|
77
|
-
==========
|
|
49
|
+
## 💪🏼 Contributing
|
|
78
50
|
|
|
79
|
-
|
|
80
|
-
Listen for client (worker) connections
|
|
81
|
-
+ _Number_ `port`: Port to listen for client connections on
|
|
82
|
-
+ _Function_ `callback`: Callback function invoked when stacks has begun listening. Takes no arguments
|
|
51
|
+
Please see [CONTRIBUTING](../../.github/CONTRIBUTING.md) for details.
|
|
83
52
|
|
|
84
|
-
##
|
|
85
|
-
Make a request on stacks
|
|
86
|
-
+ _String_ `type`: Type of request. Used in client interface to process/reply i.e., `client.on(type, function(body, reply) {...`
|
|
87
|
-
+ _Mixed_ `body`: The request body that will be received by the client request worker. `WARNING: `Arrays will be parsed as arguments and cannot be sent as the top-level object in a request.
|
|
88
|
-
+ _Object_ `options`: Request options.
|
|
89
|
-
+ _Function_ `callback`: Callback function invoked when request completes (or fails after options.maxRetries). Takes arguments `error`, `response`.
|
|
53
|
+
## 🏝 Community
|
|
90
54
|
|
|
91
|
-
|
|
92
|
-
+ _Number_ `maxRetries` (3): The maximum amount of retries to attempt before invoking request callback with `error`. (These retries are rescheduled by stacks (round-robin if multiple clients are connected)).
|
|
55
|
+
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
|
|
93
56
|
|
|
94
|
-
|
|
95
|
-
==========
|
|
57
|
+
[Discussions on GitHub](https://github.com/stacksjs/web-components-library-starter/discussions)
|
|
96
58
|
|
|
97
|
-
|
|
98
|
-
Connect to stacks server
|
|
99
|
-
+ _Mixed_ `server`: If _Number_, server is interpreted as port. If _Object_, server must have the signature `{ host: '[host-ip-address]', port: 3000 }`
|
|
100
|
-
+ _Function_ `callback`: Invoked after client is connected to stacks server. Takes argument `client`.
|
|
59
|
+
For casual chit-chat with others using this package:
|
|
101
60
|
|
|
102
|
-
|
|
103
|
-
Disconnect from stacks server
|
|
61
|
+
[Join the Open Web Discord Server](https://discord.ow3.org)
|
|
104
62
|
|
|
105
|
-
##
|
|
106
|
-
Instance methods of the client object passed to the #connect() callback.
|
|
63
|
+
## 📄 License
|
|
107
64
|
|
|
108
|
-
|
|
109
|
-
Handle and reply to requests of type `type`
|
|
110
|
-
+ _String_ `type`: Type of request to handle with `concurrency` concurrent `worker` functions
|
|
111
|
-
+ _Function_ `worker`: Function that processes and replies to a request. Takes arguments `body`– the request body –and `reply`– the reply function.
|
|
112
|
-
+ _Number_ `concurrency` (1): Limit of concurrent `worker` functions to use for requests of type `type`.
|
|
113
|
-
|
|
114
|
-
License
|
|
115
|
-
=======
|
|
116
|
-
|
|
117
|
-
MIT
|
|
65
|
+
The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
|
|
118
66
|
|
|
67
|
+
Made with ❤️
|