stacks 0.0.9 → 0.37.3
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 +65 -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/node_modules/.bin/tsc +17 -0
- package/core/actions/node_modules/.bin/tsserver +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/acorn +17 -0
- package/core/build/node_modules/.bin/browserslist +17 -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/rollup +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/acorn +17 -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/vite +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/node_modules/.vite/deps/@vueuse_core.js +7847 -0
- package/vue-components/node_modules/.vite/deps/@vueuse_core.js.map +7 -0
- package/vue-components/node_modules/.vite/deps/_metadata.json +13 -0
- package/vue-components/node_modules/.vite/deps/package.json +1 -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 -398
- package/test/test.stacks.js +0 -148
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hash": "4898ffa6",
|
|
3
|
+
"browserHash": "c46729e0",
|
|
4
|
+
"optimized": {
|
|
5
|
+
"@vueuse/core": {
|
|
6
|
+
"src": "../../../../../node_modules/.pnpm/@vueuse+core@9.3.1_vue@3.2.41/node_modules/@vueuse/core/index.mjs",
|
|
7
|
+
"file": "@vueuse_core.js",
|
|
8
|
+
"fileHash": "8d2fe768",
|
|
9
|
+
"needsInterop": false
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"chunks": {}
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hello-world-vue",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "",
|
|
5
|
+
"packageManager": "pnpm@7.13.6",
|
|
6
|
+
"description": "Your Vue component library description",
|
|
7
|
+
"author": "Chris Breuer",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"homepage": "https://github.com/stacksjs/stacks/tree/main/components#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
13
|
+
"directory": "components"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/stacksjs/stacks/issues"
|
|
17
|
+
},
|
|
18
|
+
"keywords": ["component","library","vue","vite","typescript","javascript"],
|
|
19
|
+
"contributors": ["Chris Breuer <chris@ow3.org>"],
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"require": "./dist/index.cjs",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"main": "dist/index.cjs",
|
|
28
|
+
"module": "dist/index.js",
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "vite build -c ../build/vue-components.ts",
|
|
35
|
+
"prepublishOnly": "pnpm run build"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"stacks": "workspace:*"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
File without changes
|
|
@@ -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="/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="$NODE_PATH:/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../bin/stacks.mjs" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../bin/stacks.mjs" "$@"
|
|
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="/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="$NODE_PATH:/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../bin/stacks.mjs" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../bin/stacks.mjs" "$@"
|
|
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="/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="$NODE_PATH:/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../bin/stacks.mjs" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../bin/stacks.mjs" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hello-world-elements",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "",
|
|
5
|
+
"packageManager": "pnpm@7.13.6",
|
|
6
|
+
"description": "Your framework agnostic web component library description.",
|
|
7
|
+
"author": "Chris Breuer",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"homepage": "https://github.com/stacksjs/stacks/tree/main/components#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
13
|
+
"directory": "components"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/stacksjs/stacks/issues"
|
|
17
|
+
},
|
|
18
|
+
"keywords": ["custom-elements","web-components","library","framework-agnostic","typescript","javascript"],
|
|
19
|
+
"contributors": ["Chris Breuer <chris@ow3.org>"],
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"require": "./dist/index.cjs",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"main": "dist/index.cjs",
|
|
28
|
+
"module": "dist/index.js",
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "vite build -c ../build/web-components.ts",
|
|
35
|
+
"prepublishOnly": "pnpm run build"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"stacks": "workspace:*"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/web-types.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"framework": "vue",
|
|
3
|
+
"name": "hello-world",
|
|
4
|
+
"version": "0.34.9",
|
|
5
|
+
"contributions": {
|
|
6
|
+
"html": {
|
|
7
|
+
"description-markup": "markdown",
|
|
8
|
+
"types-syntax": "typescript",
|
|
9
|
+
"tags": [
|
|
10
|
+
{
|
|
11
|
+
"name": "Counter",
|
|
12
|
+
"description": "",
|
|
13
|
+
"source": {
|
|
14
|
+
"module": "../components/Buttons/Counter.vue"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Demo",
|
|
19
|
+
"description": "",
|
|
20
|
+
"source": {
|
|
21
|
+
"module": "../components/Demo.vue"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "HelloWorld",
|
|
26
|
+
"description": "",
|
|
27
|
+
"attributes": [
|
|
28
|
+
{
|
|
29
|
+
"name": "greeting",
|
|
30
|
+
"required": true,
|
|
31
|
+
"value": {
|
|
32
|
+
"kind": "expression",
|
|
33
|
+
"type": "string"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "showButtons",
|
|
38
|
+
"required": true,
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression",
|
|
41
|
+
"type": "boolean"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"source": {
|
|
46
|
+
"module": "../components/HelloWorld.vue",
|
|
47
|
+
"symbol": "default"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "Logo",
|
|
52
|
+
"description": "",
|
|
53
|
+
"source": {
|
|
54
|
+
"module": "../components/Logo.vue"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "ToggleDark",
|
|
59
|
+
"description": "",
|
|
60
|
+
"source": {
|
|
61
|
+
"module": "../components/Buttons/ToggleDark.vue"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
package/.npmignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_modules
|
package/.travis.yml
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
var debug = require('debug')('stringReverse'),
|
|
2
|
-
stacksServer = require('..'),
|
|
3
|
-
stacksClient = require('..');
|
|
4
|
-
|
|
5
|
-
stacksServer.listen(3000, function() {
|
|
6
|
-
debug('stacksServer listening');
|
|
7
|
-
|
|
8
|
-
stacksClient.connect(3000, function(client) {
|
|
9
|
-
debug('stacksClient connected');
|
|
10
|
-
|
|
11
|
-
client.on('string reverse', function(string, reply) {
|
|
12
|
-
debug('client: stringReverse request received');
|
|
13
|
-
|
|
14
|
-
var reversedString = string.split("").reverse().join("");
|
|
15
|
-
var error = null;
|
|
16
|
-
|
|
17
|
-
if (Date.now() % 2) {
|
|
18
|
-
error = new Error('uh oh');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Take three seconds to show concurrency limit
|
|
22
|
-
setTimeout(function() {
|
|
23
|
-
reply(error, reversedString);
|
|
24
|
-
}, 1000);
|
|
25
|
-
}, 15); // handle only 15 concurrent string:reverse requests at a time
|
|
26
|
-
|
|
27
|
-
for (var i = 0; i < 100; i++) {
|
|
28
|
-
stacksServer.request('string reverse', 'hello', { maxRetries: 2 }, function (error, reversedString) {
|
|
29
|
-
debug('server: stringReverse request returned');
|
|
30
|
-
|
|
31
|
-
if (error) {
|
|
32
|
-
console.error('Failed to reverse string after 2 retries. Error:', error);
|
|
33
|
-
} else {
|
|
34
|
-
console.log('Reversed string:', reversedString); // Reversed string: olleh
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
});
|
package/examples/sumServer.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var debug = require('debug')('server'),
|
|
2
|
-
stacks = require('..');
|
|
3
|
-
|
|
4
|
-
stacks.listen(3000, function() {
|
|
5
|
-
debug('stacks listening');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
setTimeout(function() {
|
|
9
|
-
|
|
10
|
-
for (var i = 0; i <= 200; i++) {
|
|
11
|
-
stacks.request('sum numbers', { numbers: [4, 4, 10, 2, i, i/2] }, function (error, sum) {
|
|
12
|
-
if (error) {
|
|
13
|
-
console.error('error: ', error);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
console.log('sum: ', sum)
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}, 10000);
|
package/examples/sumWorker.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var debug = require('debug')('client'),
|
|
2
|
-
stacks = require('..');
|
|
3
|
-
|
|
4
|
-
stacks.connect(3000, function(client) {
|
|
5
|
-
|
|
6
|
-
client.on('sum numbers', function(body, reply) {
|
|
7
|
-
var error = null,
|
|
8
|
-
numbers = body.numbers,
|
|
9
|
-
sum = 0;
|
|
10
|
-
|
|
11
|
-
for (i in numbers) {
|
|
12
|
-
debug('sum: ', sum);
|
|
13
|
-
sum += numbers[i];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
console.log('sum: ', sum);
|
|
17
|
-
|
|
18
|
-
setTimeout(function() {
|
|
19
|
-
reply(error, sum);
|
|
20
|
-
}, 3000);
|
|
21
|
-
}, 25);
|
|
22
|
-
|
|
23
|
-
});
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./lib/stacks');
|