fix: delete
This commit is contained in:
parent
c7b66d5aba
commit
5c14ff2c60
1
node_modules/.bin/acorn
generated
vendored
1
node_modules/.bin/acorn
generated
vendored
@ -1 +0,0 @@
|
|||||||
../acorn/bin/acorn
|
|
1
node_modules/.bin/adler32
generated
vendored
1
node_modules/.bin/adler32
generated
vendored
@ -1 +0,0 @@
|
|||||||
../adler-32/bin/adler32.njs
|
|
1
node_modules/.bin/ansi-html
generated
vendored
1
node_modules/.bin/ansi-html
generated
vendored
@ -1 +0,0 @@
|
|||||||
../ansi-html-community/bin/ansi-html
|
|
1
node_modules/.bin/atob
generated
vendored
1
node_modules/.bin/atob
generated
vendored
@ -1 +0,0 @@
|
|||||||
../atob/bin/atob.js
|
|
1
node_modules/.bin/autoprefixer
generated
vendored
1
node_modules/.bin/autoprefixer
generated
vendored
@ -1 +0,0 @@
|
|||||||
../autoprefixer/bin/autoprefixer
|
|
1
node_modules/.bin/browserslist
generated
vendored
1
node_modules/.bin/browserslist
generated
vendored
@ -1 +0,0 @@
|
|||||||
../browserslist/cli.js
|
|
1
node_modules/.bin/codepage
generated
vendored
1
node_modules/.bin/codepage
generated
vendored
@ -1 +0,0 @@
|
|||||||
../codepage/bin/codepage.njs
|
|
1
node_modules/.bin/crc32
generated
vendored
1
node_modules/.bin/crc32
generated
vendored
@ -1 +0,0 @@
|
|||||||
../crc-32/bin/crc32.njs
|
|
1
node_modules/.bin/cssesc
generated
vendored
1
node_modules/.bin/cssesc
generated
vendored
@ -1 +0,0 @@
|
|||||||
../cssesc/bin/cssesc
|
|
1
node_modules/.bin/errno
generated
vendored
1
node_modules/.bin/errno
generated
vendored
@ -1 +0,0 @@
|
|||||||
../errno/cli.js
|
|
1
node_modules/.bin/eslint
generated
vendored
1
node_modules/.bin/eslint
generated
vendored
@ -1 +0,0 @@
|
|||||||
../eslint/bin/eslint.js
|
|
1
node_modules/.bin/esparse
generated
vendored
1
node_modules/.bin/esparse
generated
vendored
@ -1 +0,0 @@
|
|||||||
../esprima/bin/esparse.js
|
|
1
node_modules/.bin/esvalidate
generated
vendored
1
node_modules/.bin/esvalidate
generated
vendored
@ -1 +0,0 @@
|
|||||||
../esprima/bin/esvalidate.js
|
|
1
node_modules/.bin/he
generated
vendored
1
node_modules/.bin/he
generated
vendored
@ -1 +0,0 @@
|
|||||||
../he/bin/he
|
|
1
node_modules/.bin/highlight
generated
vendored
1
node_modules/.bin/highlight
generated
vendored
@ -1 +0,0 @@
|
|||||||
../cli-highlight/bin/highlight
|
|
1
node_modules/.bin/html-minifier
generated
vendored
1
node_modules/.bin/html-minifier
generated
vendored
@ -1 +0,0 @@
|
|||||||
../html-minifier/cli.js
|
|
1
node_modules/.bin/image-size
generated
vendored
1
node_modules/.bin/image-size
generated
vendored
@ -1 +0,0 @@
|
|||||||
../image-size/bin/image-size.js
|
|
1
node_modules/.bin/import-local-fixture
generated
vendored
1
node_modules/.bin/import-local-fixture
generated
vendored
@ -1 +0,0 @@
|
|||||||
../import-local/fixtures/cli.js
|
|
1
node_modules/.bin/is-ci
generated
vendored
1
node_modules/.bin/is-ci
generated
vendored
@ -1 +0,0 @@
|
|||||||
../is-ci/bin.js
|
|
1
node_modules/.bin/is-docker
generated
vendored
1
node_modules/.bin/is-docker
generated
vendored
@ -1 +0,0 @@
|
|||||||
../is-docker/cli.js
|
|
1
node_modules/.bin/js-yaml
generated
vendored
1
node_modules/.bin/js-yaml
generated
vendored
@ -1 +0,0 @@
|
|||||||
../js-yaml/bin/js-yaml.js
|
|
1
node_modules/.bin/jsesc
generated
vendored
1
node_modules/.bin/jsesc
generated
vendored
@ -1 +0,0 @@
|
|||||||
../jsesc/bin/jsesc
|
|
1
node_modules/.bin/json5
generated
vendored
1
node_modules/.bin/json5
generated
vendored
@ -1 +0,0 @@
|
|||||||
../json5/lib/cli.js
|
|
1
node_modules/.bin/lessc
generated
vendored
1
node_modules/.bin/lessc
generated
vendored
@ -1 +0,0 @@
|
|||||||
../less/bin/lessc
|
|
1
node_modules/.bin/loose-envify
generated
vendored
1
node_modules/.bin/loose-envify
generated
vendored
@ -1 +0,0 @@
|
|||||||
../loose-envify/cli.js
|
|
1
node_modules/.bin/markdown-it
generated
vendored
1
node_modules/.bin/markdown-it
generated
vendored
@ -1 +0,0 @@
|
|||||||
../markdown-it/bin/markdown-it.mjs
|
|
1
node_modules/.bin/miller-rabin
generated
vendored
1
node_modules/.bin/miller-rabin
generated
vendored
@ -1 +0,0 @@
|
|||||||
../miller-rabin/bin/miller-rabin
|
|
1
node_modules/.bin/mime
generated
vendored
1
node_modules/.bin/mime
generated
vendored
@ -1 +0,0 @@
|
|||||||
../mime/cli.js
|
|
1
node_modules/.bin/mkdirp
generated
vendored
1
node_modules/.bin/mkdirp
generated
vendored
@ -1 +0,0 @@
|
|||||||
../mkdirp/bin/cmd.js
|
|
1
node_modules/.bin/multicast-dns
generated
vendored
1
node_modules/.bin/multicast-dns
generated
vendored
@ -1 +0,0 @@
|
|||||||
../multicast-dns/cli.js
|
|
1
node_modules/.bin/nanoid
generated
vendored
1
node_modules/.bin/nanoid
generated
vendored
@ -1 +0,0 @@
|
|||||||
../nanoid/bin/nanoid.cjs
|
|
1
node_modules/.bin/needle
generated
vendored
1
node_modules/.bin/needle
generated
vendored
@ -1 +0,0 @@
|
|||||||
../needle/bin/needle
|
|
1
node_modules/.bin/opener
generated
vendored
1
node_modules/.bin/opener
generated
vendored
@ -1 +0,0 @@
|
|||||||
../opener/bin/opener-bin.js
|
|
1
node_modules/.bin/parser
generated
vendored
1
node_modules/.bin/parser
generated
vendored
@ -1 +0,0 @@
|
|||||||
../@babel/parser/bin/babel-parser.js
|
|
1
node_modules/.bin/prettier
generated
vendored
1
node_modules/.bin/prettier
generated
vendored
@ -1 +0,0 @@
|
|||||||
../prettier/bin-prettier.js
|
|
1
node_modules/.bin/printj
generated
vendored
1
node_modules/.bin/printj
generated
vendored
@ -1 +0,0 @@
|
|||||||
../printj/bin/printj.njs
|
|
1
node_modules/.bin/regjsparser
generated
vendored
1
node_modules/.bin/regjsparser
generated
vendored
@ -1 +0,0 @@
|
|||||||
../regjsparser/bin/parser
|
|
1
node_modules/.bin/resolve
generated
vendored
1
node_modules/.bin/resolve
generated
vendored
@ -1 +0,0 @@
|
|||||||
../resolve/bin/resolve
|
|
1
node_modules/.bin/rimraf
generated
vendored
1
node_modules/.bin/rimraf
generated
vendored
@ -1 +0,0 @@
|
|||||||
../rimraf/bin.js
|
|
1
node_modules/.bin/semver
generated
vendored
1
node_modules/.bin/semver
generated
vendored
@ -1 +0,0 @@
|
|||||||
../semver/bin/semver.js
|
|
1
node_modules/.bin/sha.js
generated
vendored
1
node_modules/.bin/sha.js
generated
vendored
@ -1 +0,0 @@
|
|||||||
../sha.js/bin.js
|
|
1
node_modules/.bin/sshpk-conv
generated
vendored
1
node_modules/.bin/sshpk-conv
generated
vendored
@ -1 +0,0 @@
|
|||||||
../sshpk/bin/sshpk-conv
|
|
1
node_modules/.bin/sshpk-sign
generated
vendored
1
node_modules/.bin/sshpk-sign
generated
vendored
@ -1 +0,0 @@
|
|||||||
../sshpk/bin/sshpk-sign
|
|
1
node_modules/.bin/sshpk-verify
generated
vendored
1
node_modules/.bin/sshpk-verify
generated
vendored
@ -1 +0,0 @@
|
|||||||
../sshpk/bin/sshpk-verify
|
|
1
node_modules/.bin/stylus
generated
vendored
1
node_modules/.bin/stylus
generated
vendored
@ -1 +0,0 @@
|
|||||||
../stylus/bin/stylus
|
|
1
node_modules/.bin/svgo
generated
vendored
1
node_modules/.bin/svgo
generated
vendored
@ -1 +0,0 @@
|
|||||||
../svgo/bin/svgo
|
|
1
node_modules/.bin/terser
generated
vendored
1
node_modules/.bin/terser
generated
vendored
@ -1 +0,0 @@
|
|||||||
../terser/bin/terser
|
|
1
node_modules/.bin/uglifyjs
generated
vendored
1
node_modules/.bin/uglifyjs
generated
vendored
@ -1 +0,0 @@
|
|||||||
../uglify-js/bin/uglifyjs
|
|
1
node_modules/.bin/update-browserslist-db
generated
vendored
1
node_modules/.bin/update-browserslist-db
generated
vendored
@ -1 +0,0 @@
|
|||||||
../update-browserslist-db/cli.js
|
|
1
node_modules/.bin/uuid
generated
vendored
1
node_modules/.bin/uuid
generated
vendored
@ -1 +0,0 @@
|
|||||||
../uuid/bin/uuid
|
|
1
node_modules/.bin/vue-cli-service
generated
vendored
1
node_modules/.bin/vue-cli-service
generated
vendored
@ -1 +0,0 @@
|
|||||||
../@vue/cli-service/bin/vue-cli-service.js
|
|
1
node_modules/.bin/webpack
generated
vendored
1
node_modules/.bin/webpack
generated
vendored
@ -1 +0,0 @@
|
|||||||
../webpack/bin/webpack.js
|
|
1
node_modules/.bin/webpack-bundle-analyzer
generated
vendored
1
node_modules/.bin/webpack-bundle-analyzer
generated
vendored
@ -1 +0,0 @@
|
|||||||
../webpack-bundle-analyzer/lib/bin/analyzer.js
|
|
1
node_modules/.bin/webpack-dev-server
generated
vendored
1
node_modules/.bin/webpack-dev-server
generated
vendored
@ -1 +0,0 @@
|
|||||||
../webpack-dev-server/bin/webpack-dev-server.js
|
|
1
node_modules/.bin/which
generated
vendored
1
node_modules/.bin/which
generated
vendored
@ -1 +0,0 @@
|
|||||||
../which/bin/which
|
|
1
node_modules/.bin/xlsx
generated
vendored
1
node_modules/.bin/xlsx
generated
vendored
@ -1 +0,0 @@
|
|||||||
../xlsx/bin/xlsx.njs
|
|
18486
node_modules/.package-lock.json
generated
vendored
18486
node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
1
node_modules/@achrinza/node-ipc/.gitattributes
generated
vendored
1
node_modules/@achrinza/node-ipc/.gitattributes
generated
vendored
@ -1 +0,0 @@
|
|||||||
spec/**/* linguist-generated=true
|
|
62
node_modules/@achrinza/node-ipc/.github/workflows/ci.yaml
generated
vendored
62
node_modules/@achrinza/node-ipc/.github/workflows/ci.yaml
generated
vendored
@ -1,62 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ v9 ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ v9 ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Test
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
- ubuntu-latest
|
|
||||||
- macos-latest
|
|
||||||
- windows-latest
|
|
||||||
node_version:
|
|
||||||
- 8
|
|
||||||
- 10
|
|
||||||
- 12
|
|
||||||
- 14
|
|
||||||
- 16
|
|
||||||
- 17
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: npm ci --ignore-scripts
|
|
||||||
- name: Run Tests
|
|
||||||
if: matrix.os != 'windows-latest'
|
|
||||||
run: npm test --ignore-scripts
|
|
||||||
- name: Run Tests (Windows)
|
|
||||||
if: matrix.os == 'windows-latest'
|
|
||||||
run: npm run-script test-windows --ignore-scripts
|
|
||||||
code-lint:
|
|
||||||
name: Code Lint
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js 16
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 16 # LTS
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: npm ci --ignore-scripts
|
|
||||||
- name: Lockfile Lint
|
|
||||||
run: |
|
|
||||||
npm exec \
|
|
||||||
--no-install \
|
|
||||||
--package=lockfile-lint \
|
|
||||||
-- \
|
|
||||||
lockfile-lint \
|
|
||||||
--allowed-hosts=npm \
|
|
||||||
--path=./package-lock.json \
|
|
||||||
--validate-https \
|
|
||||||
--validate-package-names
|
|
133
node_modules/@achrinza/node-ipc/CODE_OF_CONDUCT.md
generated
vendored
133
node_modules/@achrinza/node-ipc/CODE_OF_CONDUCT.md
generated
vendored
@ -1,133 +0,0 @@
|
|||||||
|
|
||||||
# Contributor Covenant Code of Conduct
|
|
||||||
|
|
||||||
## Our Pledge
|
|
||||||
|
|
||||||
We as members, contributors, and leaders pledge to make participation in our
|
|
||||||
community a harassment-free experience for everyone, regardless of age, body
|
|
||||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
||||||
identity and expression, level of experience, education, socio-economic status,
|
|
||||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
||||||
identity and orientation.
|
|
||||||
|
|
||||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
||||||
diverse, inclusive, and healthy community.
|
|
||||||
|
|
||||||
## Our Standards
|
|
||||||
|
|
||||||
Examples of behavior that contributes to a positive environment for our
|
|
||||||
community include:
|
|
||||||
|
|
||||||
* Demonstrating empathy and kindness toward other people
|
|
||||||
* Being respectful of differing opinions, viewpoints, and experiences
|
|
||||||
* Giving and gracefully accepting constructive feedback
|
|
||||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
||||||
and learning from the experience
|
|
||||||
* Focusing on what is best not just for us as individuals, but for the overall
|
|
||||||
community
|
|
||||||
|
|
||||||
Examples of unacceptable behavior include:
|
|
||||||
|
|
||||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
||||||
any kind
|
|
||||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
||||||
* Public or private harassment
|
|
||||||
* Publishing others' private information, such as a physical or email address,
|
|
||||||
without their explicit permission
|
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
|
||||||
professional setting
|
|
||||||
|
|
||||||
## Enforcement Responsibilities
|
|
||||||
|
|
||||||
Community leaders are responsible for clarifying and enforcing our standards of
|
|
||||||
acceptable behavior and will take appropriate and fair corrective action in
|
|
||||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
||||||
or harmful.
|
|
||||||
|
|
||||||
Community leaders have the right and responsibility to remove, edit, or reject
|
|
||||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
||||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
||||||
decisions when appropriate.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
This Code of Conduct applies within all community spaces, and also applies when
|
|
||||||
an individual is officially representing the community in public spaces.
|
|
||||||
Examples of representing our community include using an official e-mail address,
|
|
||||||
posting via an official social media account, or acting as an appointed
|
|
||||||
representative at an online or offline event.
|
|
||||||
|
|
||||||
## Enforcement
|
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
||||||
reported to the community leaders responsible for enforcement at
|
|
||||||
rifa@achrinza.com.
|
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
|
||||||
reporter of any incident.
|
|
||||||
|
|
||||||
## Enforcement Guidelines
|
|
||||||
|
|
||||||
Community leaders will follow these Community Impact Guidelines in determining
|
|
||||||
the consequences for any action they deem in violation of this Code of Conduct:
|
|
||||||
|
|
||||||
### 1. Correction
|
|
||||||
|
|
||||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
||||||
unprofessional or unwelcome in the community.
|
|
||||||
|
|
||||||
**Consequence**: A private, written warning from community leaders, providing
|
|
||||||
clarity around the nature of the violation and an explanation of why the
|
|
||||||
behavior was inappropriate. A public apology may be requested.
|
|
||||||
|
|
||||||
### 2. Warning
|
|
||||||
|
|
||||||
**Community Impact**: A violation through a single incident or series of
|
|
||||||
actions.
|
|
||||||
|
|
||||||
**Consequence**: A warning with consequences for continued behavior. No
|
|
||||||
interaction with the people involved, including unsolicited interaction with
|
|
||||||
those enforcing the Code of Conduct, for a specified period of time. This
|
|
||||||
includes avoiding interactions in community spaces as well as external channels
|
|
||||||
like social media. Violating these terms may lead to a temporary or permanent
|
|
||||||
ban.
|
|
||||||
|
|
||||||
### 3. Temporary Ban
|
|
||||||
|
|
||||||
**Community Impact**: A serious violation of community standards, including
|
|
||||||
sustained inappropriate behavior.
|
|
||||||
|
|
||||||
**Consequence**: A temporary ban from any sort of interaction or public
|
|
||||||
communication with the community for a specified period of time. No public or
|
|
||||||
private interaction with the people involved, including unsolicited interaction
|
|
||||||
with those enforcing the Code of Conduct, is allowed during this period.
|
|
||||||
Violating these terms may lead to a permanent ban.
|
|
||||||
|
|
||||||
### 4. Permanent Ban
|
|
||||||
|
|
||||||
**Community Impact**: Demonstrating a pattern of violation of community
|
|
||||||
standards, including sustained inappropriate behavior, harassment of an
|
|
||||||
individual, or aggression toward or disparagement of classes of individuals.
|
|
||||||
|
|
||||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
||||||
community.
|
|
||||||
|
|
||||||
## Attribution
|
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
||||||
version 2.1, available at
|
|
||||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
||||||
|
|
||||||
Community Impact Guidelines were inspired by
|
|
||||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see the FAQ at
|
|
||||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
||||||
[https://www.contributor-covenant.org/translations][translations].
|
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
|
||||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
||||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
||||||
[FAQ]: https://www.contributor-covenant.org/faq
|
|
||||||
[translations]: https://www.contributor-covenant.org/translations
|
|
757
node_modules/@achrinza/node-ipc/README.md
generated
vendored
757
node_modules/@achrinza/node-ipc/README.md
generated
vendored
@ -1,757 +0,0 @@
|
|||||||
# @achrinza/node-ipc
|
|
||||||
|
|
||||||
> **NOTE:** This is a maintenance fork of `node-ipc` This is intended for
|
|
||||||
> packages that directly or indirectly depend on `node-ipc` where maintainers
|
|
||||||
> need a drop-in replacement.
|
|
||||||
>
|
|
||||||
> See https://github.com/achrinza/node-ipc/issues/1 for more details.
|
|
||||||
|
|
||||||
[](code_of_conduct.md)
|
|
||||||
|
|
||||||
_a nodejs module for local and remote Inter Process Communication_ with full support for Linux, Mac and Windows. It also supports all forms of socket communication from low level unix and windows sockets to UDP and secure TLS and TCP sockets.
|
|
||||||
|
|
||||||
A great solution for complex multiprocess **Neural Networking** in Node.JS
|
|
||||||
|
|
||||||
**npm install @achrinza/node-ipc**
|
|
||||||
|
|
||||||
#### Older versions of node
|
|
||||||
|
|
||||||
the latest versions of `@achrinza/node-ipc` may work with the --harmony flag. Officially though, we support node v4 and newer with es5 and es6
|
|
||||||
|
|
||||||
#### Testing
|
|
||||||
|
|
||||||
`npm test` will run the jasmine tests with istanbul for @achrinza/node-ipc and generate a coverage report in the spec folder.
|
|
||||||
|
|
||||||
You may want to install jasmine and istanbul globally with `sudo npm install -g jasmine istanbul`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#### Contents
|
|
||||||
|
|
||||||
1. [Types of IPC Sockets and Supporting OS](#types-of-ipc-sockets)
|
|
||||||
1. [IPC Config](#ipc-config)
|
|
||||||
1. [IPC Methods](#ipc-methods)
|
|
||||||
1. [log](#log)
|
|
||||||
2. [connectTo](#connectto)
|
|
||||||
3. [connectToNet](#connecttonet)
|
|
||||||
4. [disconnect](#disconnect)
|
|
||||||
5. [serve](#serve)
|
|
||||||
6. [serveNet](#servenet)
|
|
||||||
1. [IPC Stores and Default Variables](#ipc-stores-and-default-variables)
|
|
||||||
1. [IPC Events](#ipc-events)
|
|
||||||
1. [Multiple IPC instances](#multiple-ipc-instances)
|
|
||||||
1. [Basic Examples](#basic-examples)
|
|
||||||
1. [Server for Unix||Windows Sockets & TCP Sockets](#server-for-unix-sockets-windows-sockets--tcp-sockets)
|
|
||||||
2. [Client for Unix||Windows Sockets & TCP Sockets](#client-for-unix-sockets--tcp-sockets)
|
|
||||||
3. [Server & Client for UDP Sockets](#server--client-for-udp-sockets)
|
|
||||||
4. [Raw Buffers, Real Time and / or Binary Sockets](#raw-buffer-or-binary-sockets)
|
|
||||||
1. [Working with TLS/SSL Socket Servers & Clients](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/TLSSocket)
|
|
||||||
1. [Node Code Examples](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#### Types of IPC Sockets
|
|
||||||
|
|
||||||
| Type | Stability | Definition |
|
|
||||||
| ----------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| Unix Socket or Windows Socket | Stable | Gives Linux, Mac, and Windows lightning fast communication and avoids the network card to reduce overhead and latency. [Local Unix and Windows Socket examples ](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/unixWindowsSocket/ "Unix and Windows Socket Node IPC examples") |
|
|
||||||
| TCP Socket | Stable | Gives the most reliable communication across the network. Can be used for local IPC as well, but is slower than #1's Unix Socket Implementation because TCP sockets go through the network card while Unix Sockets and Windows Sockets do not. [Local or remote network TCP Socket examples ](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/TCPSocket/ "TCP Socket Node IPC examples") |
|
|
||||||
| TLS Socket | Stable | Configurable and secure network socket over SSL. Equivalent to https. [TLS/SSL documentation](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/TLSSocket) |
|
|
||||||
| UDP Sockets | Stable | Gives the **fastest network communication**. UDP is less reliable but much faster than TCP. It is best used for streaming non critical data like sound, video, or multiplayer game data as it can drop packets depending on network connectivity and other factors. UDP can be used for local IPC as well, but is slower than #1's Unix Socket or Windows Socket Implementation because UDP sockets go through the network card while Unix and Windows Sockets do not. [Local or remote network UDP Socket examples ](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/UDPSocket/ "UDP Socket Node IPC examples") |
|
|
||||||
|
|
||||||
| OS | Supported Sockets |
|
|
||||||
| ----- | -------------------------- |
|
|
||||||
| Linux | Unix, Posix, TCP, TLS, UDP |
|
|
||||||
| Mac | Unix, Posix, TCP, TLS, UDP |
|
|
||||||
| Win | Windows, TCP, TLS, UDP |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#### IPC Config
|
|
||||||
|
|
||||||
`ipc.config`
|
|
||||||
|
|
||||||
Set these variables in the `ipc.config` scope to overwrite or set default values.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
{
|
|
||||||
appspace : 'app.',
|
|
||||||
socketRoot : '/tmp/',
|
|
||||||
id : os.hostname(),
|
|
||||||
networkHost : 'localhost', //should resolve to 127.0.0.1 or ::1 see the table below related to this
|
|
||||||
networkPort : 8000,
|
|
||||||
readableAll : false,
|
|
||||||
writableAll : false,
|
|
||||||
encoding : 'utf8',
|
|
||||||
rawBuffer : false,
|
|
||||||
delimiter : '\f',
|
|
||||||
sync : false,
|
|
||||||
silent : false,
|
|
||||||
logInColor : true,
|
|
||||||
logDepth : 5,
|
|
||||||
logger : console.log,
|
|
||||||
maxConnections : 100,
|
|
||||||
retry : 500,
|
|
||||||
maxRetries : false,
|
|
||||||
stopRetrying : false,
|
|
||||||
unlink : true,
|
|
||||||
interfaces : {
|
|
||||||
localAddress: false,
|
|
||||||
localPort : false,
|
|
||||||
family : false,
|
|
||||||
hints : false,
|
|
||||||
lookup : false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
| variable | documentation |
|
|
||||||
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| appspace | used for Unix Socket (Unix Domain Socket) namespacing. If not set specifically, the Unix Domain Socket will combine the socketRoot, appspace, and id to form the Unix Socket Path for creation or binding. This is available in case you have many apps running on your system, you may have several sockets with the same id, but if you change the appspace, you will still have app specic unique sockets. |
|
|
||||||
| socketRoot | the directory in which to create or bind to a Unix Socket |
|
|
||||||
| id | the id of this socket or service |
|
|
||||||
| networkHost | the local or remote host on which TCP, TLS or UDP Sockets should connect |
|
|
||||||
| networkPort | the default port on which TCP, TLS, or UDP sockets should connect |
|
|
||||||
| readableAll | makes the pipe readable for all users including windows services |
|
|
||||||
| writableAll | makes the pipe writable for all users including windows services |
|
|
||||||
| encoding | the default encoding for data sent on sockets. Mostly used if rawBuffer is set to true. Valid values are : ` ascii` `utf8` ` utf16le` ` ucs2` ` base64` `hex` . |
|
|
||||||
| rawBuffer | if true, data will be sent and received as a raw node `Buffer` **NOT** an `Object` as JSON. This is great for Binary or hex IPC, and communicating with other processes in languages like C and C++ |
|
|
||||||
| delimiter | the delimiter at the end of each data packet. |
|
|
||||||
| sync | synchronous requests. Clients will not send new requests until the server answers. |
|
|
||||||
| silent | turn on/off logging default is false which means logging is on |
|
|
||||||
| logInColor | turn on/off util.inspect colors for ipc.log |
|
|
||||||
| logDepth | set the depth for util.inspect during ipc.log |
|
|
||||||
| logger | the function which receives the output from ipc.log; should take a single string argument |
|
|
||||||
| maxConnections | this is the max number of connections allowed to a socket. It is currently only being set on Unix Sockets. Other Socket types are using the system defaults. |
|
|
||||||
| retry | this is the time in milliseconds a client will wait before trying to reconnect to a server if the connection is lost. This does not effect UDP sockets since they do not have a client server relationship like Unix Sockets and TCP Sockets. |
|
|
||||||
| maxRetries | if set, it represents the maximum number of retries after each disconnect before giving up and completely killing a specific connection |
|
|
||||||
| stopRetrying | Defaults to false meaning clients will continue to retry to connect to servers indefinitely at the retry interval. If set to any number the client will stop retrying when that number is exceeded after each disconnect. If set to true in real time it will immediately stop trying to connect regardless of maxRetries. If set to 0, the client will **_NOT_** try to reconnect. |
|
|
||||||
| unlink | Defaults to true meaning that the module will take care of deleting the IPC socket prior to startup. If you use `@achrinza/node-ipc` in a clustered environment where there will be multiple listeners on the same socket, you must set this to `false` and then take care of deleting the socket in your own code. |
|
|
||||||
| interfaces | primarily used when specifying which interface a client should connect through. see the [socket.connect documentation in the node.js api](https://nodejs.org/api/net.html#net_socket_connect_options_connectlistener) |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#### IPC Methods
|
|
||||||
|
|
||||||
These methods are available in the IPC Scope.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
##### log
|
|
||||||
|
|
||||||
`ipc.log(a,b,c,d,e...);`
|
|
||||||
|
|
||||||
ipc.log will accept any number of arguments and if `ipc.config.silent` is not set, it will concat them all with a single space ' ' between them and then log them to the console. This is fast because it prevents any concatenation from happening if the ipc.config.silent is set `true`. That way if you leave your logging in place it should have almost no effect on performance.
|
|
||||||
|
|
||||||
The log also uses util.inspect You can control if it should log in color, the log depth, and the destination via `ipc.config`
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.config.logInColor = true; //default
|
|
||||||
ipc.config.logDepth = 5; //default
|
|
||||||
ipc.config.logger = console.log.bind(console); // default
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
##### connectTo
|
|
||||||
|
|
||||||
`ipc.connectTo(id,path,callback);`
|
|
||||||
|
|
||||||
Used for connecting as a client to local Unix Sockets and Windows Sockets. **_This is the fastest way for processes on the same machine to communicate_** because it bypasses the network card which TCP and UDP must both use.
|
|
||||||
|
|
||||||
| variable | required | definition |
|
|
||||||
| -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
||||||
| id | required | is the string id of the socket being connected to. The socket with this id is added to the ipc.of object when created. |
|
|
||||||
| path | optional | is the path of the Unix Domain Socket File, if the System is Windows, this will automatically be converted to an appropriate pipe with the same information as the Unix Domain Socket File. If not set this will default to `ipc.config.socketRoot`+`ipc.config.appspace`+`id` |
|
|
||||||
| callback | optional | this is the function to execute when the socket has been created. |
|
|
||||||
|
|
||||||
**examples** arguments can be ommitted so long as they are still in order.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.connectTo("world");
|
|
||||||
```
|
|
||||||
|
|
||||||
or using just an id and a callback
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.connectTo("world", function () {
|
|
||||||
ipc.of.world.on("hello", function (data) {
|
|
||||||
ipc.log(data.debug);
|
|
||||||
//if data was a string, it would have the color set to the debug style applied to it
|
|
||||||
});
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
or explicitly setting the path
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.connectTo("world", "myapp.world");
|
|
||||||
```
|
|
||||||
|
|
||||||
or explicitly setting the path with callback
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
ipc.connectTo(
|
|
||||||
'world',
|
|
||||||
'myapp.world',
|
|
||||||
function(){
|
|
||||||
...
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
##### connectToNet
|
|
||||||
|
|
||||||
`ipc.connectToNet(id,host,port,callback)`
|
|
||||||
|
|
||||||
Used to connect as a client to a TCP or [TLS socket](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/TLSSocket) via the network card. This can be local or remote, if local, it is recommended that you use the Unix and Windows Socket Implementaion of `connectTo` instead as it is much faster since it avoids the network card altogether.
|
|
||||||
|
|
||||||
For TLS and SSL Sockets see the [@achrinza/node-ipc TLS and SSL docs](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/TLSSocket). They have a few additional requirements, and things to know about and so have their own doc.
|
|
||||||
|
|
||||||
| variable | required | definition |
|
|
||||||
| -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| id | required | is the string id of the socket being connected to. For TCP & TLS sockets, this id is added to the `ipc.of` object when the socket is created with a reference to the socket. |
|
|
||||||
| host | optional | is the host on which the TCP or TLS socket resides. This will default to `ipc.config.networkHost` if not specified. |
|
|
||||||
| port | optional | the port on which the TCP or TLS socket resides. |
|
|
||||||
| callback | optional | this is the function to execute when the socket has been created. |
|
|
||||||
|
|
||||||
**examples** arguments can be ommitted so long as they are still in order.
|
|
||||||
So while the default is : (id,host,port,callback), the following examples will still work because they are still in order (id,port,callback) or (id,host,callback) or (id,port) etc.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.connectToNet("world");
|
|
||||||
```
|
|
||||||
|
|
||||||
or using just an id and a callback
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
ipc.connectToNet(
|
|
||||||
'world',
|
|
||||||
function(){
|
|
||||||
...
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
or explicitly setting the host and path
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
ipc.connectToNet(
|
|
||||||
'world',
|
|
||||||
'myapp.com',serve(path,callback)
|
|
||||||
3435
|
|
||||||
);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
or only explicitly setting port and callback
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
ipc.connectToNet(
|
|
||||||
'world',
|
|
||||||
3435,
|
|
||||||
function(){
|
|
||||||
...
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
##### disconnect
|
|
||||||
|
|
||||||
`ipc.disconnect(id)`
|
|
||||||
|
|
||||||
Used to disconnect a client from a Unix, Windows, TCP or TLS socket. The socket and its refrence will be removed from memory and the `ipc.of` scope. This can be local or remote. UDP clients do not maintain connections and so there are no Clients and this method has no value to them.
|
|
||||||
|
|
||||||
| variable | required | definition |
|
|
||||||
| -------- | -------- | -------------------------------------------------------- |
|
|
||||||
| id | required | is the string id of the socket from which to disconnect. |
|
|
||||||
|
|
||||||
**examples**
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.disconnect("world");
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
##### serve
|
|
||||||
|
|
||||||
`ipc.serve(path,callback);`
|
|
||||||
|
|
||||||
Used to create local Unix Socket Server or Windows Socket Server to which Clients can bind. The server can `emit` events to specific Client Sockets, or `broadcast` events to all known Client Sockets.
|
|
||||||
|
|
||||||
| variable | required | definition |
|
|
||||||
| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| path | optional | This is the path of the Unix Domain Socket File, if the System is Windows, this will automatically be converted to an appropriate pipe with the same information as the Unix Domain Socket File. If not set this will default to `ipc.config.socketRoot`+`ipc.config.appspace`+`id` |
|
|
||||||
| callback | optional | This is a function to be called after the Server has started. This can also be done by binding an event to the start event like `ipc.server.on('start',function(){});` |
|
|
||||||
|
|
||||||
**_examples_** arguments can be omitted so long as they are still in order.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.serve();
|
|
||||||
```
|
|
||||||
|
|
||||||
or specifying callback
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
ipc.serve(
|
|
||||||
function(){...}
|
|
||||||
);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
or specify path
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.serve("/tmp/myapp.myservice");
|
|
||||||
```
|
|
||||||
|
|
||||||
or specifying everything
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
ipc.serve(
|
|
||||||
'/tmp/myapp.myservice',
|
|
||||||
function(){...}
|
|
||||||
);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
##### serveNet
|
|
||||||
|
|
||||||
`serveNet(host,port,UDPType,callback)`
|
|
||||||
|
|
||||||
Used to create TCP, TLS or UDP Socket Server to which Clients can bind or other servers can send data to. The server can `emit` events to specific Client Sockets, or `broadcast` events to all known Client Sockets.
|
|
||||||
|
|
||||||
| variable | required | definition |
|
|
||||||
| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| host | optional | If not specified this defaults to the first address in os.networkInterfaces(). For TCP, TLS & UDP servers this is most likely going to be 127.0.0.1 or ::1 |
|
|
||||||
| port | optional | The port on which the TCP, UDP, or TLS Socket server will be bound, this defaults to 8000 if not specified |
|
|
||||||
| UDPType | optional | If set this will create the server as a UDP socket. 'udp4' or 'udp6' are valid values. This defaults to not being set. When using udp6 make sure to specify a valid IPv6 host, like `::1` |
|
|
||||||
| callback | optional | Function to be called when the server is created |
|
|
||||||
|
|
||||||
**_examples_** arguments can be ommitted solong as they are still in order.
|
|
||||||
|
|
||||||
default tcp server
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.serveNet();
|
|
||||||
```
|
|
||||||
|
|
||||||
default udp server
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.serveNet("udp4");
|
|
||||||
```
|
|
||||||
|
|
||||||
or specifying TCP server with callback
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
ipc.serveNet(
|
|
||||||
function(){...}
|
|
||||||
);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
or specifying UDP server with callback
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
ipc.serveNet(
|
|
||||||
'udp4',
|
|
||||||
function(){...}
|
|
||||||
);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
or specify port
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.serveNet(3435);
|
|
||||||
```
|
|
||||||
|
|
||||||
or specifying everything TCP
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
ipc.serveNet(
|
|
||||||
'MyMostAwesomeApp.com',
|
|
||||||
3435,
|
|
||||||
function(){...}
|
|
||||||
);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
or specifying everything UDP
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
|
|
||||||
ipc.serveNet(
|
|
||||||
'MyMostAwesomeApp.com',
|
|
||||||
3435,
|
|
||||||
'udp4',
|
|
||||||
function(){...}
|
|
||||||
);
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### IPC Stores and Default Variables
|
|
||||||
|
|
||||||
| variable | definition |
|
|
||||||
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| ipc.of | This is where socket connection refrences will be stored when connecting to them as a client via the `ipc.connectTo` or `iupc.connectToNet`. They will be stored based on the ID used to create them, eg : ipc.of.mySocket |
|
|
||||||
| ipc.server | This is a refrence to the server created by `ipc.serve` or `ipc.serveNet` |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### IPC Server Methods
|
|
||||||
|
|
||||||
| method | definition |
|
|
||||||
| ------ | --------------------------------------------------------------------------- |
|
|
||||||
| start | start serving need to call `serve` or `serveNet` first to set up the server |
|
|
||||||
| stop | close the server and stop serving |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### IPC Events
|
|
||||||
|
|
||||||
| event name | params | definition |
|
|
||||||
| --------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| error | err obj | triggered when an error has occured |
|
|
||||||
| connect | | triggered when socket connected |
|
|
||||||
| disconnect | | triggered by client when socket has disconnected from server |
|
|
||||||
| socket.disconnected | socket destroyedSocketID | triggered by server when a client socket has disconnected |
|
|
||||||
| destroy | | triggered when socket has been totally destroyed, no further auto retries will happen and all references are gone. |
|
|
||||||
| data | buffer | triggered when ipc.config.rawBuffer is true and a message is received. |
|
|
||||||
| **_your event type_** | **_your event data_** | triggered when a JSON message is received. The event name will be the type string from your message and the param will be the data object from your message eg : `{ type:'myEvent',data:{a:1}}` |
|
|
||||||
|
|
||||||
### Multiple IPC Instances
|
|
||||||
|
|
||||||
Sometimes you might need explicit and independent instances of @achrinza/node-ipc. Just for such scenarios we have exposed the core IPC class on the IPC singleton.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
const RawIPC = require("@achrinza/node-ipc").IPC;
|
|
||||||
const ipc = new RawIPC();
|
|
||||||
const someOtherExplicitIPC = new RawIPC();
|
|
||||||
|
|
||||||
//OR
|
|
||||||
|
|
||||||
const ipc = require("@achrinza/node-ipc");
|
|
||||||
const someOtherExplicitIPC = new ipc.IPC();
|
|
||||||
|
|
||||||
//setting explicit configs
|
|
||||||
|
|
||||||
//keep one silent and the other verbose
|
|
||||||
ipc.config.silent = true;
|
|
||||||
someOtherExplicitIPC.config.silent = true;
|
|
||||||
|
|
||||||
//make one a raw binary and the other json based ipc
|
|
||||||
ipc.config.rawBuffer = false;
|
|
||||||
|
|
||||||
someOtherExplicitIPC.config.rawBuffer = true;
|
|
||||||
someOtherExplicitIPC.config.encoding = "hex";
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Basic Examples
|
|
||||||
|
|
||||||
You can find [Advanced Examples](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example) in the examples folder. In the examples you will find more complex demos including multi client examples.
|
|
||||||
|
|
||||||
#### Server for Unix Sockets, Windows Sockets & TCP Sockets
|
|
||||||
|
|
||||||
The server is the process keeping a socket for IPC open. Multiple sockets can connect to this server and talk to it. It can also broadcast to all clients or emit to a specific client. This is the most basic example which will work for local Unix and Windows Sockets as well as local or remote network TCP Sockets.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var ipc = require("@achrinza/node-ipc");
|
|
||||||
|
|
||||||
ipc.config.id = "world";
|
|
||||||
ipc.config.retry = 1500;
|
|
||||||
|
|
||||||
ipc.serve(function () {
|
|
||||||
ipc.server.on("message", function (data, socket) {
|
|
||||||
ipc.log("got a message : ".debug, data);
|
|
||||||
ipc.server.emit(
|
|
||||||
socket,
|
|
||||||
"message", //this can be anything you want so long as
|
|
||||||
//your client knows.
|
|
||||||
data + " world!"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
ipc.server.on("socket.disconnected", function (socket, destroyedSocketID) {
|
|
||||||
ipc.log("client " + destroyedSocketID + " has disconnected!");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
ipc.server.start();
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Client for Unix Sockets & TCP Sockets
|
|
||||||
|
|
||||||
The client connects to the servers socket for Inter Process Communication. The socket will receive events emitted to it specifically as well as events which are broadcast out on the socket by the server. This is the most basic example which will work for both local Unix Sockets and local or remote network TCP Sockets.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var ipc = require("@achrinza/node-ipc");
|
|
||||||
|
|
||||||
ipc.config.id = "hello";
|
|
||||||
ipc.config.retry = 1500;
|
|
||||||
|
|
||||||
ipc.connectTo("world", function () {
|
|
||||||
ipc.of.world.on("connect", function () {
|
|
||||||
ipc.log("## connected to world ##".rainbow, ipc.config.delay);
|
|
||||||
ipc.of.world.emit(
|
|
||||||
"message", //any event or message type your server listens for
|
|
||||||
"hello"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
ipc.of.world.on("disconnect", function () {
|
|
||||||
ipc.log("disconnected from world".notice);
|
|
||||||
});
|
|
||||||
ipc.of.world.on(
|
|
||||||
"message", //any event or message type your server listens for
|
|
||||||
function (data) {
|
|
||||||
ipc.log("got a message from world : ".debug, data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Server & Client for UDP Sockets
|
|
||||||
|
|
||||||
UDP Sockets are different than Unix, Windows & TCP Sockets because they must be bound to a unique port on their machine to receive messages. For example, A TCP, Unix, or Windows Socket client could just connect to a separate TCP, Unix, or Windows Socket sever. That client could then exchange, both send and receive, data on the servers port or location. UDP Sockets can not do this. They must bind to a port to receive or send data.
|
|
||||||
|
|
||||||
This means a UDP Client and Server are the same thing because in order to receive data, a UDP Socket must have its own port to receive data on, and only one process can use this port at a time. It also means that in order to `emit` or `broadcast` data the UDP server will need to know the host and port of the Socket it intends to broadcast the data to.
|
|
||||||
|
|
||||||
This is the most basic example which will work for both local and remote UDP Sockets.
|
|
||||||
|
|
||||||
##### UDP Server 1 - "World"
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var ipc = require("../../../@achrinza/node-ipc");
|
|
||||||
|
|
||||||
ipc.config.id = "world";
|
|
||||||
ipc.config.retry = 1500;
|
|
||||||
|
|
||||||
ipc.serveNet("udp4", function () {
|
|
||||||
console.log(123);
|
|
||||||
ipc.server.on("message", function (data, socket) {
|
|
||||||
ipc.log(
|
|
||||||
"got a message from ".debug,
|
|
||||||
data.from.variable,
|
|
||||||
" : ".debug,
|
|
||||||
data.message.variable
|
|
||||||
);
|
|
||||||
ipc.server.emit(socket, "message", {
|
|
||||||
from: ipc.config.id,
|
|
||||||
message: data.message + " world!",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(ipc.server);
|
|
||||||
});
|
|
||||||
|
|
||||||
ipc.server.start();
|
|
||||||
```
|
|
||||||
|
|
||||||
##### UDP Server 2 - "Hello"
|
|
||||||
|
|
||||||
_note_ we set the port here to 8001 because the world server is already using the default ipc.config.networkPort of 8000. So we can not bind to 8000 while world is using it.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.config.id = "hello";
|
|
||||||
ipc.config.retry = 1500;
|
|
||||||
|
|
||||||
ipc.serveNet(8001, "udp4", function () {
|
|
||||||
ipc.server.on("message", function (data) {
|
|
||||||
ipc.log("got Data");
|
|
||||||
ipc.log(
|
|
||||||
"got a message from ".debug,
|
|
||||||
data.from.variable,
|
|
||||||
" : ".debug,
|
|
||||||
data.message.variable
|
|
||||||
);
|
|
||||||
});
|
|
||||||
ipc.server.emit(
|
|
||||||
{
|
|
||||||
address: "127.0.0.1", //any hostname will work
|
|
||||||
port: ipc.config.networkPort,
|
|
||||||
},
|
|
||||||
"message",
|
|
||||||
{
|
|
||||||
from: ipc.config.id,
|
|
||||||
message: "Hello",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
ipc.server.start();
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Raw Buffer or Binary Sockets
|
|
||||||
|
|
||||||
Binary or Buffer sockets can be used with any of the above socket types, however the way data events are emit is **_slightly_** different. These may come in handy if working with embedded systems or C / C++ processes. You can even make sure to match C or C++ string typing.
|
|
||||||
|
|
||||||
When setting up a rawBuffer socket you must specify it as such :
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.config.rawBuffer = true;
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also specify its encoding type. The default is `utf8`
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.config.encoding = "utf8";
|
|
||||||
```
|
|
||||||
|
|
||||||
emit string buffer :
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
//server
|
|
||||||
ipc.server.emit(socket, "hello");
|
|
||||||
|
|
||||||
//client
|
|
||||||
ipc.of.world.emit("hello");
|
|
||||||
```
|
|
||||||
|
|
||||||
emit byte array buffer :
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
//hex encoding may work best for this.
|
|
||||||
ipc.config.encoding = "hex";
|
|
||||||
|
|
||||||
//server
|
|
||||||
ipc.server.emit(socket, [10, 20, 30]);
|
|
||||||
|
|
||||||
//client
|
|
||||||
ipc.server.emit([10, 20, 30]);
|
|
||||||
```
|
|
||||||
|
|
||||||
emit binary or hex array buffer, this is best for real time data transfer, especially whan connecting to C or C++ processes, or embedded systems :
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.config.encoding = "hex";
|
|
||||||
|
|
||||||
//server
|
|
||||||
ipc.server.emit(socket, [0x05, 0x6d, 0x5c]);
|
|
||||||
|
|
||||||
//client
|
|
||||||
ipc.server.emit([0x05, 0x6d, 0x5c]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Writing explicit buffers, int types, doubles, floats etc. as well as big endian and little endian data to raw buffer nostly valuable when connecting to C or C++ processes, or embedded systems (see more detailed info on buffers as well as UInt, Int, double etc. here)[https://nodejs.org/api/buffer.html]:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
ipc.config.encoding = "hex";
|
|
||||||
|
|
||||||
//make a 6 byte buffer for example
|
|
||||||
const myBuffer = Buffer.alloc(6).fill(0);
|
|
||||||
|
|
||||||
//fill the first 2 bytes with a 16 bit (2 byte) short unsigned int
|
|
||||||
|
|
||||||
//write a UInt16 (2 byte or short) as Big Endian
|
|
||||||
myBuffer.writeUInt16BE(
|
|
||||||
2, //value to write
|
|
||||||
0 //offset in bytes
|
|
||||||
);
|
|
||||||
//OR
|
|
||||||
myBuffer.writeUInt16LE(0x2, 0);
|
|
||||||
//OR
|
|
||||||
myBuffer.writeUInt16LE(0x02, 0);
|
|
||||||
|
|
||||||
//fill the remaining 4 bytes with a 32 bit (4 byte) long unsigned int
|
|
||||||
|
|
||||||
//write a UInt32 (4 byte or long) as Big Endian
|
|
||||||
myBuffer.writeUInt32BE(
|
|
||||||
16772812, //value to write
|
|
||||||
2 //offset in bytes
|
|
||||||
);
|
|
||||||
//OR
|
|
||||||
myBuffer.writeUInt32BE(0xffeecc, 0);
|
|
||||||
|
|
||||||
//server
|
|
||||||
ipc.server.emit(socket, myBuffer);
|
|
||||||
|
|
||||||
//client
|
|
||||||
ipc.server.emit(myBuffer);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Server with the `cluster` Module
|
|
||||||
|
|
||||||
`@achrinza/node-ipc` can be used with Node.js' [cluster module](https://nodejs.org/api/cluster.html) to provide the ability to have multiple readers for a single socket. Doing so simply requires you to set the `unlink` property in the config to `false` and take care of unlinking the socket path in the master process:
|
|
||||||
|
|
||||||
##### Server
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
const fs = require("fs");
|
|
||||||
const ipc = require("../../../@achrinza/node-ipc");
|
|
||||||
const cpuCount = require("os").cpus().length;
|
|
||||||
const cluster = require("cluster");
|
|
||||||
const socketPath = "/tmp/ipc.sock";
|
|
||||||
|
|
||||||
ipc.config.unlink = false;
|
|
||||||
|
|
||||||
if (cluster.isMaster) {
|
|
||||||
if (fs.existsSync(socketPath)) {
|
|
||||||
fs.unlinkSync(socketPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < cpuCount; i++) {
|
|
||||||
cluster.fork();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ipc.serve(socketPath, function () {
|
|
||||||
ipc.server.on("currentDate", function (data, socket) {
|
|
||||||
console.log(`pid ${process.pid} got: `, data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
ipc.server.start();
|
|
||||||
console.log(`pid ${process.pid} listening on ${socketPath}`);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
##### Client
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
const fs = require("fs");
|
|
||||||
const ipc = require("../../@achrinza/node-ipc");
|
|
||||||
|
|
||||||
const socketPath = "/tmp/ipc.sock";
|
|
||||||
|
|
||||||
//loop forever so you can see the pid of the cluster sever change in the logs
|
|
||||||
setInterval(function () {
|
|
||||||
ipc.connectTo("world", socketPath, connecting);
|
|
||||||
}, 2000);
|
|
||||||
|
|
||||||
function connecting(socket) {
|
|
||||||
ipc.of.world.on("connect", function () {
|
|
||||||
ipc.of.world.emit("currentDate", {
|
|
||||||
message: new Date().toISOString(),
|
|
||||||
});
|
|
||||||
ipc.disconnect("world");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Licensed under MIT license
|
|
||||||
|
|
||||||
See the [MIT license](https://github.com/RIAEvangelist/@achrinza/node-ipc/blob/master/license) file.
|
|
256
node_modules/@achrinza/node-ipc/dao/client.js
generated
vendored
256
node_modules/@achrinza/node-ipc/dao/client.js
generated
vendored
@ -1,256 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const net = require('net'),
|
|
||||||
tls = require('tls'),
|
|
||||||
EventParser = require('../entities/EventParser.js'),
|
|
||||||
Message = require('js-message'),
|
|
||||||
fs = require('fs'),
|
|
||||||
Queue = require('@node-ipc/js-queue'),
|
|
||||||
Events = require('event-pubsub');
|
|
||||||
|
|
||||||
let eventParser = new EventParser();
|
|
||||||
|
|
||||||
class Client extends Events{
|
|
||||||
constructor(config,log){
|
|
||||||
super();
|
|
||||||
Object.assign(
|
|
||||||
this,
|
|
||||||
{
|
|
||||||
Client : Client,
|
|
||||||
config : config,
|
|
||||||
queue : new Queue,
|
|
||||||
socket : false,
|
|
||||||
connect : connect,
|
|
||||||
emit : emit,
|
|
||||||
log : log,
|
|
||||||
retriesRemaining:config.maxRetries||0,
|
|
||||||
explicitlyDisconnected: false
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
eventParser=new EventParser(this.config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function emit(type,data){
|
|
||||||
this.log('dispatching event to ', this.id, this.path, ' : ', type, ',', data);
|
|
||||||
|
|
||||||
let message=new Message;
|
|
||||||
message.type=type;
|
|
||||||
message.data=data;
|
|
||||||
|
|
||||||
if(this.config.rawBuffer){
|
|
||||||
message=Buffer.from(type,this.config.encoding);
|
|
||||||
}else{
|
|
||||||
message=eventParser.format(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this.config.sync){
|
|
||||||
this.socket.write(message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.queue.add(
|
|
||||||
syncEmit.bind(this,message)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function syncEmit(message){
|
|
||||||
this.log('dispatching event to ', this.id, this.path, ' : ', message);
|
|
||||||
this.socket.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
function connect(){
|
|
||||||
//init client object for scope persistance especially inside of socket events.
|
|
||||||
let client=this;
|
|
||||||
|
|
||||||
client.log('requested connection to ', client.id, client.path);
|
|
||||||
if(!this.path){
|
|
||||||
client.log('\n\n######\nerror: ', client.id ,' client has not specified socket path it wishes to connect to.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const options={};
|
|
||||||
|
|
||||||
if(!client.port){
|
|
||||||
client.log('Connecting client on Unix Socket :', client.path);
|
|
||||||
|
|
||||||
options.path=client.path;
|
|
||||||
|
|
||||||
if (process.platform ==='win32' && !client.path.startsWith('\\\\.\\pipe\\')){
|
|
||||||
options.path = options.path.replace(/^\//, '');
|
|
||||||
options.path = options.path.replace(/\//g, '-');
|
|
||||||
options.path= `\\\\.\\pipe\\${options.path}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
client.socket = net.connect(options);
|
|
||||||
}else{
|
|
||||||
options.host=client.path;
|
|
||||||
options.port=client.port;
|
|
||||||
|
|
||||||
if(client.config.interface.localAddress){
|
|
||||||
options.localAddress=client.config.interface.localAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(client.config.interface.localPort){
|
|
||||||
options.localPort=client.config.interface.localPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(client.config.interface.family){
|
|
||||||
options.family=client.config.interface.family;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(client.config.interface.hints){
|
|
||||||
options.hints=client.config.interface.hints;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(client.config.interface.lookup){
|
|
||||||
options.lookup=client.config.interface.lookup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!client.config.tls){
|
|
||||||
client.log('Connecting client via TCP to', options);
|
|
||||||
client.socket = net.connect(options);
|
|
||||||
}else{
|
|
||||||
client.log('Connecting client via TLS to', client.path ,client.port,client.config.tls);
|
|
||||||
if(client.config.tls.private){
|
|
||||||
client.config.tls.key=fs.readFileSync(client.config.tls.private);
|
|
||||||
}
|
|
||||||
if(client.config.tls.public){
|
|
||||||
client.config.tls.cert=fs.readFileSync(client.config.tls.public);
|
|
||||||
}
|
|
||||||
if(client.config.tls.trustedConnections){
|
|
||||||
if(typeof client.config.tls.trustedConnections === 'string'){
|
|
||||||
client.config.tls.trustedConnections=[client.config.tls.trustedConnections];
|
|
||||||
}
|
|
||||||
client.config.tls.ca=[];
|
|
||||||
for(let i=0; i<client.config.tls.trustedConnections.length; i++){
|
|
||||||
client.config.tls.ca.push(
|
|
||||||
fs.readFileSync(client.config.tls.trustedConnections[i])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.assign(client.config.tls,options);
|
|
||||||
|
|
||||||
client.socket = tls.connect(
|
|
||||||
client.config.tls
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
client.socket.setEncoding(this.config.encoding);
|
|
||||||
|
|
||||||
client.socket.on(
|
|
||||||
'error',
|
|
||||||
function(err){
|
|
||||||
client.log('\n\n######\nerror: ', err);
|
|
||||||
client.publish('error', err);
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
client.socket.on(
|
|
||||||
'connect',
|
|
||||||
function connectionMade(){
|
|
||||||
client.publish('connect');
|
|
||||||
client.retriesRemaining=client.config.maxRetries;
|
|
||||||
client.log('retrying reset');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
client.socket.on(
|
|
||||||
'close',
|
|
||||||
function connectionClosed(){
|
|
||||||
client.log('connection closed' ,client.id , client.path,
|
|
||||||
client.retriesRemaining, 'tries remaining of', client.config.maxRetries
|
|
||||||
);
|
|
||||||
|
|
||||||
if(
|
|
||||||
client.config.stopRetrying ||
|
|
||||||
client.retriesRemaining<1 ||
|
|
||||||
client.explicitlyDisconnected
|
|
||||||
|
|
||||||
){
|
|
||||||
client.publish('disconnect');
|
|
||||||
client.log(
|
|
||||||
(client.config.id),
|
|
||||||
'exceeded connection rety amount of',
|
|
||||||
' or stopRetrying flag set.'
|
|
||||||
);
|
|
||||||
|
|
||||||
client.socket.destroy();
|
|
||||||
client.publish('destroy');
|
|
||||||
client=undefined;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(
|
|
||||||
function retryTimeout(){
|
|
||||||
if (client.explicitlyDisconnected) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
client.retriesRemaining--;
|
|
||||||
client.connect();
|
|
||||||
}.bind(null,client),
|
|
||||||
client.config.retry
|
|
||||||
);
|
|
||||||
|
|
||||||
client.publish('disconnect');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
client.socket.on(
|
|
||||||
'data',
|
|
||||||
function(data) {
|
|
||||||
client.log('## received events ##');
|
|
||||||
if(client.config.rawBuffer){
|
|
||||||
client.publish(
|
|
||||||
'data',
|
|
||||||
Buffer.from(data,client.config.encoding)
|
|
||||||
);
|
|
||||||
if(!client.config.sync){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
client.queue.next();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this.ipcBuffer){
|
|
||||||
this.ipcBuffer='';
|
|
||||||
}
|
|
||||||
|
|
||||||
data=(this.ipcBuffer+=data);
|
|
||||||
|
|
||||||
if(data.slice(-1)!=eventParser.delimiter || data.indexOf(eventParser.delimiter) == -1){
|
|
||||||
client.log('Messages are large, You may want to consider smaller messages.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.ipcBuffer='';
|
|
||||||
|
|
||||||
const events = eventParser.parse(data);
|
|
||||||
const eCount = events.length;
|
|
||||||
for(let i=0; i<eCount; i++){
|
|
||||||
let message=new Message;
|
|
||||||
message.load(events[i]);
|
|
||||||
|
|
||||||
client.log('detected event', message.type, message.data);
|
|
||||||
client.publish(
|
|
||||||
message.type,
|
|
||||||
message.data
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!client.config.sync){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
client.queue.next();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports=Client;
|
|
399
node_modules/@achrinza/node-ipc/dao/socketServer.js
generated
vendored
399
node_modules/@achrinza/node-ipc/dao/socketServer.js
generated
vendored
@ -1,399 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const net = require('net'),
|
|
||||||
tls = require('tls'),
|
|
||||||
fs = require('fs'),
|
|
||||||
dgram = require('dgram'),
|
|
||||||
EventParser = require('../entities/EventParser.js'),
|
|
||||||
Message = require('js-message'),
|
|
||||||
Events = require('event-pubsub');
|
|
||||||
|
|
||||||
let eventParser = new EventParser();
|
|
||||||
|
|
||||||
class Server extends Events{
|
|
||||||
constructor(path,config,log,port){
|
|
||||||
super();
|
|
||||||
Object.assign(
|
|
||||||
this,
|
|
||||||
{
|
|
||||||
config : config,
|
|
||||||
path : path,
|
|
||||||
port : port,
|
|
||||||
udp4 : false,
|
|
||||||
udp6 : false,
|
|
||||||
log : log,
|
|
||||||
server : false,
|
|
||||||
sockets : [],
|
|
||||||
emit : emit,
|
|
||||||
broadcast : broadcast
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
eventParser=new EventParser(this.config);
|
|
||||||
|
|
||||||
this.on(
|
|
||||||
'close',
|
|
||||||
serverClosed.bind(this)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
onStart(socket){
|
|
||||||
this.trigger(
|
|
||||||
'start',
|
|
||||||
socket
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
stop(){
|
|
||||||
this.server.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
start(){
|
|
||||||
if(!this.path){
|
|
||||||
this.log('Socket Server Path not specified, refusing to start');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.config.unlink){
|
|
||||||
fs.unlink(
|
|
||||||
this.path,
|
|
||||||
startServer.bind(this)
|
|
||||||
);
|
|
||||||
}else{
|
|
||||||
startServer.bind(this)();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function emit(socket, type, data){
|
|
||||||
this.log('dispatching event to socket', ' : ', type, data);
|
|
||||||
|
|
||||||
let message=new Message;
|
|
||||||
message.type=type;
|
|
||||||
message.data=data;
|
|
||||||
|
|
||||||
if(this.config.rawBuffer){
|
|
||||||
this.log(this.config.encoding)
|
|
||||||
message=Buffer.from(type,this.config.encoding);
|
|
||||||
}else{
|
|
||||||
message=eventParser.format(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.udp4 || this.udp6){
|
|
||||||
|
|
||||||
if(!socket.address || !socket.port){
|
|
||||||
this.log('Attempting to emit to a single UDP socket without supplying socket address or port. Redispatching event as broadcast to all connected sockets');
|
|
||||||
this.broadcast(type,data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.server.write(
|
|
||||||
message,
|
|
||||||
socket
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
function broadcast(type,data){
|
|
||||||
this.log('broadcasting event to all known sockets listening to ', this.path,' : ', ((this.port)?this.port:''), type, data);
|
|
||||||
let message=new Message;
|
|
||||||
message.type=type;
|
|
||||||
message.data=data;
|
|
||||||
|
|
||||||
if(this.config.rawBuffer){
|
|
||||||
message=Buffer.from(type,this.config.encoding);
|
|
||||||
}else{
|
|
||||||
message=eventParser.format(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.udp4 || this.udp6){
|
|
||||||
for(let i=1, count=this.sockets.length; i<count; i++){
|
|
||||||
this.server.write(message,this.sockets[i]);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
for(let i=0, count=this.sockets.length; i<count; i++){
|
|
||||||
this.sockets[i].write(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function serverClosed(){
|
|
||||||
for(let i=0, count=this.sockets.length; i<count; i++){
|
|
||||||
let socket=this.sockets[i];
|
|
||||||
let destroyedSocketId=false;
|
|
||||||
|
|
||||||
if(socket){
|
|
||||||
if(socket.readable){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(socket.id){
|
|
||||||
destroyedSocketId=socket.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.log('socket disconnected',destroyedSocketId.toString());
|
|
||||||
|
|
||||||
if(socket && socket.destroy){
|
|
||||||
socket.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.sockets.splice(i,1);
|
|
||||||
|
|
||||||
this.publish('socket.disconnected', socket, destroyedSocketId);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function gotData(socket,data,UDPSocket){
|
|
||||||
let sock=((this.udp4 || this.udp6)? UDPSocket : socket);
|
|
||||||
if(this.config.rawBuffer){
|
|
||||||
data=Buffer.from(data,this.config.encoding);
|
|
||||||
this.publish(
|
|
||||||
'data',
|
|
||||||
data,
|
|
||||||
sock
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!sock.ipcBuffer){
|
|
||||||
sock.ipcBuffer='';
|
|
||||||
}
|
|
||||||
|
|
||||||
data=(sock.ipcBuffer+=data);
|
|
||||||
|
|
||||||
if(data.slice(-1)!=eventParser.delimiter || data.indexOf(eventParser.delimiter) == -1){
|
|
||||||
this.log('Messages are large, You may want to consider smaller messages.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sock.ipcBuffer='';
|
|
||||||
|
|
||||||
data=eventParser.parse(data);
|
|
||||||
|
|
||||||
while(data.length>0){
|
|
||||||
let message=new Message;
|
|
||||||
message.load(data.shift());
|
|
||||||
|
|
||||||
// Only set the sock id if it is specified.
|
|
||||||
if (message.data && message.data.id){
|
|
||||||
sock.id=message.data.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.log('received event of : ',message.type,message.data);
|
|
||||||
|
|
||||||
this.publish(
|
|
||||||
message.type,
|
|
||||||
message.data,
|
|
||||||
sock
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function socketClosed(socket){
|
|
||||||
this.publish(
|
|
||||||
'close',
|
|
||||||
socket
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function serverCreated(socket) {
|
|
||||||
this.sockets.push(socket);
|
|
||||||
|
|
||||||
if(socket.setEncoding){
|
|
||||||
socket.setEncoding(this.config.encoding);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.log('## socket connection to server detected ##');
|
|
||||||
socket.on(
|
|
||||||
'close',
|
|
||||||
socketClosed.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
socket.on(
|
|
||||||
'error',
|
|
||||||
function(err){
|
|
||||||
this.log('server socket error',err);
|
|
||||||
|
|
||||||
this.publish('error',err);
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
socket.on(
|
|
||||||
'data',
|
|
||||||
gotData.bind(this,socket)
|
|
||||||
);
|
|
||||||
|
|
||||||
socket.on(
|
|
||||||
'message',
|
|
||||||
function(msg,rinfo) {
|
|
||||||
if (!rinfo){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.log('Received UDP message from ', rinfo.address, rinfo.port);
|
|
||||||
let data;
|
|
||||||
|
|
||||||
if(this.config.rawSocket){
|
|
||||||
data=Buffer.from(msg,this.config.encoding);
|
|
||||||
}else{
|
|
||||||
data=msg.toString();
|
|
||||||
}
|
|
||||||
socket.emit('data',data,rinfo);
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.publish(
|
|
||||||
'connect',
|
|
||||||
socket
|
|
||||||
);
|
|
||||||
|
|
||||||
if(this.config.rawBuffer){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function startServer() {
|
|
||||||
this.log(
|
|
||||||
'starting server on ',this.path,
|
|
||||||
((this.port)?`:${this.port}`:'')
|
|
||||||
);
|
|
||||||
|
|
||||||
if(!this.udp4 && !this.udp6){
|
|
||||||
this.log('starting TLS server',this.config.tls);
|
|
||||||
if(!this.config.tls){
|
|
||||||
this.server=net.createServer(
|
|
||||||
serverCreated.bind(this)
|
|
||||||
);
|
|
||||||
}else{
|
|
||||||
startTLSServer.bind(this)();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
this.server=dgram.createSocket(
|
|
||||||
((this.udp4)? 'udp4':'udp6')
|
|
||||||
);
|
|
||||||
this.server.write=UDPWrite.bind(this);
|
|
||||||
this.server.on(
|
|
||||||
'listening',
|
|
||||||
function UDPServerStarted() {
|
|
||||||
serverCreated.bind(this)(this.server);
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.server.on(
|
|
||||||
'error',
|
|
||||||
function(err){
|
|
||||||
this.log('server error',err);
|
|
||||||
|
|
||||||
this.publish(
|
|
||||||
'error',
|
|
||||||
err
|
|
||||||
);
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.server.maxConnections=this.config.maxConnections;
|
|
||||||
|
|
||||||
if(!this.port){
|
|
||||||
this.log('starting server as', 'Unix || Windows Socket');
|
|
||||||
if (process.platform ==='win32'){
|
|
||||||
this.path = this.path.replace(/^\//, '');
|
|
||||||
this.path = this.path.replace(/\//g, '-');
|
|
||||||
this.path= `\\\\.\\pipe\\${this.path}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.server.listen({
|
|
||||||
path: this.path,
|
|
||||||
readableAll: this.config.readableAll,
|
|
||||||
writableAll: this.config.writableAll
|
|
||||||
}, this.onStart.bind(this));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this.udp4 && !this.udp6){
|
|
||||||
this.log('starting server as', (this.config.tls?'TLS':'TCP'));
|
|
||||||
this.server.listen(
|
|
||||||
this.port,
|
|
||||||
this.path,
|
|
||||||
this.onStart.bind(this)
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.log('starting server as',((this.udp4)? 'udp4':'udp6'));
|
|
||||||
|
|
||||||
this.server.bind(
|
|
||||||
this.port,
|
|
||||||
this.path
|
|
||||||
);
|
|
||||||
|
|
||||||
this.onStart(
|
|
||||||
{
|
|
||||||
address : this.path,
|
|
||||||
port : this.port
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function startTLSServer(){
|
|
||||||
this.log('starting TLS server',this.config.tls);
|
|
||||||
if(this.config.tls.private){
|
|
||||||
this.config.tls.key=fs.readFileSync(this.config.tls.private);
|
|
||||||
}else{
|
|
||||||
this.config.tls.key=fs.readFileSync(`${__dirname}/../local-node-ipc-certs/private/server.key`);
|
|
||||||
}
|
|
||||||
if(this.config.tls.public){
|
|
||||||
this.config.tls.cert=fs.readFileSync(this.config.tls.public);
|
|
||||||
}else{
|
|
||||||
this.config.tls.cert=fs.readFileSync(`${__dirname}/../local-node-ipc-certs/server.pub`);
|
|
||||||
}
|
|
||||||
if(this.config.tls.dhparam){
|
|
||||||
this.config.tls.dhparam=fs.readFileSync(this.config.tls.dhparam);
|
|
||||||
}
|
|
||||||
if(this.config.tls.trustedConnections){
|
|
||||||
if(typeof this.config.tls.trustedConnections === 'string'){
|
|
||||||
this.config.tls.trustedConnections=[this.config.tls.trustedConnections];
|
|
||||||
}
|
|
||||||
this.config.tls.ca=[];
|
|
||||||
for(let i=0; i<this.config.tls.trustedConnections.length; i++){
|
|
||||||
this.config.tls.ca.push(
|
|
||||||
fs.readFileSync(this.config.tls.trustedConnections[i])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.server=tls.createServer(
|
|
||||||
this.config.tls,
|
|
||||||
serverCreated.bind(this)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function UDPWrite(message,socket){
|
|
||||||
let data=Buffer.from(message, this.config.encoding);
|
|
||||||
this.server.send(
|
|
||||||
data,
|
|
||||||
0,
|
|
||||||
data.length,
|
|
||||||
socket.port,
|
|
||||||
socket.address,
|
|
||||||
function(err, bytes) {
|
|
||||||
if(err){
|
|
||||||
this.log('error writing data to socket',err);
|
|
||||||
this.publish(
|
|
||||||
'error',
|
|
||||||
function(err){
|
|
||||||
this.publish('error',err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports=Server;
|
|
83
node_modules/@achrinza/node-ipc/entities/Defaults.js
generated
vendored
83
node_modules/@achrinza/node-ipc/entities/Defaults.js
generated
vendored
@ -1,83 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
/*eslint no-magic-numbers: ["error", { "ignore": [ 0] }]*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @module entities
|
|
||||||
*/
|
|
||||||
|
|
||||||
const os = require('os');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class Defaults
|
|
||||||
* @description Defaults Entity
|
|
||||||
*/
|
|
||||||
class Defaults{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
* @method constructor
|
|
||||||
* @return {void}
|
|
||||||
*/
|
|
||||||
constructor(){
|
|
||||||
|
|
||||||
this.appspace='app.';
|
|
||||||
this.socketRoot='/tmp/';
|
|
||||||
this.id=os.hostname();
|
|
||||||
|
|
||||||
this.encoding='utf8';
|
|
||||||
this.rawBuffer=false;
|
|
||||||
this.sync=false;
|
|
||||||
this.unlink=true;
|
|
||||||
|
|
||||||
this.delimiter='\f';
|
|
||||||
|
|
||||||
this.silent=false;
|
|
||||||
this.logDepth=5;
|
|
||||||
this.logInColor=true;
|
|
||||||
this.logger=console.log.bind(console);
|
|
||||||
|
|
||||||
this.maxConnections=100;
|
|
||||||
this.retry=500;
|
|
||||||
this.maxRetries=Infinity;
|
|
||||||
this.stopRetrying=false;
|
|
||||||
|
|
||||||
this.IPType=getIPType();
|
|
||||||
this.tls=false;
|
|
||||||
this.networkHost = (this.IPType == 'IPv6') ? '::1' : '127.0.0.1';
|
|
||||||
this.networkPort = 8000;
|
|
||||||
|
|
||||||
this.readableAll = false;
|
|
||||||
this.writableAll = false;
|
|
||||||
|
|
||||||
this.interface={
|
|
||||||
localAddress:false,
|
|
||||||
localPort:false,
|
|
||||||
family:false,
|
|
||||||
hints:false,
|
|
||||||
lookup:false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* method to get ip type
|
|
||||||
*
|
|
||||||
* @method getIPType
|
|
||||||
* @return {string} ip type
|
|
||||||
*/
|
|
||||||
function getIPType() {
|
|
||||||
const networkInterfaces = os.networkInterfaces();
|
|
||||||
let IPType = '';
|
|
||||||
if (networkInterfaces
|
|
||||||
&& Array.isArray(networkInterfaces)
|
|
||||||
&& networkInterfaces.length > 0) {
|
|
||||||
// getting the family of first network interface available
|
|
||||||
IPType = networkInterfaces [
|
|
||||||
Object.keys( networkInterfaces )[0]
|
|
||||||
][0].family;
|
|
||||||
}
|
|
||||||
return IPType;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports=Defaults;
|
|
32
node_modules/@achrinza/node-ipc/entities/EventParser.js
generated
vendored
32
node_modules/@achrinza/node-ipc/entities/EventParser.js
generated
vendored
@ -1,32 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Defaults = require('./Defaults.js');
|
|
||||||
|
|
||||||
class Parser{
|
|
||||||
constructor(config){
|
|
||||||
if(!config){
|
|
||||||
config=new Defaults;
|
|
||||||
}
|
|
||||||
this.delimiter=config.delimiter;
|
|
||||||
}
|
|
||||||
|
|
||||||
format(message){
|
|
||||||
if(!message.data && message.data!==false && message.data!==0){
|
|
||||||
message.data={};
|
|
||||||
}
|
|
||||||
if(message.data['_maxListeners']){
|
|
||||||
message.data={};
|
|
||||||
}
|
|
||||||
|
|
||||||
message=message.JSON+this.delimiter;
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
parse(data){
|
|
||||||
let events=data.split(this.delimiter);
|
|
||||||
events.pop();
|
|
||||||
return events;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports=Parser;
|
|
21
node_modules/@achrinza/node-ipc/licence
generated
vendored
21
node_modules/@achrinza/node-ipc/licence
generated
vendored
@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2020 Brandon Nozaki Miller
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
24
node_modules/@achrinza/node-ipc/local-node-ipc-certs/client.pub
generated
vendored
24
node_modules/@achrinza/node-ipc/local-node-ipc-certs/client.pub
generated
vendored
@ -1,24 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIID+zCCAuOgAwIBAgIJAKUVVihb00q/MA0GCSqGSIb3DQEBCwUAMIGTMQswCQYD
|
|
||||||
VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNVGhvdXNhbmQg
|
|
||||||
T2FrczEUMBIGA1UECgwLRGlnaU5vdyBpbmMxDDAKBgNVBAsMA1JuRDEQMA4GA1UE
|
|
||||||
AwwHRGlnaU5vdzEhMB8GCSqGSIb3DQEJARYSYnJhbmRvbkBkaWdpbm93Lml0MB4X
|
|
||||||
DTE2MDkxMDIxNTk0NloXDTE3MDkxMDIxNTk0NlowgZMxCzAJBgNVBAYTAlVTMRMw
|
|
||||||
EQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1UaG91c2FuZCBPYWtzMRQwEgYD
|
|
||||||
VQQKDAtEaWdpTm93IGluYzEMMAoGA1UECwwDUm5EMRAwDgYDVQQDDAdEaWdpTm93
|
|
||||||
MSEwHwYJKoZIhvcNAQkBFhJicmFuZG9uQGRpZ2lub3cuaXQwggEiMA0GCSqGSIb3
|
|
||||||
DQEBAQUAA4IBDwAwggEKAoIBAQCrNHWbbaMvlyK3ENevYeb+y5gWtOf5T8HS5k0E
|
|
||||||
7fub8jU4f4j7poxhvAYgaMeuUUigR3YZOSGc3N8yXFLFrrU8WQyK7KAwWcyUvqWK
|
|
||||||
7mvj6dQANtnGvnkt+q2pjMO1nxVPuXgov0GIaWHc7gL4rfuohBct6lbxOXaUxWHe
|
|
||||||
FbQoWlqxs+lYaNMIMn7PgNwPDINoJeADKkVFXlNG9/YnT5j7TQegmzFxBBdko8EN
|
|
||||||
W8Y91RG+/YHhtEPyKeQGrm3Ntl85JokT/GUsUUfUjXkuKrJsrLhwMVLPD23ucy7J
|
|
||||||
zBcec0Vgpu99Bks51w/do6f80rIlAhI+iesZlPJjpDIYhmEXAgMBAAGjUDBOMB0G
|
|
||||||
A1UdDgQWBBSOFk2HqjDTBqUuxOZvW0npEVRxCjAfBgNVHSMEGDAWgBSOFk2HqjDT
|
|
||||||
BqUuxOZvW0npEVRxCjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAz
|
|
||||||
FYxwSSbJ6wOX4yRNUU3XW0iGzoHwMtJhbYe3WRNLHRzHaRC+hg5VgBDEBcC9aYNB
|
|
||||||
+dfNXfrQ+2uooe082twGqSyGVFYEytsTrhlzxvftunF0rMLXfI8wHkiqxWSupPYM
|
|
||||||
nn2gFEVrJIpvyBnL6tAQpVRpn5aCBdQnmSApZVvDhogac0tQMH9GrjizrmDWtMoH
|
|
||||||
V4zRA0UGzHfQoj+YKex7e9rPdDEx+mah0Ol1fzlmkZlOFInXJQ+t4F11bNNdHWje
|
|
||||||
7lyi0pFB9egtDUxwoHkzniMvef94cCIRsph+Vjisf7OQxnx65s+aPYcjrba+Kks3
|
|
||||||
58ANS3VkbXXzB3MeNGoB
|
|
||||||
-----END CERTIFICATE-----
|
|
352
node_modules/@achrinza/node-ipc/local-node-ipc-certs/openssl.cnf
generated
vendored
352
node_modules/@achrinza/node-ipc/local-node-ipc-certs/openssl.cnf
generated
vendored
@ -1,352 +0,0 @@
|
|||||||
#
|
|
||||||
# OpenSSL example configuration file.
|
|
||||||
# This is mostly being used for generation of certificate requests.
|
|
||||||
#
|
|
||||||
|
|
||||||
# This definition stops the following lines choking if HOME isn't
|
|
||||||
# defined.
|
|
||||||
HOME = .
|
|
||||||
RANDFILE = $ENV::HOME/.rnd
|
|
||||||
|
|
||||||
# Extra OBJECT IDENTIFIER info:
|
|
||||||
#oid_file = $ENV::HOME/.oid
|
|
||||||
oid_section = new_oids
|
|
||||||
|
|
||||||
# To use this configuration file with the "-extfile" option of the
|
|
||||||
# "openssl x509" utility, name here the section containing the
|
|
||||||
# X.509v3 extensions to use:
|
|
||||||
# extensions =
|
|
||||||
# (Alternatively, use a configuration file that has only
|
|
||||||
# X.509v3 extensions in its main [= default] section.)
|
|
||||||
|
|
||||||
[ new_oids ]
|
|
||||||
|
|
||||||
# We can add new OIDs in here for use by 'ca', 'req' and 'ts'.
|
|
||||||
# Add a simple OID like this:
|
|
||||||
# testoid1=1.2.3.4
|
|
||||||
# Or use config file substitution like this:
|
|
||||||
# testoid2=${testoid1}.5.6
|
|
||||||
|
|
||||||
# Policies used by the TSA examples.
|
|
||||||
tsa_policy1 = 1.2.3.4.1
|
|
||||||
tsa_policy2 = 1.2.3.4.5.6
|
|
||||||
tsa_policy3 = 1.2.3.4.5.7
|
|
||||||
|
|
||||||
####################################################################
|
|
||||||
[ ca ]
|
|
||||||
default_ca = CA_default # The default ca section
|
|
||||||
|
|
||||||
####################################################################
|
|
||||||
[ CA_default ]
|
|
||||||
|
|
||||||
dir = ./demoCA # Where everything is kept
|
|
||||||
certs = $dir/certs # Where the issued certs are kept
|
|
||||||
crl_dir = $dir/crl # Where the issued crl are kept
|
|
||||||
database = $dir/index.txt # database index file.
|
|
||||||
#unique_subject = no # Set to 'no' to allow creation of
|
|
||||||
# several ctificates with same subject.
|
|
||||||
new_certs_dir = $dir/newcerts # default place for new certs.
|
|
||||||
|
|
||||||
certificate = $dir/cacert.pem # The CA certificate
|
|
||||||
serial = $dir/serial # The current serial number
|
|
||||||
crlnumber = $dir/crlnumber # the current crl number
|
|
||||||
# must be commented out to leave a V1 CRL
|
|
||||||
crl = $dir/crl.pem # The current CRL
|
|
||||||
private_key = $dir/private/cakey.pem# The private key
|
|
||||||
RANDFILE = $dir/private/.rand # private random number file
|
|
||||||
|
|
||||||
x509_extensions = usr_cert # The extentions to add to the cert
|
|
||||||
|
|
||||||
# Comment out the following two lines for the "traditional"
|
|
||||||
# (and highly broken) format.
|
|
||||||
name_opt = ca_default # Subject Name options
|
|
||||||
cert_opt = ca_default # Certificate field options
|
|
||||||
|
|
||||||
# Extension copying option: use with caution.
|
|
||||||
# copy_extensions = copy
|
|
||||||
|
|
||||||
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
|
|
||||||
# so this is commented out by default to leave a V1 CRL.
|
|
||||||
# crlnumber must also be commented out to leave a V1 CRL.
|
|
||||||
# crl_extensions = crl_ext
|
|
||||||
|
|
||||||
default_days = 365 # how long to certify for
|
|
||||||
default_crl_days= 30 # how long before next CRL
|
|
||||||
default_md = default # use public key default MD
|
|
||||||
preserve = no # keep passed DN ordering
|
|
||||||
|
|
||||||
# A few difference way of specifying how similar the request should look
|
|
||||||
# For type CA, the listed attributes must be the same, and the optional
|
|
||||||
# and supplied fields are just that :-)
|
|
||||||
policy = policy_match
|
|
||||||
|
|
||||||
# For the CA policy
|
|
||||||
[ policy_match ]
|
|
||||||
countryName = match
|
|
||||||
stateOrProvinceName = match
|
|
||||||
organizationName = match
|
|
||||||
organizationalUnitName = optional
|
|
||||||
commonName = supplied
|
|
||||||
emailAddress = optional
|
|
||||||
|
|
||||||
# For the 'anything' policy
|
|
||||||
# At this point in time, you must list all acceptable 'object'
|
|
||||||
# types.
|
|
||||||
[ policy_anything ]
|
|
||||||
countryName = optional
|
|
||||||
stateOrProvinceName = optional
|
|
||||||
localityName = optional
|
|
||||||
organizationName = optional
|
|
||||||
organizationalUnitName = optional
|
|
||||||
commonName = supplied
|
|
||||||
emailAddress = optional
|
|
||||||
|
|
||||||
####################################################################
|
|
||||||
[ req ]
|
|
||||||
default_bits = 2048
|
|
||||||
default_keyfile = privkey.pem
|
|
||||||
distinguished_name = req_distinguished_name
|
|
||||||
attributes = req_attributes
|
|
||||||
x509_extensions = v3_ca # The extentions to add to the self signed cert
|
|
||||||
|
|
||||||
# Passwords for private keys if not present they will be prompted for
|
|
||||||
# input_password = secret
|
|
||||||
# output_password = secret
|
|
||||||
|
|
||||||
# This sets a mask for permitted string types. There are several options.
|
|
||||||
# default: PrintableString, T61String, BMPString.
|
|
||||||
# pkix : PrintableString, BMPString (PKIX recommendation before 2004)
|
|
||||||
# utf8only: only UTF8Strings (PKIX recommendation after 2004).
|
|
||||||
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
|
|
||||||
# MASK:XXXX a literal mask value.
|
|
||||||
# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.
|
|
||||||
string_mask = utf8only
|
|
||||||
|
|
||||||
req_extensions = v3_req # The extensions to add to a certificate request
|
|
||||||
|
|
||||||
[ req_distinguished_name ]
|
|
||||||
countryName = Country Name (2 letter code)
|
|
||||||
countryName_default = AU
|
|
||||||
countryName_min = 2
|
|
||||||
countryName_max = 2
|
|
||||||
|
|
||||||
stateOrProvinceName = State or Province Name (full name)
|
|
||||||
stateOrProvinceName_default = Some-State
|
|
||||||
|
|
||||||
localityName = Locality Name (eg, city)
|
|
||||||
|
|
||||||
0.organizationName = Organization Name (eg, company)
|
|
||||||
0.organizationName_default = Internet Widgits Pty Ltd
|
|
||||||
|
|
||||||
# we can do this but it is not needed normally :-)
|
|
||||||
#1.organizationName = Second Organization Name (eg, company)
|
|
||||||
#1.organizationName_default = World Wide Web Pty Ltd
|
|
||||||
|
|
||||||
organizationalUnitName = Organizational Unit Name (eg, section)
|
|
||||||
#organizationalUnitName_default =
|
|
||||||
|
|
||||||
commonName = Common Name (e.g. server FQDN or YOUR name)
|
|
||||||
commonName_max = 64
|
|
||||||
|
|
||||||
emailAddress = Email Address
|
|
||||||
emailAddress_max = 64
|
|
||||||
|
|
||||||
# SET-ex3 = SET extension number 3
|
|
||||||
|
|
||||||
[ req_attributes ]
|
|
||||||
challengePassword = A challenge password
|
|
||||||
challengePassword_min = 4
|
|
||||||
challengePassword_max = 20
|
|
||||||
|
|
||||||
unstructuredName = An optional company name
|
|
||||||
|
|
||||||
[ usr_cert ]
|
|
||||||
|
|
||||||
# These extensions are added when 'ca' signs a request.
|
|
||||||
|
|
||||||
# This goes against PKIX guidelines but some CAs do it and some software
|
|
||||||
# requires this to avoid interpreting an end user certificate as a CA.
|
|
||||||
|
|
||||||
basicConstraints=CA:FALSE
|
|
||||||
|
|
||||||
# Here are some examples of the usage of nsCertType. If it is omitted
|
|
||||||
# the certificate can be used for anything *except* object signing.
|
|
||||||
|
|
||||||
# This is OK for an SSL server.
|
|
||||||
# nsCertType = server
|
|
||||||
|
|
||||||
# For an object signing certificate this would be used.
|
|
||||||
# nsCertType = objsign
|
|
||||||
|
|
||||||
# For normal client use this is typical
|
|
||||||
# nsCertType = client, email
|
|
||||||
|
|
||||||
# and for everything including object signing:
|
|
||||||
# nsCertType = client, email, objsign
|
|
||||||
|
|
||||||
# This is typical in keyUsage for a client certificate.
|
|
||||||
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
|
||||||
|
|
||||||
# This will be displayed in Netscape's comment listbox.
|
|
||||||
nsComment = "OpenSSL Generated Certificate"
|
|
||||||
|
|
||||||
# PKIX recommendations harmless if included in all certificates.
|
|
||||||
subjectKeyIdentifier=hash
|
|
||||||
authorityKeyIdentifier=keyid,issuer
|
|
||||||
|
|
||||||
# This stuff is for subjectAltName and issuerAltname.
|
|
||||||
# Import the email address.
|
|
||||||
# subjectAltName=email:copy
|
|
||||||
# An alternative to produce certificates that aren't
|
|
||||||
# deprecated according to PKIX.
|
|
||||||
# subjectAltName=email:move
|
|
||||||
|
|
||||||
# Copy subject details
|
|
||||||
# issuerAltName=issuer:copy
|
|
||||||
|
|
||||||
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
|
|
||||||
#nsBaseUrl
|
|
||||||
#nsRevocationUrl
|
|
||||||
#nsRenewalUrl
|
|
||||||
#nsCaPolicyUrl
|
|
||||||
#nsSslServerName
|
|
||||||
|
|
||||||
# This is required for TSA certificates.
|
|
||||||
# extendedKeyUsage = critical,timeStamping
|
|
||||||
|
|
||||||
[ v3_req ]
|
|
||||||
|
|
||||||
subjectAltName="DNS:localhost,IP:127.0.0.1"
|
|
||||||
|
|
||||||
# Extensions to add to a certificate request
|
|
||||||
|
|
||||||
basicConstraints = CA:FALSE
|
|
||||||
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
|
||||||
|
|
||||||
[ v3_ca ]
|
|
||||||
|
|
||||||
|
|
||||||
# Extensions for a typical CA
|
|
||||||
|
|
||||||
|
|
||||||
# PKIX recommendation.
|
|
||||||
|
|
||||||
subjectKeyIdentifier=hash
|
|
||||||
|
|
||||||
authorityKeyIdentifier=keyid:always,issuer
|
|
||||||
|
|
||||||
# This is what PKIX recommends but some broken software chokes on critical
|
|
||||||
# extensions.
|
|
||||||
#basicConstraints = critical,CA:true
|
|
||||||
# So we do this instead.
|
|
||||||
basicConstraints = CA:true
|
|
||||||
|
|
||||||
# Key usage: this is typical for a CA certificate. However since it will
|
|
||||||
# prevent it being used as an test self-signed certificate it is best
|
|
||||||
# left out by default.
|
|
||||||
# keyUsage = cRLSign, keyCertSign
|
|
||||||
|
|
||||||
# Some might want this also
|
|
||||||
# nsCertType = sslCA, emailCA
|
|
||||||
|
|
||||||
# Include email address in subject alt name: another PKIX recommendation
|
|
||||||
# subjectAltName=email:copy
|
|
||||||
# Copy issuer details
|
|
||||||
# issuerAltName=issuer:copy
|
|
||||||
|
|
||||||
# DER hex encoding of an extension: beware experts only!
|
|
||||||
# obj=DER:02:03
|
|
||||||
# Where 'obj' is a standard or added object
|
|
||||||
# You can even override a supported extension:
|
|
||||||
# basicConstraints= critical, DER:30:03:01:01:FF
|
|
||||||
|
|
||||||
[ crl_ext ]
|
|
||||||
|
|
||||||
# CRL extensions.
|
|
||||||
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
|
|
||||||
|
|
||||||
# issuerAltName=issuer:copy
|
|
||||||
authorityKeyIdentifier=keyid:always
|
|
||||||
|
|
||||||
[ proxy_cert_ext ]
|
|
||||||
# These extensions should be added when creating a proxy certificate
|
|
||||||
|
|
||||||
# This goes against PKIX guidelines but some CAs do it and some software
|
|
||||||
# requires this to avoid interpreting an end user certificate as a CA.
|
|
||||||
|
|
||||||
basicConstraints=CA:FALSE
|
|
||||||
|
|
||||||
# Here are some examples of the usage of nsCertType. If it is omitted
|
|
||||||
# the certificate can be used for anything *except* object signing.
|
|
||||||
|
|
||||||
# This is OK for an SSL server.
|
|
||||||
# nsCertType = server
|
|
||||||
|
|
||||||
# For an object signing certificate this would be used.
|
|
||||||
# nsCertType = objsign
|
|
||||||
|
|
||||||
# For normal client use this is typical
|
|
||||||
# nsCertType = client, email
|
|
||||||
|
|
||||||
# and for everything including object signing:
|
|
||||||
# nsCertType = client, email, objsign
|
|
||||||
|
|
||||||
# This is typical in keyUsage for a client certificate.
|
|
||||||
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
|
||||||
|
|
||||||
# This will be displayed in Netscape's comment listbox.
|
|
||||||
nsComment = "OpenSSL Generated Certificate"
|
|
||||||
|
|
||||||
# PKIX recommendations harmless if included in all certificates.
|
|
||||||
subjectKeyIdentifier=hash
|
|
||||||
authorityKeyIdentifier=keyid,issuer
|
|
||||||
|
|
||||||
# This stuff is for subjectAltName and issuerAltname.
|
|
||||||
# Import the email address.
|
|
||||||
# subjectAltName=email:copy
|
|
||||||
# An alternative to produce certificates that aren't
|
|
||||||
# deprecated according to PKIX.
|
|
||||||
# subjectAltName=email:move
|
|
||||||
|
|
||||||
# Copy subject details
|
|
||||||
# issuerAltName=issuer:copy
|
|
||||||
|
|
||||||
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
|
|
||||||
#nsBaseUrl
|
|
||||||
#nsRevocationUrl
|
|
||||||
#nsRenewalUrl
|
|
||||||
#nsCaPolicyUrl
|
|
||||||
#nsSslServerName
|
|
||||||
|
|
||||||
# This really needs to be in place for it to be a proxy certificate.
|
|
||||||
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
|
|
||||||
|
|
||||||
####################################################################
|
|
||||||
[ tsa ]
|
|
||||||
|
|
||||||
default_tsa = tsa_config1 # the default TSA section
|
|
||||||
|
|
||||||
[ tsa_config1 ]
|
|
||||||
|
|
||||||
# These are used by the TSA reply generation only.
|
|
||||||
dir = ./demoCA # TSA root directory
|
|
||||||
serial = $dir/tsaserial # The current serial number (mandatory)
|
|
||||||
crypto_device = builtin # OpenSSL engine to use for signing
|
|
||||||
signer_cert = $dir/tsacert.pem # The TSA signing certificate
|
|
||||||
# (optional)
|
|
||||||
certs = $dir/cacert.pem # Certificate chain to include in reply
|
|
||||||
# (optional)
|
|
||||||
signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
|
|
||||||
|
|
||||||
default_policy = tsa_policy1 # Policy if request did not specify it
|
|
||||||
# (optional)
|
|
||||||
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
|
|
||||||
digests = md5, sha1 # Acceptable message digests (mandatory)
|
|
||||||
accuracy = secs:1, millisecs:500, microsecs:100 # (optional)
|
|
||||||
clock_precision_digits = 0 # number of digits after dot. (optional)
|
|
||||||
ordering = yes # Is ordering defined for timestamps?
|
|
||||||
# (optional, default: no)
|
|
||||||
tsa_name = yes # Must the TSA name be included in the reply?
|
|
||||||
# (optional, default: no)
|
|
||||||
ess_cert_id_chain = no # Must the ESS cert id chain be included?
|
|
||||||
# (optional, default: no)
|
|
27
node_modules/@achrinza/node-ipc/local-node-ipc-certs/private/client.key
generated
vendored
27
node_modules/@achrinza/node-ipc/local-node-ipc-certs/private/client.key
generated
vendored
@ -1,27 +0,0 @@
|
|||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIIEogIBAAKCAQEAqzR1m22jL5citxDXr2Hm/suYFrTn+U/B0uZNBO37m/I1OH+I
|
|
||||||
+6aMYbwGIGjHrlFIoEd2GTkhnNzfMlxSxa61PFkMiuygMFnMlL6liu5r4+nUADbZ
|
|
||||||
xr55LfqtqYzDtZ8VT7l4KL9BiGlh3O4C+K37qIQXLepW8Tl2lMVh3hW0KFpasbPp
|
|
||||||
WGjTCDJ+z4DcDwyDaCXgAypFRV5TRvf2J0+Y+00HoJsxcQQXZKPBDVvGPdURvv2B
|
|
||||||
4bRD8inkBq5tzbZfOSaJE/xlLFFH1I15LiqybKy4cDFSzw9t7nMuycwXHnNFYKbv
|
|
||||||
fQZLOdcP3aOn/NKyJQISPonrGZTyY6QyGIZhFwIDAQABAoIBAHpxZ1dE/zuvFLXm
|
|
||||||
xsr48vLxexFqSqnEv/NsoFLRPWzXufZxR+/qumW/yoXtSjpCifWPhkgd0wtT8BEd
|
|
||||||
dFlLTPUfHthQyXQrFSSggNavE9yJxARvNits2E/pA8DKGsJPRzeghu5lcqHz9HjE
|
|
||||||
hL2D+QMZjVZaTdnx5fwaepcR4KomYTUupci0HoMWyoKPhIfItVueiHVo4d60dIRz
|
|
||||||
OpkSGCAZ/Czv5CJrmK/5e+roKti4ChF/n28hUu7OGzvkG+qYep08tf48MyZCPHgO
|
|
||||||
Vj+kuxMRkjIP0iXLmiF32lZXzpOFvjtXovI46dYiINCE9tNyKqDWYUJf9qNqwAsm
|
|
||||||
OuOfXtkCgYEA18Ywabu/Z4vYUhWtTFrP6iSLVcXd0rZuWud7kwv/G4DMrNh7oi1s
|
|
||||||
0AVvphaEqEn8OsgcuyIlyjtJl60aQzvYwdu2KEcTjcqvUX7p/41t5O/LzaYwZ3hh
|
|
||||||
9oFIWXXFpskg7Kh0EGCGG/yvAdTai5M0lO9XQ1DUK0MWc1KQ5yKd0mUCgYEAyx80
|
|
||||||
dgIZTyHl0ZgF712mRda5KfQlmgWoo0zu/IFSFuINEMC/3laYEJCowOnUb8VZ8mbJ
|
|
||||||
Wd/FhOTadv7joY0eAhfSNAItaubuZWo91bbD2vwpi/U2OEfy0LzF7BNXHCpH69wk
|
|
||||||
vujKBxmRTGvBLbabcWA97UPFM2K33rsM72DAL8sCgYB03SOFcKk3BLfRpWnpy9mF
|
|
||||||
/+rzNqpwoFveojb8qmet1rGD/+/eI2omtHsG4nVQzFlu4Mkm1VTQVhICsz9hIL3C
|
|
||||||
KSRcZjqB9j/EDM/hmBDoCLRCGntm3v13zAeKZE37ij1pz8akxBJ+f/mtLUJ8i+rT
|
|
||||||
q1mA3Ps8vyYeqZ5PgSEnPQKBgD6szEU1dJXEQeOgYwRvAyU9kjjtysRxxo1M6dkk
|
|
||||||
Fi5VZe6rawix84349PlBrXknjg+Lw8llkM7mxro9AAQTRRUkQIonudfoldrZI2dU
|
|
||||||
U664bCFxcl9/Y98gwHmNpi1cpoCSlwwJTH1QWFMaVKtEU0ZyiekyJiEq7s1dLiqW
|
|
||||||
0fZtAoGABvAOikMmOn6ewt+NyYd6HkwgcvI0R0aHxOQz8aldW4gwrkuvuOOHdfah
|
|
||||||
RAcc8LiZFqhNFN7DMkRt1crtP5v3vh2Nbyf9Zg2ZizsIupsNlvSlh/aTueVozVuM
|
|
||||||
hc/wEVlrqeJInf4jkxYna6G6CoTfPVyQCjNcvlI3kMfIoyXS+vc=
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
8
node_modules/@achrinza/node-ipc/local-node-ipc-certs/private/dhparam.pem
generated
vendored
8
node_modules/@achrinza/node-ipc/local-node-ipc-certs/private/dhparam.pem
generated
vendored
@ -1,8 +0,0 @@
|
|||||||
-----BEGIN DH PARAMETERS-----
|
|
||||||
MIIBCAKCAQEAhDA93df5Qa7pMWiqJ8IeCDw4fCIJCNbzRklS2saOeQRkUY/kPy07
|
|
||||||
EByFWUDNtgtWRx7YndJKwyFepHXxI3P0DDuSPYKq/bfiWDr/cUmTBJcpPmg6w/SU
|
|
||||||
ReOB6vORXyF9iytyLCKk1Pyo2nXOdpADcTflhi+zxTSpGLtPAU2XIYENtmC4HKJm
|
|
||||||
y6nbSIbe4BA74bxyqzp6RVuMvyHAgCjPDwvHlp5UV1Mjtr1aNqgzpLQSjK4VwiJ+
|
|
||||||
DZ48/1D9IYksDl8NWJopFpudyPD1WFou/CZ6PYsjprFrTKVPqoFD5Zj6zPey9C70
|
|
||||||
Go0uHRNPr9UrhwCqDEKNszulME8heSVSQwIBAg==
|
|
||||||
-----END DH PARAMETERS-----
|
|
27
node_modules/@achrinza/node-ipc/local-node-ipc-certs/private/oldclient.key
generated
vendored
27
node_modules/@achrinza/node-ipc/local-node-ipc-certs/private/oldclient.key
generated
vendored
@ -1,27 +0,0 @@
|
|||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIIEowIBAAKCAQEAvmw4yTAd5EdNxksnKEx+ky8XgEqTJVAvcrgF1jaPrC0QNr94
|
|
||||||
EfEHouiEyqWlf4kDzksIA9HcuGhVPZ9gsjjgLvi1pwT+e2vfyOHOWOf96NDlfW02
|
|
||||||
Fx6d92k1zEfhfVmTJU0j6ANG2eNMfF5rhK+xKzH3FC0Vm5e7np9wVuRD4CjggJJL
|
|
||||||
fBm6xJPSBWeY1gum3m5sH4Ec3X0zacZXeBOdjMx1a5I2gfTHJe5fizDfw1vgsYhh
|
|
||||||
I3z6OEXEg5kFtOiz34y4SVCDRZGDVXiAdx8uVXXPdryFybjiZGWGEeTFDZfCAuZp
|
|
||||||
h0I04cqfniD5FbSPIdVVAImH9Nm1sbpLafyuXwIDAQABAoIBADTd8OoSXMoq7bHW
|
|
||||||
3Zk3m5Cba2fnzHB4kaPE6YHuhfbkT/MTN2+rvlYBPhTQ5mDBFnhopmIBGslr1faU
|
|
||||||
0BDK75q63BvxrAFyEqA/6L0QM5M2o/AtqO3ER1EQOapsbnMRsmORxh09A6esjmid
|
|
||||||
AjbFXGfEqHdGiRA4kRNZ6qOFHj8WP4FZ3/elIerl4W86FtMeuza6PUMYm1ePFG/h
|
|
||||||
vTGROXibW2/qrfzgsocKgdjc06Szi95hjloHlpPo3OVLywSNYuJ6dxOj11tKBIjr
|
|
||||||
U126cdza/2OeyWasY4tl4WVeG1Mojtya2ObvMNMOyESPzKaVzb2LIN6feH7toxdK
|
|
||||||
5CEbzfkCgYEA5kZzFWLvUAkK/Oi0bK9b1WhmNUOcfZmPOBJenurfKSQo2R4ugvAM
|
|
||||||
zMupVs/Mum0Hl1+cvTPZDAwHx0qM3E8+Ute7SqLOMxlx7b1XCFB03RN1UN4BCSy4
|
|
||||||
hCQPi+f3YjAF/Zpduquq9qS4gcIwhlo3FHGWWFFIGDesWfJrsTsssNUCgYEA07IM
|
|
||||||
K5+AsvdrHMShMMbys4rOitY9JKUMKV1BdsyRw9z/rsWoDcqupuFTPwWrlc3D3a/i
|
|
||||||
/b/cM3Wm8907fPPrauU3LF11tOkIhsP8/xRkK9BZGkjJCSLO5UvWxmlcZreGvHh+
|
|
||||||
QAwPWKh8MsatyFBFmn7SGFXSu88LQL+TGilpHGMCgYAOwBiDGDFIKSwhAy77f0gc
|
|
||||||
pXFWnBwcF4gLCXIyL81Xr09GiR5lmMbZH3qbavgsQOupkKBTpkyS7vpYk7fuLM1L
|
|
||||||
NTJ0F3Wp5Eld9zDqAW1a8/Ih2farBchT/pNYXOWFzpmzov26BWEQJ4ECHtRI5uJ8
|
|
||||||
VsJQqfQ6SOarZFHtqmK0eQKBgQCPwWCyXuYuogWCy6QKU4+MjL4lWca7k7jmfgVu
|
|
||||||
fwydTP3z2RV+CB0CBhFZwqf6Wnifmkkyt475AvQUti8ncxxywqTs46qC55x6p6yu
|
|
||||||
K1K6zgkz6Clcot6Mpyt6ISI2PnqokcpqA8aIFiIA+RoZ5Sje+TAChoVMNBUYKv/h
|
|
||||||
zC0ssQKBgEXyFNRGHul7ku8Ss6ZZBZjQEOFdpu7npbZWcqy273tKOdV6uOG93rQX
|
|
||||||
6Ez6yxuBepSdwP716CT7o8EaSPBy+QjDH/e2qI3rIUHzfPwAwf4kGbNa6relTCVR
|
|
||||||
fLrzEICSbFZKST/zeKvrY0ACOCIn8b6LiiP7GJfnV8bvvpTWXyil
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
27
node_modules/@achrinza/node-ipc/local-node-ipc-certs/private/oldserver.key
generated
vendored
27
node_modules/@achrinza/node-ipc/local-node-ipc-certs/private/oldserver.key
generated
vendored
@ -1,27 +0,0 @@
|
|||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIIEogIBAAKCAQEAyHKCBWzkf58gKkqRIBjJR8cSXlsiuOuirlbBQ1K+recVbh2b
|
|
||||||
MdDoqBCk3ibeGw4p/smOxJiH/9rxpcCQ0XrSeNGasLxGB8RcNgenRFonyBPmTAjS
|
|
||||||
O85Aa74g8CUBXaYSgk0hMWQNxkkHecGuu9F6LtN5TM7XG6Td7OTRB+bDEGdwfny4
|
|
||||||
bqc2ELUsj99CVNxSNc5h0dJE9M6ejvIjdRQFFtfNKGgT3O7inEdDSpPZfeM+JmTB
|
|
||||||
r/vz2jnHaSsD7d9hWKYo7Kp74rL0QJSH97ugb+g8kDAkqV1bQaVdzp+nC74/GbVL
|
|
||||||
B9E+YH+zzvs2x9nLYPJHknia5KRfOmRjPnCdVwIDAQABAoIBACdNXHUX3s2vM61X
|
|
||||||
JZF3iq/KNq3NjMdZXHJ2jDpZFQ4gCzGmGHHyFkwtx0XPtSj05AMTHi0qAzCFi3AG
|
|
||||||
i96nCHGsF3qjz89iDvqBEajzTG2MiVFLQX18eWEmzGqJtvTXxTVLTkDS72h7lT2o
|
|
||||||
XkxxTFW2HUiUHdVLxD/Ytauo8YJbjGJM5pdCxEp+uJbYWYwsvvfE4IHb8LJmqtOP
|
|
||||||
fUG/wR3mjmHYYcYXKEqiDkSnxJL9vWb2lYKht1NFUyeVkv6q5dkr0JeSD6jw84by
|
|
||||||
MiHoXsxjXmjn3JPtNfid92kIsMjsZ54oZ5ep2iUW7WpTZJnideyZCa4mIRn3BZZ6
|
|
||||||
TPpIKVECgYEA/m7kwNG+WamLLGmgUkq9xWngHvkKaHsjnGuDGi8bYObtzAiOzoPi
|
|
||||||
Bav0V/cJeTjZJJ3uW4HGhzmkJCDq+R3kJ9lEBYy9N0cq0tQf/IRorri7SbHm+eP3
|
|
||||||
+B26z91Vkn0sqV3Htg+78jnjLYV6Nfy4pBvs3u7O91EM7kj3Q8A/xOUCgYEAya6B
|
|
||||||
1fsngVVfkdQ6OmsibpWWCksBbN1Ko+bnY8ZoyTWeS2LkPFVn5lihJ9XzTTV+b/s2
|
|
||||||
6urtTpCiQo/WAT62ATI2J5xHLBVS46CJj6HP9jPsyIxSEAor7wmKXqCaQDG1J7Zt
|
|
||||||
2IszGtg3WYRWgrNSPtYdeB14fGhbpMphigZvkYsCgYAZUvpLwtSaYgirK/w8FJpc
|
|
||||||
2tPm4UzK52688+qBoays8W87vqJQJcpKXDoew0TbHvBl954w13LmJLOUsP4SO4po
|
|
||||||
+PQPRVnT9a5qe5iPbrJoqZRimmVt++XDeVoNtG7+/JyEYwQst9YyHtbgwgdO9k9+
|
|
||||||
bhUef1B0R0ntMbACu1DdjQKBgGEzq/vXmkipPvBn2tCBBg1KJxA66irv1KN+DBN4
|
|
||||||
ctRW9T3cIag6eWL5YGJ0qViS6adK6kL6ivkMmEeAT2I2OT4GVzdsCJlkhZiTrPj+
|
|
||||||
wd4lVH+rsXltjZMdhATrXqyFyIulTvfIzw6nGrYYJCHGD2OdioJzobhEC7c2myAM
|
|
||||||
zgTVAoGADfGqbgq8wSv+nLtOnY+s5ajwMVAyld/JqDXm5829CTI/Kd1ch6BxWYZr
|
|
||||||
V06PY9mJ8k39GAOab7YWcKX90E85cN7YMSjsQhdMgVAsBCv25eot4BWc8EO8WeCJ
|
|
||||||
76aC7LlmX9WlHqaZV/GNcj3PhKao5mIk77BKySxINRaflRiCWjI=
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
27
node_modules/@achrinza/node-ipc/local-node-ipc-certs/private/server.key
generated
vendored
27
node_modules/@achrinza/node-ipc/local-node-ipc-certs/private/server.key
generated
vendored
@ -1,27 +0,0 @@
|
|||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIIEpAIBAAKCAQEAw+YwIWPQAh8WlhPAaasfUyb13Fcg0P0y+UmtAHpAxnUKAxc1
|
|
||||||
/bkl4FNjbS+kkTGkIvRE4NHJh4DMqEDBsf7mwhfaOl8bTCoustyh14bzxJKdM1Cx
|
|
||||||
Q/L2GsTIwF1vZCvqOvrV1glLruRrw8PvSFaWt1JAZ8CUhtyddR3itkSF+suTORxh
|
|
||||||
+aUjUreyfuaWx0dfIQLYOxMeTa/g94Ar9Q7KPCXgxmDqu8DVCmurDH2jz6iFktbp
|
|
||||||
+iNvrUfs88Y3I0E8/QRBAK37j7fEp296QcYIDJKkS2z2lenJykAdaqF9qLhb3zrM
|
|
||||||
UpGt5VUUSNdHeXzCQr7J9wA7TWjCXnQh3d/xlwIDAQABAoIBACUSQHVxIAHmxC1u
|
|
||||||
W3Ejsu/XZZtm2Yzy/VxzdsuqVuu3ZkejctIq4WIMJbqZ03iufjMnKomo6Yw88X29
|
|
||||||
k2oNpLmCLgfxy4akTOYIHpBct3CxlhIJ6SHErpHuP1c310aLkO3MXf79D1dvXn1T
|
|
||||||
bMqxqB/U7t8zcGf9A8cP+sEnQnttCdj2ayUlDqfPV06sDRPndIS2LFkzIswwHED8
|
|
||||||
Z9jRk6tWg+APsEgFAo58lIEYM2iR04c2ffWBvffIEWotYM4YH1pdgvVtILLzky8C
|
|
||||||
IogcF/LWe4mFKgBi8O3cS03YowoPgkPBh/4lXBiCXio5rkKJaMJrJMNDmoQTSzqU
|
|
||||||
80r8zuECgYEA8PqoY3p6lpUIxR1i4jrDzcmnFJ8vNoehr4SySR8G5EkPloltT0OK
|
|
||||||
o1d7g/b19RbulR7XnMq/H4Ic5GDiP2EEI5zM093JbV5luQZHwKrqTykXVdlgiDan
|
|
||||||
GAxsJ9Q31ASAixCA92una1+08Xe8N7aNBuJNPuvaPB2603dO30hIlQkCgYEA0Bwu
|
|
||||||
oqZMh8Td4pB3nUQM08NiLrYy1vwzbAHhOx3VxRGiF7x8X32NSnAzQmusqYuT6j02
|
|
||||||
o4Jg0Jyn+XV67AD4f0D8+4urQEnrfnf32GxSvefucFbekypGLR8w3WR18mkBhVst
|
|
||||||
WTkKqZwoJtmyJlbSRRpDZ6ewQqZ/a79NmMkxmZ8CgYEAwQQ0jgGTYTucW64u/v+M
|
|
||||||
yC8l2dmrCmVW92w1FWZ5sa5ngu8uk9eIm06+CzRrS1WD4gNjNh4bOdSQ6chET/mY
|
|
||||||
RCIa2fSCm0yJ88p4/HSp2qASJdxIerIz4opIsxpDYVn9z+V3NzaOUe3F08dRBdr9
|
|
||||||
WK84qhZlpdM2Spz8mtGd+WkCgYBCV3mWaCUlcuC5BQzcmYDtUO/PrE1ws11BJShD
|
|
||||||
zDMFa6Wco32Sg1ezTylIF0MnmVNB7NmqLjnmxsnVgFn7OiP9jR4YomGpUOc9ncjo
|
|
||||||
uT93QqSEM20oxOUyJStSqF/hMxBFDtfaBZEcmKdEG0nrZuoJFWI/fPl3hdRA6O83
|
|
||||||
sYuaSQKBgQCGTN1vEshVEu2Sbdpw+9p/JpHOWT4HuTU78EGfjd4wDtWgme3WgbB4
|
|
||||||
geixhSTsoGdb95Da5Wp81nEUN7P/VE9VTX74qcXD3AseCYmhmbFaZTOi0kjYEbAQ
|
|
||||||
wGuBa8CDIzttKhBsBQWZpG7YQq3pOqKLgKOuwwf6kJk1eh+HMS7ktQ==
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
24
node_modules/@achrinza/node-ipc/local-node-ipc-certs/server.pub
generated
vendored
24
node_modules/@achrinza/node-ipc/local-node-ipc-certs/server.pub
generated
vendored
@ -1,24 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIID+zCCAuOgAwIBAgIJANhisawO7GXuMA0GCSqGSIb3DQEBCwUAMIGTMQswCQYD
|
|
||||||
VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNVGhvdXNhbmQg
|
|
||||||
T2FrczEUMBIGA1UECgwLRGlnaU5vdyBJbmMxDDAKBgNVBAsMA1JuRDEQMA4GA1UE
|
|
||||||
AwwHRGlnaU5vdzEhMB8GCSqGSIb3DQEJARYSYnJhbmRvbkBkaWdpbm93Lml0MB4X
|
|
||||||
DTE2MDkxMDIxMDIwNFoXDTE3MDkxMDIxMDIwNFowgZMxCzAJBgNVBAYTAlVTMRMw
|
|
||||||
EQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1UaG91c2FuZCBPYWtzMRQwEgYD
|
|
||||||
VQQKDAtEaWdpTm93IEluYzEMMAoGA1UECwwDUm5EMRAwDgYDVQQDDAdEaWdpTm93
|
|
||||||
MSEwHwYJKoZIhvcNAQkBFhJicmFuZG9uQGRpZ2lub3cuaXQwggEiMA0GCSqGSIb3
|
|
||||||
DQEBAQUAA4IBDwAwggEKAoIBAQDD5jAhY9ACHxaWE8Bpqx9TJvXcVyDQ/TL5Sa0A
|
|
||||||
ekDGdQoDFzX9uSXgU2NtL6SRMaQi9ETg0cmHgMyoQMGx/ubCF9o6XxtMKi6y3KHX
|
|
||||||
hvPEkp0zULFD8vYaxMjAXW9kK+o6+tXWCUuu5GvDw+9IVpa3UkBnwJSG3J11HeK2
|
|
||||||
RIX6y5M5HGH5pSNSt7J+5pbHR18hAtg7Ex5Nr+D3gCv1Dso8JeDGYOq7wNUKa6sM
|
|
||||||
faPPqIWS1un6I2+tR+zzxjcjQTz9BEEArfuPt8Snb3pBxggMkqRLbPaV6cnKQB1q
|
|
||||||
oX2ouFvfOsxSka3lVRRI10d5fMJCvsn3ADtNaMJedCHd3/GXAgMBAAGjUDBOMB0G
|
|
||||||
A1UdDgQWBBSWtsrqQGryJVSJER5int40YIpuxjAfBgNVHSMEGDAWgBSWtsrqQGry
|
|
||||||
JVSJER5int40YIpuxjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQDA
|
|
||||||
NySrqGBF+h/UCph/YEXTTea8MQIvihLecZ0VpZ/0VDZfwxzZns5oV0znoZEQcyYZ
|
|
||||||
olTr40jyCt0Ex59VRWRUUfdR1JgZtaMd29iYxUvGy+tK5pw75mIl3upc8hEe2uzN
|
|
||||||
c8hynlLSh9y75GM3RUkUlkSIrIRQIvOTW1+lhqBzhesvYjScCbH8MXL5e6qCkbhZ
|
|
||||||
tP5xuTjQlY38oJxDmMHmIxholxCxQtnEVTpKn0lp2diPMXU9qbsTuZ9eYTwZabSk
|
|
||||||
+CXrtjYtaZPkHGDSldWdMdbHw/+81ViMA3CA2f61aqTcIYyAZz8o9b+4IghLLicZ
|
|
||||||
C84hYbMbCAz0rp6bt+PJ
|
|
||||||
-----END CERTIFICATE-----
|
|
1269
node_modules/@achrinza/node-ipc/node-ipc.cjs
generated
vendored
1269
node_modules/@achrinza/node-ipc/node-ipc.cjs
generated
vendored
File diff suppressed because it is too large
Load Diff
21
node_modules/@achrinza/node-ipc/node-ipc.js
generated
vendored
21
node_modules/@achrinza/node-ipc/node-ipc.js
generated
vendored
@ -1,21 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const IPC = require('./services/IPC.js');
|
|
||||||
|
|
||||||
class IPCModule extends IPC{
|
|
||||||
constructor(){
|
|
||||||
super();
|
|
||||||
//include IPC to make extensible
|
|
||||||
Object.defineProperty(
|
|
||||||
this,
|
|
||||||
'IPC',
|
|
||||||
{
|
|
||||||
enumerable:true,
|
|
||||||
writable:false,
|
|
||||||
value:IPC
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports=new IPCModule;
|
|
65
node_modules/@achrinza/node-ipc/package.json
generated
vendored
65
node_modules/@achrinza/node-ipc/package.json
generated
vendored
@ -1,65 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@achrinza/node-ipc",
|
|
||||||
"version": "9.2.2",
|
|
||||||
"description": "A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.",
|
|
||||||
"main": "node-ipc.js",
|
|
||||||
"directories": {
|
|
||||||
"example": "example"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "8 || 10 || 12 || 14 || 16 || 17"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"event-pubsub": "4.3.0",
|
|
||||||
"js-message": "1.0.7",
|
|
||||||
"@node-ipc/js-queue": "2.0.3"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"codacy-coverage": "2.0.0",
|
|
||||||
"istanbul": "0.4.1",
|
|
||||||
"jasmine": "2.4.1",
|
|
||||||
"lockfile-lint": "^4.7.4",
|
|
||||||
"node-cmd": "2.0.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test-windows": "istanbul cover -x **/spec/** -dir ./spec/coverage ./node_modules/jasmine/bin/jasmine.js",
|
|
||||||
"test": "istanbul cover -x **/spec/** -dir ./spec/coverage jasmine",
|
|
||||||
"cover": "istanbul cover -x **/spec/** -dir ./spec/coverage jasmine",
|
|
||||||
"coverup": "cat ./spec/coverage/lcov.info | codacy-coverage"
|
|
||||||
},
|
|
||||||
"pre-commit": [
|
|
||||||
"cover"
|
|
||||||
],
|
|
||||||
"keywords": [
|
|
||||||
"IPC",
|
|
||||||
"Neural Networking",
|
|
||||||
"Machine Learning",
|
|
||||||
"inter",
|
|
||||||
"process",
|
|
||||||
"communication",
|
|
||||||
"unix",
|
|
||||||
"windows",
|
|
||||||
"win",
|
|
||||||
"socket",
|
|
||||||
"TCP",
|
|
||||||
"UDP",
|
|
||||||
"domain",
|
|
||||||
"sockets",
|
|
||||||
"threaded",
|
|
||||||
"communication",
|
|
||||||
"multi",
|
|
||||||
"process",
|
|
||||||
"shared",
|
|
||||||
"memory"
|
|
||||||
],
|
|
||||||
"author": "Brandon Nozaki Miller",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/achrinza/node-ipc.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/achrinza/node-ipc/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/achrinza/node-ipc"
|
|
||||||
}
|
|
338
node_modules/@achrinza/node-ipc/services/IPC.js
generated
vendored
338
node_modules/@achrinza/node-ipc/services/IPC.js
generated
vendored
@ -1,338 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const Defaults = require('../entities/Defaults.js'),
|
|
||||||
Client = require('../dao/client.js'),
|
|
||||||
Server = require('../dao/socketServer.js'),
|
|
||||||
util = require('util');
|
|
||||||
|
|
||||||
class IPC{
|
|
||||||
constructor(){
|
|
||||||
Object.defineProperties(
|
|
||||||
this,
|
|
||||||
{
|
|
||||||
config : {
|
|
||||||
enumerable:true,
|
|
||||||
writable:true,
|
|
||||||
value:new Defaults
|
|
||||||
},
|
|
||||||
connectTo : {
|
|
||||||
enumerable:true,
|
|
||||||
writable:false,
|
|
||||||
value:connect
|
|
||||||
},
|
|
||||||
connectToNet: {
|
|
||||||
enumerable:true,
|
|
||||||
writable:false,
|
|
||||||
value:connectNet
|
|
||||||
},
|
|
||||||
disconnect : {
|
|
||||||
enumerable:true,
|
|
||||||
writable:false,
|
|
||||||
value:disconnect
|
|
||||||
},
|
|
||||||
serve : {
|
|
||||||
enumerable:true,
|
|
||||||
writable:false,
|
|
||||||
value:serve
|
|
||||||
},
|
|
||||||
serveNet : {
|
|
||||||
enumerable:true,
|
|
||||||
writable:false,
|
|
||||||
value:serveNet
|
|
||||||
},
|
|
||||||
of : {
|
|
||||||
enumerable:true,
|
|
||||||
writable:true,
|
|
||||||
value:{}
|
|
||||||
},
|
|
||||||
server : {
|
|
||||||
enumerable:true,
|
|
||||||
writable:true,
|
|
||||||
configurable:true,
|
|
||||||
value:false
|
|
||||||
},
|
|
||||||
log : {
|
|
||||||
enumerable:true,
|
|
||||||
writable:false,
|
|
||||||
value:log
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function log(...args){
|
|
||||||
if(this.config.silent){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(let i=0, count=args.length; i<count; i++){
|
|
||||||
if(typeof args[i] != 'object'){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
args[i]=util.inspect(
|
|
||||||
args[i],
|
|
||||||
{
|
|
||||||
depth:this.config.logDepth,
|
|
||||||
colors:this.config.logInColor
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.config.logger(
|
|
||||||
args.join(' ')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function disconnect(id){
|
|
||||||
if(!this.of[id]){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.of[id].explicitlyDisconnected=true;
|
|
||||||
|
|
||||||
this.of[id].off('*','*');
|
|
||||||
if(this.of[id].socket){
|
|
||||||
if(this.of[id].socket.destroy){
|
|
||||||
this.of[id].socket.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete this.of[id];
|
|
||||||
}
|
|
||||||
|
|
||||||
function serve(path,callback){
|
|
||||||
if(typeof path=='function'){
|
|
||||||
callback=path;
|
|
||||||
path=false;
|
|
||||||
}
|
|
||||||
if(!path){
|
|
||||||
this.log(
|
|
||||||
'Server path not specified, so defaulting to',
|
|
||||||
'ipc.config.socketRoot + ipc.config.appspace + ipc.config.id',
|
|
||||||
this.config.socketRoot+this.config.appspace+this.config.id
|
|
||||||
);
|
|
||||||
path=this.config.socketRoot+this.config.appspace+this.config.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!callback){
|
|
||||||
callback=emptyCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.server=new Server(
|
|
||||||
path,
|
|
||||||
this.config,
|
|
||||||
log
|
|
||||||
);
|
|
||||||
|
|
||||||
this.server.on(
|
|
||||||
'start',
|
|
||||||
callback
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function emptyCallback(){
|
|
||||||
//Do Nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
function serveNet(host,port,UDPType,callback){
|
|
||||||
if(typeof host=='number'){
|
|
||||||
callback=UDPType;
|
|
||||||
UDPType=port;
|
|
||||||
port=host;
|
|
||||||
host=false;
|
|
||||||
}
|
|
||||||
if(typeof host=='function'){
|
|
||||||
callback=host;
|
|
||||||
UDPType=false;
|
|
||||||
host=false;
|
|
||||||
port=false;
|
|
||||||
}
|
|
||||||
if(!host){
|
|
||||||
this.log(
|
|
||||||
'Server host not specified, so defaulting to',
|
|
||||||
'ipc.config.networkHost',
|
|
||||||
this.config.networkHost
|
|
||||||
);
|
|
||||||
host=this.config.networkHost;
|
|
||||||
}
|
|
||||||
if(host.toLowerCase()=='udp4' || host.toLowerCase()=='udp6'){
|
|
||||||
callback=port;
|
|
||||||
UDPType=host.toLowerCase();
|
|
||||||
port=false;
|
|
||||||
host=this.config.networkHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof port=='string'){
|
|
||||||
callback=UDPType;
|
|
||||||
UDPType=port;
|
|
||||||
port=false;
|
|
||||||
}
|
|
||||||
if(typeof port=='function'){
|
|
||||||
callback=port;
|
|
||||||
UDPType=false;
|
|
||||||
port=false;
|
|
||||||
}
|
|
||||||
if(!port){
|
|
||||||
this.log(
|
|
||||||
'Server port not specified, so defaulting to',
|
|
||||||
'ipc.config.networkPort',
|
|
||||||
this.config.networkPort
|
|
||||||
);
|
|
||||||
port=this.config.networkPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof UDPType=='function'){
|
|
||||||
callback=UDPType;
|
|
||||||
UDPType=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!callback){
|
|
||||||
callback=emptyCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.server=new Server(
|
|
||||||
host,
|
|
||||||
this.config,
|
|
||||||
log,
|
|
||||||
port
|
|
||||||
);
|
|
||||||
|
|
||||||
if(UDPType){
|
|
||||||
this.server[UDPType]=true;
|
|
||||||
if(UDPType === "udp4" && host === "::1") {
|
|
||||||
// bind udp4 socket to an ipv4 address
|
|
||||||
this.server.path = "127.0.0.1";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.server.on(
|
|
||||||
'start',
|
|
||||||
callback
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function connect(id,path,callback){
|
|
||||||
if(typeof path == 'function'){
|
|
||||||
callback=path;
|
|
||||||
path=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!callback){
|
|
||||||
callback=emptyCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!id){
|
|
||||||
this.log(
|
|
||||||
'Service id required',
|
|
||||||
'Requested service connection without specifying service id. Aborting connection attempt'
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!path){
|
|
||||||
this.log(
|
|
||||||
'Service path not specified, so defaulting to',
|
|
||||||
'ipc.config.socketRoot + ipc.config.appspace + id',
|
|
||||||
(this.config.socketRoot+this.config.appspace+id).data
|
|
||||||
);
|
|
||||||
path=this.config.socketRoot+this.config.appspace+id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.of[id]){
|
|
||||||
if(!this.of[id].socket.destroyed){
|
|
||||||
this.log(
|
|
||||||
'Already Connected to',
|
|
||||||
id,
|
|
||||||
'- So executing success without connection'
|
|
||||||
);
|
|
||||||
callback();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.of[id].socket.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.of[id] = new Client(this.config,this.log);
|
|
||||||
this.of[id].id = id;
|
|
||||||
this.of[id].path = path;
|
|
||||||
|
|
||||||
this.of[id].connect();
|
|
||||||
|
|
||||||
callback(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
function connectNet(id,host,port,callback){
|
|
||||||
if(!id){
|
|
||||||
this.log(
|
|
||||||
'Service id required',
|
|
||||||
'Requested service connection without specifying service id. Aborting connection attempt'
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(typeof host=='number'){
|
|
||||||
callback=port;
|
|
||||||
port=host;
|
|
||||||
host=false;
|
|
||||||
}
|
|
||||||
if(typeof host=='function'){
|
|
||||||
callback=host;
|
|
||||||
host=false;
|
|
||||||
port=false;
|
|
||||||
}
|
|
||||||
if(!host){
|
|
||||||
this.log(
|
|
||||||
'Server host not specified, so defaulting to',
|
|
||||||
'ipc.config.networkHost',
|
|
||||||
this.config.networkHost
|
|
||||||
);
|
|
||||||
host=this.config.networkHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof port=='function'){
|
|
||||||
callback=port;
|
|
||||||
port=false;
|
|
||||||
}
|
|
||||||
if(!port){
|
|
||||||
this.log(
|
|
||||||
'Server port not specified, so defaulting to',
|
|
||||||
'ipc.config.networkPort',
|
|
||||||
this.config.networkPort
|
|
||||||
);
|
|
||||||
port=this.config.networkPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof callback == 'string'){
|
|
||||||
UDPType=callback;
|
|
||||||
callback=false;
|
|
||||||
}
|
|
||||||
if(!callback){
|
|
||||||
callback=emptyCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.of[id]){
|
|
||||||
if(!this.of[id].socket.destroyed){
|
|
||||||
|
|
||||||
this.log(
|
|
||||||
'Already Connected to',
|
|
||||||
id,
|
|
||||||
'- So executing success without connection'
|
|
||||||
);
|
|
||||||
callback();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.of[id].socket.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.of[id] = new Client(this.config,this.log);
|
|
||||||
this.of[id].id = id;
|
|
||||||
(this.of[id].socket)? this.of[id].socket.id=id:null;
|
|
||||||
this.of[id].path = host;
|
|
||||||
this.of[id].port = port;
|
|
||||||
|
|
||||||
this.of[id].connect();
|
|
||||||
|
|
||||||
callback(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports=IPC;
|
|
202
node_modules/@ampproject/remapping/LICENSE
generated
vendored
202
node_modules/@ampproject/remapping/LICENSE
generated
vendored
@ -1,202 +0,0 @@
|
|||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
218
node_modules/@ampproject/remapping/README.md
generated
vendored
218
node_modules/@ampproject/remapping/README.md
generated
vendored
@ -1,218 +0,0 @@
|
|||||||
# @ampproject/remapping
|
|
||||||
|
|
||||||
> Remap sequential sourcemaps through transformations to point at the original source code
|
|
||||||
|
|
||||||
Remapping allows you to take the sourcemaps generated through transforming your code and "remap"
|
|
||||||
them to the original source locations. Think "my minified code, transformed with babel and bundled
|
|
||||||
with webpack", all pointing to the correct location in your original source code.
|
|
||||||
|
|
||||||
With remapping, none of your source code transformations need to be aware of the input's sourcemap,
|
|
||||||
they only need to generate an output sourcemap. This greatly simplifies building custom
|
|
||||||
transformations (think a find-and-replace).
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install @ampproject/remapping
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
function remapping(
|
|
||||||
map: SourceMap | SourceMap[],
|
|
||||||
loader: (file: string, ctx: LoaderContext) => (SourceMap | null | undefined),
|
|
||||||
options?: { excludeContent: boolean, decodedMappings: boolean }
|
|
||||||
): SourceMap;
|
|
||||||
|
|
||||||
// LoaderContext gives the loader the importing sourcemap, tree depth, the ability to override the
|
|
||||||
// "source" location (where child sources are resolved relative to, or the location of original
|
|
||||||
// source), and the ability to override the "content" of an original source for inclusion in the
|
|
||||||
// output sourcemap.
|
|
||||||
type LoaderContext = {
|
|
||||||
readonly importer: string;
|
|
||||||
readonly depth: number;
|
|
||||||
source: string;
|
|
||||||
content: string | null | undefined;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
`remapping` takes the final output sourcemap, and a `loader` function. For every source file pointer
|
|
||||||
in the sourcemap, the `loader` will be called with the resolved path. If the path itself represents
|
|
||||||
a transformed file (it has a sourcmap associated with it), then the `loader` should return that
|
|
||||||
sourcemap. If not, the path will be treated as an original, untransformed source code.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Babel transformed "helloworld.js" into "transformed.js"
|
|
||||||
const transformedMap = JSON.stringify({
|
|
||||||
file: 'transformed.js',
|
|
||||||
// 1st column of 2nd line of output file translates into the 1st source
|
|
||||||
// file, line 3, column 2
|
|
||||||
mappings: ';CAEE',
|
|
||||||
sources: ['helloworld.js'],
|
|
||||||
version: 3,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Uglify minified "transformed.js" into "transformed.min.js"
|
|
||||||
const minifiedTransformedMap = JSON.stringify({
|
|
||||||
file: 'transformed.min.js',
|
|
||||||
// 0th column of 1st line of output file translates into the 1st source
|
|
||||||
// file, line 2, column 1.
|
|
||||||
mappings: 'AACC',
|
|
||||||
names: [],
|
|
||||||
sources: ['transformed.js'],
|
|
||||||
version: 3,
|
|
||||||
});
|
|
||||||
|
|
||||||
const remapped = remapping(
|
|
||||||
minifiedTransformedMap,
|
|
||||||
(file, ctx) => {
|
|
||||||
|
|
||||||
// The "transformed.js" file is an transformed file.
|
|
||||||
if (file === 'transformed.js') {
|
|
||||||
// The root importer is empty.
|
|
||||||
console.assert(ctx.importer === '');
|
|
||||||
// The depth in the sourcemap tree we're currently loading.
|
|
||||||
// The root `minifiedTransformedMap` is depth 0, and its source children are depth 1, etc.
|
|
||||||
console.assert(ctx.depth === 1);
|
|
||||||
|
|
||||||
return transformedMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loader will be called to load transformedMap's source file pointers as well.
|
|
||||||
console.assert(file === 'helloworld.js');
|
|
||||||
// `transformed.js`'s sourcemap points into `helloworld.js`.
|
|
||||||
console.assert(ctx.importer === 'transformed.js');
|
|
||||||
// This is a source child of `transformed`, which is a source child of `minifiedTransformedMap`.
|
|
||||||
console.assert(ctx.depth === 2);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(remapped);
|
|
||||||
// {
|
|
||||||
// file: 'transpiled.min.js',
|
|
||||||
// mappings: 'AAEE',
|
|
||||||
// sources: ['helloworld.js'],
|
|
||||||
// version: 3,
|
|
||||||
// };
|
|
||||||
```
|
|
||||||
|
|
||||||
In this example, `loader` will be called twice:
|
|
||||||
|
|
||||||
1. `"transformed.js"`, the first source file pointer in the `minifiedTransformedMap`. We return the
|
|
||||||
associated sourcemap for it (its a transformed file, after all) so that sourcemap locations can
|
|
||||||
be traced through it into the source files it represents.
|
|
||||||
2. `"helloworld.js"`, our original, unmodified source code. This file does not have a sourcemap, so
|
|
||||||
we return `null`.
|
|
||||||
|
|
||||||
The `remapped` sourcemap now points from `transformed.min.js` into locations in `helloworld.js`. If
|
|
||||||
you were to read the `mappings`, it says "0th column of the first line output line points to the 1st
|
|
||||||
column of the 2nd line of the file `helloworld.js`".
|
|
||||||
|
|
||||||
### Multiple transformations of a file
|
|
||||||
|
|
||||||
As a convenience, if you have multiple single-source transformations of a file, you may pass an
|
|
||||||
array of sourcemap files in the order of most-recent transformation sourcemap first. Note that this
|
|
||||||
changes the `importer` and `depth` of each call to our loader. So our above example could have been
|
|
||||||
written as:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const remapped = remapping(
|
|
||||||
[minifiedTransformedMap, transformedMap],
|
|
||||||
() => null
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(remapped);
|
|
||||||
// {
|
|
||||||
// file: 'transpiled.min.js',
|
|
||||||
// mappings: 'AAEE',
|
|
||||||
// sources: ['helloworld.js'],
|
|
||||||
// version: 3,
|
|
||||||
// };
|
|
||||||
```
|
|
||||||
|
|
||||||
### Advanced control of the loading graph
|
|
||||||
|
|
||||||
#### `source`
|
|
||||||
|
|
||||||
The `source` property can overridden to any value to change the location of the current load. Eg,
|
|
||||||
for an original source file, it allows us to change the location to the original source regardless
|
|
||||||
of what the sourcemap source entry says. And for transformed files, it allows us to change the
|
|
||||||
relative resolving location for child sources of the loaded sourcemap.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const remapped = remapping(
|
|
||||||
minifiedTransformedMap,
|
|
||||||
(file, ctx) => {
|
|
||||||
|
|
||||||
if (file === 'transformed.js') {
|
|
||||||
// We pretend the transformed.js file actually exists in the 'src/' directory. When the nested
|
|
||||||
// source files are loaded, they will now be relative to `src/`.
|
|
||||||
ctx.source = 'src/transformed.js';
|
|
||||||
return transformedMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.assert(file === 'src/helloworld.js');
|
|
||||||
// We could futher change the source of this original file, eg, to be inside a nested directory
|
|
||||||
// itself. This will be reflected in the remapped sourcemap.
|
|
||||||
ctx.source = 'src/nested/transformed.js';
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(remapped);
|
|
||||||
// {
|
|
||||||
// …,
|
|
||||||
// sources: ['src/nested/helloworld.js'],
|
|
||||||
// };
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### `content`
|
|
||||||
|
|
||||||
The `content` property can be overridden when we encounter an original source file. Eg, this allows
|
|
||||||
you to manually provide the source content of the original file regardless of whether the
|
|
||||||
`sourcesContent` field is present in the parent sourcemap. It can also be set to `null` to remove
|
|
||||||
the source content.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const remapped = remapping(
|
|
||||||
minifiedTransformedMap,
|
|
||||||
(file, ctx) => {
|
|
||||||
|
|
||||||
if (file === 'transformed.js') {
|
|
||||||
// transformedMap does not include a `sourcesContent` field, so usually the remapped sourcemap
|
|
||||||
// would not include any `sourcesContent` values.
|
|
||||||
return transformedMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.assert(file === 'helloworld.js');
|
|
||||||
// We can read the file to provide the source content.
|
|
||||||
ctx.content = fs.readFileSync(file, 'utf8');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(remapped);
|
|
||||||
// {
|
|
||||||
// …,
|
|
||||||
// sourcesContent: [
|
|
||||||
// 'console.log("Hello world!")',
|
|
||||||
// ],
|
|
||||||
// };
|
|
||||||
```
|
|
||||||
|
|
||||||
### Options
|
|
||||||
|
|
||||||
#### excludeContent
|
|
||||||
|
|
||||||
By default, `excludeContent` is `false`. Passing `{ excludeContent: true }` will exclude the
|
|
||||||
`sourcesContent` field from the returned sourcemap. This is mainly useful when you want to reduce
|
|
||||||
the size out the sourcemap.
|
|
||||||
|
|
||||||
#### decodedMappings
|
|
||||||
|
|
||||||
By default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }` will leave the
|
|
||||||
`mappings` field in a [decoded state](https://github.com/rich-harris/sourcemap-codec) instead of
|
|
||||||
encoding into a VLQ string.
|
|
197
node_modules/@ampproject/remapping/dist/remapping.mjs
generated
vendored
197
node_modules/@ampproject/remapping/dist/remapping.mjs
generated
vendored
@ -1,197 +0,0 @@
|
|||||||
import { decodedMappings, traceSegment, TraceMap } from '@jridgewell/trace-mapping';
|
|
||||||
import { GenMapping, maybeAddSegment, setSourceContent, setIgnore, toDecodedMap, toEncodedMap } from '@jridgewell/gen-mapping';
|
|
||||||
|
|
||||||
const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null, false);
|
|
||||||
const EMPTY_SOURCES = [];
|
|
||||||
function SegmentObject(source, line, column, name, content, ignore) {
|
|
||||||
return { source, line, column, name, content, ignore };
|
|
||||||
}
|
|
||||||
function Source(map, sources, source, content, ignore) {
|
|
||||||
return {
|
|
||||||
map,
|
|
||||||
sources,
|
|
||||||
source,
|
|
||||||
content,
|
|
||||||
ignore,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
|
||||||
* (which may themselves be SourceMapTrees).
|
|
||||||
*/
|
|
||||||
function MapSource(map, sources) {
|
|
||||||
return Source(map, sources, '', null, false);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
|
||||||
* segment tracing ends at the `OriginalSource`.
|
|
||||||
*/
|
|
||||||
function OriginalSource(source, content, ignore) {
|
|
||||||
return Source(null, EMPTY_SOURCES, source, content, ignore);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
|
||||||
* resolving each mapping in terms of the original source files.
|
|
||||||
*/
|
|
||||||
function traceMappings(tree) {
|
|
||||||
// TODO: Eventually support sourceRoot, which has to be removed because the sources are already
|
|
||||||
// fully resolved. We'll need to make sources relative to the sourceRoot before adding them.
|
|
||||||
const gen = new GenMapping({ file: tree.map.file });
|
|
||||||
const { sources: rootSources, map } = tree;
|
|
||||||
const rootNames = map.names;
|
|
||||||
const rootMappings = decodedMappings(map);
|
|
||||||
for (let i = 0; i < rootMappings.length; i++) {
|
|
||||||
const segments = rootMappings[i];
|
|
||||||
for (let j = 0; j < segments.length; j++) {
|
|
||||||
const segment = segments[j];
|
|
||||||
const genCol = segment[0];
|
|
||||||
let traced = SOURCELESS_MAPPING;
|
|
||||||
// 1-length segments only move the current generated column, there's no source information
|
|
||||||
// to gather from it.
|
|
||||||
if (segment.length !== 1) {
|
|
||||||
const source = rootSources[segment[1]];
|
|
||||||
traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
|
||||||
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
|
||||||
// respective segment into an original source.
|
|
||||||
if (traced == null)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const { column, line, name, content, source, ignore } = traced;
|
|
||||||
maybeAddSegment(gen, i, genCol, source, line, column, name);
|
|
||||||
if (source && content != null)
|
|
||||||
setSourceContent(gen, source, content);
|
|
||||||
if (ignore)
|
|
||||||
setIgnore(gen, source, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return gen;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
|
||||||
* child SourceMapTrees, until we find the original source map.
|
|
||||||
*/
|
|
||||||
function originalPositionFor(source, line, column, name) {
|
|
||||||
if (!source.map) {
|
|
||||||
return SegmentObject(source.source, line, column, name, source.content, source.ignore);
|
|
||||||
}
|
|
||||||
const segment = traceSegment(source.map, line, column);
|
|
||||||
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
|
||||||
if (segment == null)
|
|
||||||
return null;
|
|
||||||
// 1-length segments only move the current generated column, there's no source information
|
|
||||||
// to gather from it.
|
|
||||||
if (segment.length === 1)
|
|
||||||
return SOURCELESS_MAPPING;
|
|
||||||
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asArray(value) {
|
|
||||||
if (Array.isArray(value))
|
|
||||||
return value;
|
|
||||||
return [value];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
|
||||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
|
||||||
* `OriginalSource`s and `SourceMapTree`s.
|
|
||||||
*
|
|
||||||
* Every sourcemap is composed of a collection of source files and mappings
|
|
||||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
|
||||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
|
||||||
* does not have an associated sourcemap, it is considered an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*/
|
|
||||||
function buildSourceMapTree(input, loader) {
|
|
||||||
const maps = asArray(input).map((m) => new TraceMap(m, ''));
|
|
||||||
const map = maps.pop();
|
|
||||||
for (let i = 0; i < maps.length; i++) {
|
|
||||||
if (maps[i].sources.length > 1) {
|
|
||||||
throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
|
|
||||||
'Did you specify these with the most recent transformation maps first?');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let tree = build(map, loader, '', 0);
|
|
||||||
for (let i = maps.length - 1; i >= 0; i--) {
|
|
||||||
tree = MapSource(maps[i], [tree]);
|
|
||||||
}
|
|
||||||
return tree;
|
|
||||||
}
|
|
||||||
function build(map, loader, importer, importerDepth) {
|
|
||||||
const { resolvedSources, sourcesContent, ignoreList } = map;
|
|
||||||
const depth = importerDepth + 1;
|
|
||||||
const children = resolvedSources.map((sourceFile, i) => {
|
|
||||||
// The loading context gives the loader more information about why this file is being loaded
|
|
||||||
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
|
||||||
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
|
||||||
// an unmodified source file.
|
|
||||||
const ctx = {
|
|
||||||
importer,
|
|
||||||
depth,
|
|
||||||
source: sourceFile || '',
|
|
||||||
content: undefined,
|
|
||||||
ignore: undefined,
|
|
||||||
};
|
|
||||||
// Use the provided loader callback to retrieve the file's sourcemap.
|
|
||||||
// TODO: We should eventually support async loading of sourcemap files.
|
|
||||||
const sourceMap = loader(ctx.source, ctx);
|
|
||||||
const { source, content, ignore } = ctx;
|
|
||||||
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
|
||||||
if (sourceMap)
|
|
||||||
return build(new TraceMap(sourceMap, source), loader, source, depth);
|
|
||||||
// Else, it's an unmodified source file.
|
|
||||||
// The contents of this unmodified source file can be overridden via the loader context,
|
|
||||||
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
|
||||||
// the importing sourcemap's `sourcesContent` field.
|
|
||||||
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
|
||||||
const ignored = ignore !== undefined ? ignore : ignoreList ? ignoreList.includes(i) : false;
|
|
||||||
return OriginalSource(source, sourceContent, ignored);
|
|
||||||
});
|
|
||||||
return MapSource(map, children);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
|
||||||
* provided to it.
|
|
||||||
*/
|
|
||||||
class SourceMap {
|
|
||||||
constructor(map, options) {
|
|
||||||
const out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map);
|
|
||||||
this.version = out.version; // SourceMap spec says this should be first.
|
|
||||||
this.file = out.file;
|
|
||||||
this.mappings = out.mappings;
|
|
||||||
this.names = out.names;
|
|
||||||
this.ignoreList = out.ignoreList;
|
|
||||||
this.sourceRoot = out.sourceRoot;
|
|
||||||
this.sources = out.sources;
|
|
||||||
if (!options.excludeContent) {
|
|
||||||
this.sourcesContent = out.sourcesContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toString() {
|
|
||||||
return JSON.stringify(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Traces through all the mappings in the root sourcemap, through the sources
|
|
||||||
* (and their sourcemaps), all the way back to the original source location.
|
|
||||||
*
|
|
||||||
* `loader` will be called every time we encounter a source file. If it returns
|
|
||||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
|
||||||
* it returns a falsey value, that source file is treated as an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*
|
|
||||||
* Pass `excludeContent` to exclude any self-containing source file content
|
|
||||||
* from the output sourcemap.
|
|
||||||
*
|
|
||||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
|
||||||
* VLQ encoded) mappings.
|
|
||||||
*/
|
|
||||||
function remapping(input, loader, options) {
|
|
||||||
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
|
||||||
const tree = buildSourceMapTree(input, loader);
|
|
||||||
return new SourceMap(traceMappings(tree), opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { remapping as default };
|
|
||||||
//# sourceMappingURL=remapping.mjs.map
|
|
1
node_modules/@ampproject/remapping/dist/remapping.mjs.map
generated
vendored
1
node_modules/@ampproject/remapping/dist/remapping.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
202
node_modules/@ampproject/remapping/dist/remapping.umd.js
generated
vendored
202
node_modules/@ampproject/remapping/dist/remapping.umd.js
generated
vendored
@ -1,202 +0,0 @@
|
|||||||
(function (global, factory) {
|
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@jridgewell/trace-mapping'), require('@jridgewell/gen-mapping')) :
|
|
||||||
typeof define === 'function' && define.amd ? define(['@jridgewell/trace-mapping', '@jridgewell/gen-mapping'], factory) :
|
|
||||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.remapping = factory(global.traceMapping, global.genMapping));
|
|
||||||
})(this, (function (traceMapping, genMapping) { 'use strict';
|
|
||||||
|
|
||||||
const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null, false);
|
|
||||||
const EMPTY_SOURCES = [];
|
|
||||||
function SegmentObject(source, line, column, name, content, ignore) {
|
|
||||||
return { source, line, column, name, content, ignore };
|
|
||||||
}
|
|
||||||
function Source(map, sources, source, content, ignore) {
|
|
||||||
return {
|
|
||||||
map,
|
|
||||||
sources,
|
|
||||||
source,
|
|
||||||
content,
|
|
||||||
ignore,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
|
||||||
* (which may themselves be SourceMapTrees).
|
|
||||||
*/
|
|
||||||
function MapSource(map, sources) {
|
|
||||||
return Source(map, sources, '', null, false);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
|
||||||
* segment tracing ends at the `OriginalSource`.
|
|
||||||
*/
|
|
||||||
function OriginalSource(source, content, ignore) {
|
|
||||||
return Source(null, EMPTY_SOURCES, source, content, ignore);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
|
||||||
* resolving each mapping in terms of the original source files.
|
|
||||||
*/
|
|
||||||
function traceMappings(tree) {
|
|
||||||
// TODO: Eventually support sourceRoot, which has to be removed because the sources are already
|
|
||||||
// fully resolved. We'll need to make sources relative to the sourceRoot before adding them.
|
|
||||||
const gen = new genMapping.GenMapping({ file: tree.map.file });
|
|
||||||
const { sources: rootSources, map } = tree;
|
|
||||||
const rootNames = map.names;
|
|
||||||
const rootMappings = traceMapping.decodedMappings(map);
|
|
||||||
for (let i = 0; i < rootMappings.length; i++) {
|
|
||||||
const segments = rootMappings[i];
|
|
||||||
for (let j = 0; j < segments.length; j++) {
|
|
||||||
const segment = segments[j];
|
|
||||||
const genCol = segment[0];
|
|
||||||
let traced = SOURCELESS_MAPPING;
|
|
||||||
// 1-length segments only move the current generated column, there's no source information
|
|
||||||
// to gather from it.
|
|
||||||
if (segment.length !== 1) {
|
|
||||||
const source = rootSources[segment[1]];
|
|
||||||
traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
|
||||||
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
|
||||||
// respective segment into an original source.
|
|
||||||
if (traced == null)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const { column, line, name, content, source, ignore } = traced;
|
|
||||||
genMapping.maybeAddSegment(gen, i, genCol, source, line, column, name);
|
|
||||||
if (source && content != null)
|
|
||||||
genMapping.setSourceContent(gen, source, content);
|
|
||||||
if (ignore)
|
|
||||||
genMapping.setIgnore(gen, source, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return gen;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
|
||||||
* child SourceMapTrees, until we find the original source map.
|
|
||||||
*/
|
|
||||||
function originalPositionFor(source, line, column, name) {
|
|
||||||
if (!source.map) {
|
|
||||||
return SegmentObject(source.source, line, column, name, source.content, source.ignore);
|
|
||||||
}
|
|
||||||
const segment = traceMapping.traceSegment(source.map, line, column);
|
|
||||||
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
|
||||||
if (segment == null)
|
|
||||||
return null;
|
|
||||||
// 1-length segments only move the current generated column, there's no source information
|
|
||||||
// to gather from it.
|
|
||||||
if (segment.length === 1)
|
|
||||||
return SOURCELESS_MAPPING;
|
|
||||||
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asArray(value) {
|
|
||||||
if (Array.isArray(value))
|
|
||||||
return value;
|
|
||||||
return [value];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
|
||||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
|
||||||
* `OriginalSource`s and `SourceMapTree`s.
|
|
||||||
*
|
|
||||||
* Every sourcemap is composed of a collection of source files and mappings
|
|
||||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
|
||||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
|
||||||
* does not have an associated sourcemap, it is considered an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*/
|
|
||||||
function buildSourceMapTree(input, loader) {
|
|
||||||
const maps = asArray(input).map((m) => new traceMapping.TraceMap(m, ''));
|
|
||||||
const map = maps.pop();
|
|
||||||
for (let i = 0; i < maps.length; i++) {
|
|
||||||
if (maps[i].sources.length > 1) {
|
|
||||||
throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
|
|
||||||
'Did you specify these with the most recent transformation maps first?');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let tree = build(map, loader, '', 0);
|
|
||||||
for (let i = maps.length - 1; i >= 0; i--) {
|
|
||||||
tree = MapSource(maps[i], [tree]);
|
|
||||||
}
|
|
||||||
return tree;
|
|
||||||
}
|
|
||||||
function build(map, loader, importer, importerDepth) {
|
|
||||||
const { resolvedSources, sourcesContent, ignoreList } = map;
|
|
||||||
const depth = importerDepth + 1;
|
|
||||||
const children = resolvedSources.map((sourceFile, i) => {
|
|
||||||
// The loading context gives the loader more information about why this file is being loaded
|
|
||||||
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
|
||||||
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
|
||||||
// an unmodified source file.
|
|
||||||
const ctx = {
|
|
||||||
importer,
|
|
||||||
depth,
|
|
||||||
source: sourceFile || '',
|
|
||||||
content: undefined,
|
|
||||||
ignore: undefined,
|
|
||||||
};
|
|
||||||
// Use the provided loader callback to retrieve the file's sourcemap.
|
|
||||||
// TODO: We should eventually support async loading of sourcemap files.
|
|
||||||
const sourceMap = loader(ctx.source, ctx);
|
|
||||||
const { source, content, ignore } = ctx;
|
|
||||||
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
|
||||||
if (sourceMap)
|
|
||||||
return build(new traceMapping.TraceMap(sourceMap, source), loader, source, depth);
|
|
||||||
// Else, it's an unmodified source file.
|
|
||||||
// The contents of this unmodified source file can be overridden via the loader context,
|
|
||||||
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
|
||||||
// the importing sourcemap's `sourcesContent` field.
|
|
||||||
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
|
||||||
const ignored = ignore !== undefined ? ignore : ignoreList ? ignoreList.includes(i) : false;
|
|
||||||
return OriginalSource(source, sourceContent, ignored);
|
|
||||||
});
|
|
||||||
return MapSource(map, children);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
|
||||||
* provided to it.
|
|
||||||
*/
|
|
||||||
class SourceMap {
|
|
||||||
constructor(map, options) {
|
|
||||||
const out = options.decodedMappings ? genMapping.toDecodedMap(map) : genMapping.toEncodedMap(map);
|
|
||||||
this.version = out.version; // SourceMap spec says this should be first.
|
|
||||||
this.file = out.file;
|
|
||||||
this.mappings = out.mappings;
|
|
||||||
this.names = out.names;
|
|
||||||
this.ignoreList = out.ignoreList;
|
|
||||||
this.sourceRoot = out.sourceRoot;
|
|
||||||
this.sources = out.sources;
|
|
||||||
if (!options.excludeContent) {
|
|
||||||
this.sourcesContent = out.sourcesContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toString() {
|
|
||||||
return JSON.stringify(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Traces through all the mappings in the root sourcemap, through the sources
|
|
||||||
* (and their sourcemaps), all the way back to the original source location.
|
|
||||||
*
|
|
||||||
* `loader` will be called every time we encounter a source file. If it returns
|
|
||||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
|
||||||
* it returns a falsey value, that source file is treated as an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*
|
|
||||||
* Pass `excludeContent` to exclude any self-containing source file content
|
|
||||||
* from the output sourcemap.
|
|
||||||
*
|
|
||||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
|
||||||
* VLQ encoded) mappings.
|
|
||||||
*/
|
|
||||||
function remapping(input, loader, options) {
|
|
||||||
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
|
||||||
const tree = buildSourceMapTree(input, loader);
|
|
||||||
return new SourceMap(traceMappings(tree), opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
return remapping;
|
|
||||||
|
|
||||||
}));
|
|
||||||
//# sourceMappingURL=remapping.umd.js.map
|
|
1
node_modules/@ampproject/remapping/dist/remapping.umd.js.map
generated
vendored
1
node_modules/@ampproject/remapping/dist/remapping.umd.js.map
generated
vendored
File diff suppressed because one or more lines are too long
14
node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts
generated
vendored
14
node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts
generated
vendored
@ -1,14 +0,0 @@
|
|||||||
import type { MapSource as MapSourceType } from './source-map-tree';
|
|
||||||
import type { SourceMapInput, SourceMapLoader } from './types';
|
|
||||||
/**
|
|
||||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
|
||||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
|
||||||
* `OriginalSource`s and `SourceMapTree`s.
|
|
||||||
*
|
|
||||||
* Every sourcemap is composed of a collection of source files and mappings
|
|
||||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
|
||||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
|
||||||
* does not have an associated sourcemap, it is considered an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*/
|
|
||||||
export default function buildSourceMapTree(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader): MapSourceType;
|
|
20
node_modules/@ampproject/remapping/dist/types/remapping.d.ts
generated
vendored
20
node_modules/@ampproject/remapping/dist/types/remapping.d.ts
generated
vendored
@ -1,20 +0,0 @@
|
|||||||
import SourceMap from './source-map';
|
|
||||||
import type { SourceMapInput, SourceMapLoader, Options } from './types';
|
|
||||||
export type { SourceMapSegment, EncodedSourceMap, EncodedSourceMap as RawSourceMap, DecodedSourceMap, SourceMapInput, SourceMapLoader, LoaderContext, Options, } from './types';
|
|
||||||
export type { SourceMap };
|
|
||||||
/**
|
|
||||||
* Traces through all the mappings in the root sourcemap, through the sources
|
|
||||||
* (and their sourcemaps), all the way back to the original source location.
|
|
||||||
*
|
|
||||||
* `loader` will be called every time we encounter a source file. If it returns
|
|
||||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
|
||||||
* it returns a falsey value, that source file is treated as an original,
|
|
||||||
* unmodified source file.
|
|
||||||
*
|
|
||||||
* Pass `excludeContent` to exclude any self-containing source file content
|
|
||||||
* from the output sourcemap.
|
|
||||||
*
|
|
||||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
|
||||||
* VLQ encoded) mappings.
|
|
||||||
*/
|
|
||||||
export default function remapping(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader, options?: boolean | Options): SourceMap;
|
|
45
node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts
generated
vendored
45
node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts
generated
vendored
@ -1,45 +0,0 @@
|
|||||||
import { GenMapping } from '@jridgewell/gen-mapping';
|
|
||||||
import type { TraceMap } from '@jridgewell/trace-mapping';
|
|
||||||
export declare type SourceMapSegmentObject = {
|
|
||||||
column: number;
|
|
||||||
line: number;
|
|
||||||
name: string;
|
|
||||||
source: string;
|
|
||||||
content: string | null;
|
|
||||||
ignore: boolean;
|
|
||||||
};
|
|
||||||
export declare type OriginalSource = {
|
|
||||||
map: null;
|
|
||||||
sources: Sources[];
|
|
||||||
source: string;
|
|
||||||
content: string | null;
|
|
||||||
ignore: boolean;
|
|
||||||
};
|
|
||||||
export declare type MapSource = {
|
|
||||||
map: TraceMap;
|
|
||||||
sources: Sources[];
|
|
||||||
source: string;
|
|
||||||
content: null;
|
|
||||||
ignore: false;
|
|
||||||
};
|
|
||||||
export declare type Sources = OriginalSource | MapSource;
|
|
||||||
/**
|
|
||||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
|
||||||
* (which may themselves be SourceMapTrees).
|
|
||||||
*/
|
|
||||||
export declare function MapSource(map: TraceMap, sources: Sources[]): MapSource;
|
|
||||||
/**
|
|
||||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
|
||||||
* segment tracing ends at the `OriginalSource`.
|
|
||||||
*/
|
|
||||||
export declare function OriginalSource(source: string, content: string | null, ignore: boolean): OriginalSource;
|
|
||||||
/**
|
|
||||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
|
||||||
* resolving each mapping in terms of the original source files.
|
|
||||||
*/
|
|
||||||
export declare function traceMappings(tree: MapSource): GenMapping;
|
|
||||||
/**
|
|
||||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
|
||||||
* child SourceMapTrees, until we find the original source map.
|
|
||||||
*/
|
|
||||||
export declare function originalPositionFor(source: Sources, line: number, column: number, name: string): SourceMapSegmentObject | null;
|
|
18
node_modules/@ampproject/remapping/dist/types/source-map.d.ts
generated
vendored
18
node_modules/@ampproject/remapping/dist/types/source-map.d.ts
generated
vendored
@ -1,18 +0,0 @@
|
|||||||
import type { GenMapping } from '@jridgewell/gen-mapping';
|
|
||||||
import type { DecodedSourceMap, EncodedSourceMap, Options } from './types';
|
|
||||||
/**
|
|
||||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
|
||||||
* provided to it.
|
|
||||||
*/
|
|
||||||
export default class SourceMap {
|
|
||||||
file?: string | null;
|
|
||||||
mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings'];
|
|
||||||
sourceRoot?: string;
|
|
||||||
names: string[];
|
|
||||||
sources: (string | null)[];
|
|
||||||
sourcesContent?: (string | null)[];
|
|
||||||
version: 3;
|
|
||||||
ignoreList: number[] | undefined;
|
|
||||||
constructor(map: GenMapping, options: Options);
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
15
node_modules/@ampproject/remapping/dist/types/types.d.ts
generated
vendored
15
node_modules/@ampproject/remapping/dist/types/types.d.ts
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
import type { SourceMapInput } from '@jridgewell/trace-mapping';
|
|
||||||
export type { SourceMapSegment, DecodedSourceMap, EncodedSourceMap, } from '@jridgewell/trace-mapping';
|
|
||||||
export type { SourceMapInput };
|
|
||||||
export declare type LoaderContext = {
|
|
||||||
readonly importer: string;
|
|
||||||
readonly depth: number;
|
|
||||||
source: string;
|
|
||||||
content: string | null | undefined;
|
|
||||||
ignore: boolean | undefined;
|
|
||||||
};
|
|
||||||
export declare type SourceMapLoader = (file: string, ctx: LoaderContext) => SourceMapInput | null | undefined | void;
|
|
||||||
export declare type Options = {
|
|
||||||
excludeContent?: boolean;
|
|
||||||
decodedMappings?: boolean;
|
|
||||||
};
|
|
75
node_modules/@ampproject/remapping/package.json
generated
vendored
75
node_modules/@ampproject/remapping/package.json
generated
vendored
@ -1,75 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@ampproject/remapping",
|
|
||||||
"version": "2.3.0",
|
|
||||||
"description": "Remap sequential sourcemaps through transformations to point at the original source code",
|
|
||||||
"keywords": [
|
|
||||||
"source",
|
|
||||||
"map",
|
|
||||||
"remap"
|
|
||||||
],
|
|
||||||
"main": "dist/remapping.umd.js",
|
|
||||||
"module": "dist/remapping.mjs",
|
|
||||||
"types": "dist/types/remapping.d.ts",
|
|
||||||
"exports": {
|
|
||||||
".": [
|
|
||||||
{
|
|
||||||
"types": "./dist/types/remapping.d.ts",
|
|
||||||
"browser": "./dist/remapping.umd.js",
|
|
||||||
"require": "./dist/remapping.umd.js",
|
|
||||||
"import": "./dist/remapping.mjs"
|
|
||||||
},
|
|
||||||
"./dist/remapping.umd.js"
|
|
||||||
],
|
|
||||||
"./package.json": "./package.json"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"author": "Justin Ridgewell <jridgewell@google.com>",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/ampproject/remapping.git"
|
|
||||||
},
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.0.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "run-s -n build:*",
|
|
||||||
"build:rollup": "rollup -c rollup.config.js",
|
|
||||||
"build:ts": "tsc --project tsconfig.build.json",
|
|
||||||
"lint": "run-s -n lint:*",
|
|
||||||
"lint:prettier": "npm run test:lint:prettier -- --write",
|
|
||||||
"lint:ts": "npm run test:lint:ts -- --fix",
|
|
||||||
"prebuild": "rm -rf dist",
|
|
||||||
"prepublishOnly": "npm run preversion",
|
|
||||||
"preversion": "run-s test build",
|
|
||||||
"test": "run-s -n test:lint test:only",
|
|
||||||
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
|
||||||
"test:lint": "run-s -n test:lint:*",
|
|
||||||
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
|
||||||
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
|
||||||
"test:only": "jest --coverage",
|
|
||||||
"test:watch": "jest --coverage --watch"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@rollup/plugin-typescript": "8.3.2",
|
|
||||||
"@types/jest": "27.4.1",
|
|
||||||
"@typescript-eslint/eslint-plugin": "5.20.0",
|
|
||||||
"@typescript-eslint/parser": "5.20.0",
|
|
||||||
"eslint": "8.14.0",
|
|
||||||
"eslint-config-prettier": "8.5.0",
|
|
||||||
"jest": "27.5.1",
|
|
||||||
"jest-config": "27.5.1",
|
|
||||||
"npm-run-all": "4.1.5",
|
|
||||||
"prettier": "2.6.2",
|
|
||||||
"rollup": "2.70.2",
|
|
||||||
"ts-jest": "27.1.4",
|
|
||||||
"tslib": "2.4.0",
|
|
||||||
"typescript": "4.6.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@jridgewell/gen-mapping": "^0.3.5",
|
|
||||||
"@jridgewell/trace-mapping": "^0.3.24"
|
|
||||||
}
|
|
||||||
}
|
|
21
node_modules/@ant-design-vue/pro-layout/LICENSE
generated
vendored
21
node_modules/@ant-design-vue/pro-layout/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2020 vueComponent
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
168
node_modules/@ant-design-vue/pro-layout/README.md
generated
vendored
168
node_modules/@ant-design-vue/pro-layout/README.md
generated
vendored
@ -1,168 +0,0 @@
|
|||||||
English | [简体中文](./README.zh-CN.md)
|
|
||||||
|
|
||||||
<h1 align="center">Ant Design Pro Layout</h1>
|
|
||||||
|
|
||||||
<div align="center">
|
|
||||||
|
|
||||||
[](https://npmjs.org/package/@ant-design-vue/pro-layout) [](./package.json) [](https://npmjs.org/package/@ant-design-vue/pro-layout) [](./LICENSE)
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm i @ant-design-vue/pro-layout --save
|
|
||||||
// or
|
|
||||||
yarn add @ant-design-vue/pro-layout
|
|
||||||
```
|
|
||||||
|
|
||||||
```jsx
|
|
||||||
import ProLayout from '@ant-design-vue/pro-layout'
|
|
||||||
|
|
||||||
// by jsx
|
|
||||||
export default {
|
|
||||||
name: 'BasicLayout',
|
|
||||||
render () {
|
|
||||||
return (
|
|
||||||
<ProLayout>
|
|
||||||
<router-view />
|
|
||||||
</ProLayout>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<pro-layout
|
|
||||||
:menus="menus"
|
|
||||||
:collapsed="collapsed"
|
|
||||||
:theme="theme"
|
|
||||||
:layout="layout"
|
|
||||||
:contentWidth="contentWidth"
|
|
||||||
:auto-hide-header="autoHideHeader"
|
|
||||||
:mediaQuery="query"
|
|
||||||
:isMobile="isMobile"
|
|
||||||
:handleMediaQuery="handleMediaQuery"
|
|
||||||
:handleCollapse="handleCollapse"
|
|
||||||
>
|
|
||||||
<template v-slot:menuHeaderRender>
|
|
||||||
<div>
|
|
||||||
<img src="../assets/logo.svg" />
|
|
||||||
<h1>Pro Layout</h1>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-slot:rightContentRender>
|
|
||||||
<div :class="['ant-pro-global-header-index-right', layout === 'topmenu' && `ant-pro-global-header-index-${theme}`]">
|
|
||||||
rightContentRender
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-slot:footerRender>
|
|
||||||
<div>footerRender</div>
|
|
||||||
</template>
|
|
||||||
<setting-drawer navTheme="dark" />
|
|
||||||
<router-view />
|
|
||||||
</pro-layout>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
// by template
|
|
||||||
import ProLayout, { SettingDrawer } from '@ant-design-vue/pro-layout'
|
|
||||||
import { asyncRouterMap } from '../config/router.config'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'BasicLayout',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
menus: [],
|
|
||||||
collapsed: false,
|
|
||||||
autoHideHeader: false,
|
|
||||||
query: {},
|
|
||||||
layout: 'sidemenu',
|
|
||||||
contentWidth: 'Fluid',
|
|
||||||
theme: 'dark',
|
|
||||||
isMobile: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
this.menus = asyncRouterMap.find(item => item.path === '/').children
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleMediaQuery (query) {
|
|
||||||
this.query = query
|
|
||||||
if (this.isMobile && !query['screen-xs']) {
|
|
||||||
this.isMobile = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!this.isMobile && query['screen-xs']) {
|
|
||||||
this.isMobile = true
|
|
||||||
this.collapsed = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleCollapse (collapsed) {
|
|
||||||
this.collapsed = collapsed
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
SettingDrawer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### ProLayout
|
|
||||||
|
|
||||||
| Property | Description | Type | Default Value |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| title | layout in the upper left corner title | VNode \| String | `'Ant Design Pro'` |
|
|
||||||
| logo | layout top left logo url | VNode \| render | - |
|
|
||||||
| loading`*` | layout loading status | boolean | - |
|
|
||||||
| layout | layout menu mode, sidemenu: right navigation, topmenu: top navigation | 'sidemenu' \| 'topmenu' | `'sidemenu'` |
|
|
||||||
| contentWidth | content mode of layout, Fluid: adaptive, Fixed: fixed width 1200px | 'Fixed' \| 'Fluid' | `Fluid` |
|
|
||||||
| theme | Navigation menu theme | 'light' \| 'dark' | `'dark'` |
|
|
||||||
| menus | Vue-router `routes` prop | Object | `[{}]` |
|
|
||||||
| collapsed | control menu's collapse and expansion | boolean | true |
|
|
||||||
| isMobile | is mobile | boolean | false |
|
|
||||||
| handleCollapse | folding collapse event of menu | (collapsed: boolean) => void | - |
|
|
||||||
| menuHeaderRender | render logo and title | v-slot \| VNode \| (logo,title)=>VNode \| false | - |
|
|
||||||
| headerRender | custom header render method | (props: BasicLayoutProps) => VNode | - |
|
|
||||||
| rightContentRender | header right content render method | (props: HeaderViewProps) => VNode | - |
|
|
||||||
| collapsedButtonRender | custom collapsed button method | (collapsed: boolean) => VNode | - |
|
|
||||||
| footerRender | custom footer render method | (props: BasicLayoutProps) => VNode | `false` | - |
|
|
||||||
| breadcrumbRender | custom breadcrumb render method | ({ route, params, routes, paths, h }) => VNode[] | - |
|
|
||||||
| i18nRender | i18n | Function (key: string) => string \| `false` | `false` |
|
|
||||||
| handleMediaQuery | media matchs callback | (querys: []) => void | - |
|
|
||||||
| mediaQuery | media matchs | Array | - |
|
|
||||||
| openOnceKey | menu only open root key | `true` | - |
|
|
||||||
|
|
||||||
|
|
||||||
### PageHeaderWrapper
|
|
||||||
|
|
||||||
| Property | Description | Type | Default Value |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| content | Content area | VNode \| v-slot | - |
|
|
||||||
| extra | Extra content area, on the right side of content | VNode \| v-slot | - |
|
|
||||||
| extraContent | Extra content area, on the right side of content | VNode \| v-slot | - |
|
|
||||||
| tabList | Tabs title list | `Array<{key: string, tab: sting}>` | - |
|
|
||||||
| tab-change | Switch panel callback | (key) => void | - |
|
|
||||||
| tab-active-key | The currently highlighted tab item | string | - |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### SettingDrawer
|
|
||||||
|
|
||||||
#### {settings}
|
|
||||||
| Property | Description | Type | Default Value |
|
|
||||||
| ---- | ---- | ---- | ---- |
|
|
||||||
| theme | Theme | `dark` `light` `realDark` | `light` |
|
|
||||||
| layout | Sider Layout | `sidemenu` `topmenu` | `sidemenu` |
|
|
||||||
| primaryColor | Primary color (*development only) | `#1890ff` | |
|
|
||||||
| contentWidth | content mode of layout, Fluid: adaptive, Fixed: fixed width 1200px | 'Fixed' \| 'Fluid' | `Fluid` |
|
|
164
node_modules/@ant-design-vue/pro-layout/README.zh-CN.md
generated
vendored
164
node_modules/@ant-design-vue/pro-layout/README.zh-CN.md
generated
vendored
@ -1,164 +0,0 @@
|
|||||||
[English](./README.md) | 简体中文
|
|
||||||
|
|
||||||
<h1 align="center">Ant Design Pro Layout</h1>
|
|
||||||
|
|
||||||
<div align="center">
|
|
||||||
|
|
||||||
[](https://npmjs.org/package/@ant-design-vue/pro-layout) [](./package.json) [](https://npmjs.org/package/@ant-design-vue/pro-layout) [](./LICENSE)
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## 使用
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm i @ant-design-vue/pro-layout --save
|
|
||||||
// 或者
|
|
||||||
yarn add @ant-design-vue/pro-layout
|
|
||||||
```
|
|
||||||
|
|
||||||
```jsx
|
|
||||||
import ProLayout from '@ant-design-vue/pro-layout'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'BasicLayout',
|
|
||||||
render () {
|
|
||||||
return (
|
|
||||||
<ProLayout>
|
|
||||||
<router-view />
|
|
||||||
</ProLayout>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
```vue
|
|
||||||
<template>
|
|
||||||
<pro-layout
|
|
||||||
:menus="menus"
|
|
||||||
:collapsed="collapsed"
|
|
||||||
:theme="theme"
|
|
||||||
:layout="layout"
|
|
||||||
:contentWidth="contentWidth"
|
|
||||||
:auto-hide-header="autoHideHeader"
|
|
||||||
:mediaQuery="query"
|
|
||||||
:isMobile="isMobile"
|
|
||||||
:handleMediaQuery="handleMediaQuery"
|
|
||||||
:handleCollapse="handleCollapse"
|
|
||||||
>
|
|
||||||
<template v-slot:menuHeaderRender>
|
|
||||||
<div>
|
|
||||||
<img src="../assets/logo.svg" />
|
|
||||||
<h1>Pro Layout</h1>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-slot:rightContentRender>
|
|
||||||
<div :class="['ant-pro-global-header-index-right', layout === 'topmenu' && `ant-pro-global-header-index-${theme}`]">
|
|
||||||
rightContentRender
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template v-slot:footerRender>
|
|
||||||
<div>footerRender</div>
|
|
||||||
</template>
|
|
||||||
<setting-drawer navTheme="dark" />
|
|
||||||
<router-view />
|
|
||||||
</pro-layout>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import ProLayout, { SettingDrawer } from '@ant-design-vue/pro-layout'
|
|
||||||
import { asyncRouterMap } from '../config/router.config'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'BasicLayout',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
menus: [],
|
|
||||||
collapsed: false,
|
|
||||||
autoHideHeader: false,
|
|
||||||
query: {},
|
|
||||||
layout: 'sidemenu',
|
|
||||||
contentWidth: 'Fluid',
|
|
||||||
theme: 'dark',
|
|
||||||
isMobile: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
this.menus = asyncRouterMap.find(item => item.path === '/').children
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleMediaQuery (query) {
|
|
||||||
this.query = query
|
|
||||||
if (this.isMobile && !query['screen-xs']) {
|
|
||||||
this.isMobile = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!this.isMobile && query['screen-xs']) {
|
|
||||||
this.isMobile = true
|
|
||||||
this.collapsed = false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleCollapse (collapsed) {
|
|
||||||
this.collapsed = collapsed
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
SettingDrawer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### ProLayout
|
|
||||||
|
|
||||||
| Property | Description | Type | Default Value |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| title | layout 的 左上角 的 title | VNode \| String | `'Ant Design Pro'` |
|
|
||||||
| logo | layout 的 左上角 logo 的 url | VNode \| render | - |
|
|
||||||
| loading`*` | layout 的加载态 | boolean | - |
|
|
||||||
| menuHeaderRender | 渲染 logo 和 title | v-slot \| VNode \| (logo,title)=>VNode \| false | - |
|
|
||||||
| layout | layout 的菜单模式, sidemenu: 右侧导航, topmenu: 顶部导航 | 'sidemenu' \| 'topmenu' | `'sidemenu'` |
|
|
||||||
| contentWidth | layout 的内容模式,Fluid:自适应,Fixed:定宽 1200px | 'Fixed' \| 'Fluid' | `Fluid` |
|
|
||||||
| theme | 导航的主题 | 'light' \| 'dark' | `'dark'` |
|
|
||||||
| menus | Vue-router `routes` 属性 | Object | `[{}]` |
|
|
||||||
| collapsed | 控制菜单的收起和展开 | boolean | true |
|
|
||||||
| isMobile | 是否为手机模式 | boolean | false |
|
|
||||||
| handleCollapse | 菜单的折叠收起事件 | (collapsed: boolean) => void | - |
|
|
||||||
| headerRender | 自定义头的 render 方法 | (props: BasicLayoutProps) => VNode | - |
|
|
||||||
| rightContentRender | 自定义头右部的 render 方法 | (props: HeaderViewProps) => VNode | - |
|
|
||||||
| collapsedButtonRender | 自定义 侧栏收缩按钮 的方法 | (collapsed: boolean) => VNode | - |
|
|
||||||
| footerRender | 自定义 底部区域内容 | (props: BasicLayoutProps) => VNode | `false` | - |
|
|
||||||
| breadcrumbRender | 自定义面包屑渲染方法 | ({ route, params, routes, paths, h }) => VNode[] | - |
|
|
||||||
| i18nRender | 本地化渲染函数 (this.$t) | Function (key: string) => string \| `false` | `false` |
|
|
||||||
| handleMediaQuery | 媒体查询回调 | (querys: []) => void | - |
|
|
||||||
| mediaQuery | ProLayout 当前的媒体查询 | Array | - |
|
|
||||||
| openOnceKey | Menu菜单最多只打开一个 | `true` | - |
|
|
||||||
|
|
||||||
|
|
||||||
### PageHeaderWrapper
|
|
||||||
|
|
||||||
| Property | Description | Type | Default Value |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| content | 内容区 | VNode \| v-slot | - |
|
|
||||||
| extra | 扩展区域 | VNode \| v-slot | - |
|
|
||||||
| extraContent | 扩展内容区 | VNode \| v-slot | - |
|
|
||||||
| tabList | Tabs 导航 | `Array<{key: string, tab: sting}>` | - |
|
|
||||||
| tab-change | Tab 改变事件 | (key) => void | - |
|
|
||||||
| tab-active-key | 当前 Tab 选中项 | string | - |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### SettingDrawer
|
|
||||||
|
|
||||||
#### {settings}
|
|
||||||
|
|
||||||
| Property | Description | Type | Default Value |
|
|
||||||
| ---- | ---- | ---- | ---- |
|
|
||||||
| theme | 主题 | `dark` `light` `realDark` | `light` |
|
|
||||||
| layout | 布局模式 | `sidemenu` `topmenu` | `sidemenu` |
|
|
||||||
| primaryColor | 主色调 (*仅开发环境生效) | `#1890ff` | |
|
|
173
node_modules/@ant-design-vue/pro-layout/es/BasicLayout.js
generated
vendored
173
node_modules/@ant-design-vue/pro-layout/es/BasicLayout.js
generated
vendored
@ -1,173 +0,0 @@
|
|||||||
import _mergeJSXProps from "babel-helper-vue-jsx-merge-props";
|
|
||||||
|
|
||||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
||||||
|
|
||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
||||||
|
|
||||||
import './BasicLayout.less';
|
|
||||||
import PropTypes from 'ant-design-vue/es/_util/vue-types';
|
|
||||||
import 'ant-design-vue/es/layout/style';
|
|
||||||
import Layout from 'ant-design-vue/es/layout';
|
|
||||||
import { ContainerQuery } from 'vue-container-query';
|
|
||||||
import { SiderMenuWrapper, GlobalFooter } from './components';
|
|
||||||
import { contentWidthCheck, getComponentFromProp, isFun } from './utils/util';
|
|
||||||
import { SiderMenuProps } from './components/SiderMenu';
|
|
||||||
import HeaderView, { HeaderViewProps } from './Header';
|
|
||||||
import WrapContent from './WrapContent';
|
|
||||||
import ConfigProvider from './components/ConfigProvider';
|
|
||||||
import PageHeaderWrapper from './components/PageHeaderWrapper';
|
|
||||||
export var BasicLayoutProps = _objectSpread({}, SiderMenuProps, HeaderViewProps, {
|
|
||||||
contentWidth: PropTypes.oneOf(['Fluid', 'Fixed']).def('Fluid'),
|
|
||||||
// contentWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).def('Fluid'),
|
|
||||||
locale: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).def('en-US'),
|
|
||||||
breadcrumbRender: PropTypes.func,
|
|
||||||
disableMobile: PropTypes.bool.def(false),
|
|
||||||
mediaQuery: PropTypes.object.def({}),
|
|
||||||
handleMediaQuery: PropTypes.func,
|
|
||||||
footerRender: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]).def(undefined)
|
|
||||||
});
|
|
||||||
var MediaQueryEnum = {
|
|
||||||
'screen-xs': {
|
|
||||||
maxWidth: 575
|
|
||||||
},
|
|
||||||
'screen-sm': {
|
|
||||||
minWidth: 576,
|
|
||||||
maxWidth: 767
|
|
||||||
},
|
|
||||||
'screen-md': {
|
|
||||||
minWidth: 768,
|
|
||||||
maxWidth: 991
|
|
||||||
},
|
|
||||||
'screen-lg': {
|
|
||||||
minWidth: 992,
|
|
||||||
maxWidth: 1199
|
|
||||||
},
|
|
||||||
'screen-xl': {
|
|
||||||
minWidth: 1200,
|
|
||||||
maxWidth: 1599
|
|
||||||
},
|
|
||||||
'screen-xxl': {
|
|
||||||
minWidth: 1600
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var getPaddingLeft = function getPaddingLeft(hasLeftPadding) {
|
|
||||||
var collapsed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
||||||
var collapsedWidth = arguments.length > 2 ? arguments[2] : undefined;
|
|
||||||
var siderWidth = arguments.length > 3 ? arguments[3] : undefined;
|
|
||||||
|
|
||||||
if (hasLeftPadding) {
|
|
||||||
return collapsed ? collapsedWidth ? collapsedWidth : 80 : siderWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
var headerRender = function headerRender(h, props) {
|
|
||||||
if (props.headerRender === false) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return h(HeaderView, {
|
|
||||||
props: props
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var defaultI18nRender = function defaultI18nRender(key) {
|
|
||||||
return key;
|
|
||||||
};
|
|
||||||
|
|
||||||
var BasicLayout = {
|
|
||||||
name: 'BasicLayout',
|
|
||||||
functional: true,
|
|
||||||
props: BasicLayoutProps,
|
|
||||||
render: function render(h, content) {
|
|
||||||
var props = content.props,
|
|
||||||
children = content.children,
|
|
||||||
listeners = content.listeners;
|
|
||||||
var layout = props.layout,
|
|
||||||
isMobile = props.isMobile,
|
|
||||||
collapsed = props.collapsed,
|
|
||||||
collapsedWidth = props.collapsedWidth,
|
|
||||||
mediaQuery = props.mediaQuery,
|
|
||||||
handleMediaQuery = props.handleMediaQuery,
|
|
||||||
handleCollapse = props.handleCollapse,
|
|
||||||
siderWidth = props.siderWidth,
|
|
||||||
fixSiderbar = props.fixSiderbar,
|
|
||||||
_props$i18nRender = props.i18nRender,
|
|
||||||
i18nRender = _props$i18nRender === void 0 ? defaultI18nRender : _props$i18nRender;
|
|
||||||
var footerRender = getComponentFromProp(content, 'footerRender');
|
|
||||||
var rightContentRender = getComponentFromProp(content, 'rightContentRender');
|
|
||||||
var collapsedButtonRender = getComponentFromProp(content, 'collapsedButtonRender');
|
|
||||||
var menuHeaderRender = getComponentFromProp(content, 'menuHeaderRender');
|
|
||||||
var breadcrumbRender = getComponentFromProp(content, 'breadcrumbRender');
|
|
||||||
var headerContentRender = getComponentFromProp(content, 'headerContentRender');
|
|
||||||
var menuRender = getComponentFromProp(content, 'menuRender');
|
|
||||||
var isTopMenu = layout === 'topmenu';
|
|
||||||
var hasSiderMenu = !isTopMenu; // If it is a fix menu, calculate padding
|
|
||||||
// don't need padding in phone mode
|
|
||||||
|
|
||||||
var hasLeftPadding = fixSiderbar && !isTopMenu && !isMobile;
|
|
||||||
|
|
||||||
var cdProps = _objectSpread({}, props, {
|
|
||||||
hasSiderMenu: hasSiderMenu,
|
|
||||||
footerRender: footerRender,
|
|
||||||
menuHeaderRender: menuHeaderRender,
|
|
||||||
rightContentRender: rightContentRender,
|
|
||||||
collapsedButtonRender: collapsedButtonRender,
|
|
||||||
breadcrumbRender: breadcrumbRender,
|
|
||||||
headerContentRender: headerContentRender,
|
|
||||||
menuRender: menuRender
|
|
||||||
}, listeners);
|
|
||||||
|
|
||||||
return h(ConfigProvider, {
|
|
||||||
attrs: {
|
|
||||||
i18nRender: i18nRender,
|
|
||||||
contentWidth: props.contentWidth,
|
|
||||||
breadcrumbRender: breadcrumbRender
|
|
||||||
}
|
|
||||||
}, [h(ContainerQuery, {
|
|
||||||
attrs: {
|
|
||||||
query: MediaQueryEnum
|
|
||||||
},
|
|
||||||
on: {
|
|
||||||
"change": handleMediaQuery
|
|
||||||
}
|
|
||||||
}, [h(Layout, {
|
|
||||||
"class": _objectSpread({
|
|
||||||
'ant-pro-basicLayout': true,
|
|
||||||
'ant-pro-topmenu': isTopMenu
|
|
||||||
}, mediaQuery)
|
|
||||||
}, [h(SiderMenuWrapper, _mergeJSXProps([{
|
|
||||||
props: cdProps
|
|
||||||
}, {
|
|
||||||
attrs: {
|
|
||||||
collapsed: collapsed
|
|
||||||
},
|
|
||||||
on: {
|
|
||||||
"collapse": handleCollapse
|
|
||||||
}
|
|
||||||
}])), h(Layout, {
|
|
||||||
"class": [layout],
|
|
||||||
style: {
|
|
||||||
paddingLeft: hasSiderMenu ? "".concat(getPaddingLeft(!!hasLeftPadding, collapsed, collapsedWidth, siderWidth), "px") : undefined,
|
|
||||||
minHeight: '100vh'
|
|
||||||
}
|
|
||||||
}, [headerRender(h, _objectSpread({}, cdProps, {
|
|
||||||
mode: 'horizontal'
|
|
||||||
})), h(WrapContent, {
|
|
||||||
"class": "ant-pro-basicLayout-content",
|
|
||||||
attrs: {
|
|
||||||
contentWidth: props.contentWidth
|
|
||||||
}
|
|
||||||
}, [children]), footerRender !== false && h(Layout.Footer, [isFun(footerRender) && footerRender(h) || footerRender]) || null])])])]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
BasicLayout.install = function (Vue) {
|
|
||||||
Vue.component(PageHeaderWrapper.name, PageHeaderWrapper);
|
|
||||||
Vue.component('PageContainer', PageHeaderWrapper);
|
|
||||||
Vue.component('ProLayout', BasicLayout);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default BasicLayout;
|
|
101
node_modules/@ant-design-vue/pro-layout/es/BasicLayout.less
generated
vendored
101
node_modules/@ant-design-vue/pro-layout/es/BasicLayout.less
generated
vendored
@ -1,101 +0,0 @@
|
|||||||
@import "~ant-design-vue/es/style/themes/default";
|
|
||||||
|
|
||||||
@basicLayout-prefix-cls: ~'@{ant-prefix}-pro-basicLayout';
|
|
||||||
@sider-menu-prefix-cls: ~'@{ant-prefix}-pro-sider-menu';
|
|
||||||
@nav-header-height: @layout-header-height;
|
|
||||||
|
|
||||||
.@{basicLayout-prefix-cls} {
|
|
||||||
|
|
||||||
&:not('.ant-pro-basicLayout-mobile') {
|
|
||||||
::-webkit-scrollbar {
|
|
||||||
width: 6px;
|
|
||||||
height: 6px;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar-track {
|
|
||||||
background: rgba(0, 0, 0, 0.06);
|
|
||||||
border-radius: 3px;
|
|
||||||
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.08);
|
|
||||||
}
|
|
||||||
/* 滚动条滑块 */
|
|
||||||
::-webkit-scrollbar-thumb {
|
|
||||||
background: rgba(0, 0, 0, 0.12);
|
|
||||||
border-radius: 3px;
|
|
||||||
-webkit-box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// BFC
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 100%;
|
|
||||||
|
|
||||||
.ant-layout-header {
|
|
||||||
&:not(.ant-pro-top-menu) {
|
|
||||||
background: @component-background;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.ant-pro-fixed-header {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-content {
|
|
||||||
position: relative;
|
|
||||||
margin: 24px;
|
|
||||||
transition: all 0.2s;
|
|
||||||
.@{ant-prefix}-pro-page-header-wrap {
|
|
||||||
margin: -24px -24px 0;
|
|
||||||
}
|
|
||||||
&-disable-margin {
|
|
||||||
margin: 0;
|
|
||||||
> div > .@{ant-prefix}-pro-page-header-wrap {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
> .ant-layout {
|
|
||||||
max-height: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// append hook styles
|
|
||||||
|
|
||||||
.ant-layout-sider-children {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.trigger {
|
|
||||||
font-size: 18px;
|
|
||||||
line-height: 64px;
|
|
||||||
padding: 0 24px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: color 0.3s;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #1890ff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-content {
|
|
||||||
position: relative;
|
|
||||||
margin: 24px;
|
|
||||||
transition: all 0.2s;
|
|
||||||
.@{ant-prefix}-pro-page-header-wrap {
|
|
||||||
margin: -24px -24px 0;
|
|
||||||
}
|
|
||||||
&-disable-margin {
|
|
||||||
margin: 0;
|
|
||||||
> div > .@{ant-prefix}-pro-page-header-wrap {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
> .ant-layout {
|
|
||||||
max-height: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-picker {
|
|
||||||
margin: 10px 0;
|
|
||||||
}
|
|
||||||
}
|
|
8
node_modules/@ant-design-vue/pro-layout/es/BlockLayout.js
generated
vendored
8
node_modules/@ant-design-vue/pro-layout/es/BlockLayout.js
generated
vendored
@ -1,8 +0,0 @@
|
|||||||
var BlockLayout = {
|
|
||||||
name: 'BlockLayout',
|
|
||||||
functional: true,
|
|
||||||
render: function render(createElement, content) {
|
|
||||||
return content.children;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export default BlockLayout;
|
|
118
node_modules/@ant-design-vue/pro-layout/es/Header.js
generated
vendored
118
node_modules/@ant-design-vue/pro-layout/es/Header.js
generated
vendored
@ -1,118 +0,0 @@
|
|||||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
|
||||||
|
|
||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
||||||
|
|
||||||
import './Header.less';
|
|
||||||
import 'ant-design-vue/es/layout/style';
|
|
||||||
import Layout from 'ant-design-vue/es/layout';
|
|
||||||
import PropTypes from 'ant-design-vue/es/_util/vue-types';
|
|
||||||
import BaseMenu from './components/RouteMenu/BaseMenu';
|
|
||||||
import { defaultRenderLogoAntTitle, SiderMenuProps } from './components/SiderMenu/SiderMenu';
|
|
||||||
import GlobalHeader, { GlobalHeaderProps } from './components/GlobalHeader';
|
|
||||||
import { VueFragment } from './components';
|
|
||||||
import { isFun } from './utils/util';
|
|
||||||
var Header = Layout.Header;
|
|
||||||
export var HeaderViewProps = _objectSpread({}, GlobalHeaderProps, SiderMenuProps, {
|
|
||||||
isMobile: PropTypes.bool.def(false),
|
|
||||||
collapsed: PropTypes.bool,
|
|
||||||
logo: PropTypes.any,
|
|
||||||
hasSiderMenu: PropTypes.bool,
|
|
||||||
autoHideHeader: PropTypes.bool,
|
|
||||||
menuRender: PropTypes.any,
|
|
||||||
headerRender: PropTypes.any,
|
|
||||||
rightContentRender: PropTypes.any,
|
|
||||||
visible: PropTypes.bool.def(true)
|
|
||||||
});
|
|
||||||
|
|
||||||
var renderContent = function renderContent(h, props) {
|
|
||||||
var isTop = props.layout === 'topmenu';
|
|
||||||
var maxWidth = 1200 - 280 - 120;
|
|
||||||
var contentWidth = props.contentWidth === 'Fixed';
|
|
||||||
var baseCls = 'ant-pro-top-nav-header';
|
|
||||||
var logo = props.logo,
|
|
||||||
title = props.title,
|
|
||||||
theme = props.theme,
|
|
||||||
isMobile = props.isMobile,
|
|
||||||
headerRender = props.headerRender,
|
|
||||||
rightContentRender = props.rightContentRender,
|
|
||||||
menuRender = props.menuRender,
|
|
||||||
menuHeaderRender = props.menuHeaderRender;
|
|
||||||
var rightContentProps = {
|
|
||||||
theme: theme,
|
|
||||||
isTop: isTop,
|
|
||||||
isMobile: isMobile
|
|
||||||
};
|
|
||||||
var defaultDom = h(GlobalHeader, {
|
|
||||||
props: props
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isTop && !isMobile) {
|
|
||||||
defaultDom = h("div", {
|
|
||||||
"class": [baseCls, theme]
|
|
||||||
}, [h("div", {
|
|
||||||
"class": ["".concat(baseCls, "-main"), contentWidth ? 'wide' : '']
|
|
||||||
}, [menuHeaderRender && h("div", {
|
|
||||||
"class": "".concat(baseCls, "-left")
|
|
||||||
}, [h("div", {
|
|
||||||
"class": "".concat(baseCls, "-logo"),
|
|
||||||
key: "logo",
|
|
||||||
attrs: {
|
|
||||||
id: "logo"
|
|
||||||
}
|
|
||||||
}, [defaultRenderLogoAntTitle(h, {
|
|
||||||
logo: logo,
|
|
||||||
title: title,
|
|
||||||
menuHeaderRender: menuHeaderRender
|
|
||||||
})])]), h("div", {
|
|
||||||
"class": "".concat(baseCls, "-menu"),
|
|
||||||
style: {
|
|
||||||
maxWidth: "".concat(maxWidth, "px"),
|
|
||||||
flex: 1
|
|
||||||
}
|
|
||||||
}, [menuRender && (isFun(menuRender) && menuRender(h, props) || menuRender) || h(BaseMenu, {
|
|
||||||
props: props
|
|
||||||
})]), isFun(rightContentRender) && rightContentRender(h, rightContentProps) || rightContentRender])]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (headerRender) {
|
|
||||||
return headerRender(h, props);
|
|
||||||
}
|
|
||||||
|
|
||||||
return defaultDom;
|
|
||||||
};
|
|
||||||
|
|
||||||
var HeaderView = {
|
|
||||||
name: 'HeaderView',
|
|
||||||
props: HeaderViewProps,
|
|
||||||
render: function render(h) {
|
|
||||||
var _this$$props = this.$props,
|
|
||||||
visible = _this$$props.visible,
|
|
||||||
isMobile = _this$$props.isMobile,
|
|
||||||
layout = _this$$props.layout,
|
|
||||||
collapsed = _this$$props.collapsed,
|
|
||||||
collapsedWidth = _this$$props.collapsedWidth,
|
|
||||||
siderWidth = _this$$props.siderWidth,
|
|
||||||
fixedHeader = _this$$props.fixedHeader,
|
|
||||||
autoHideHeader = _this$$props.autoHideHeader,
|
|
||||||
hasSiderMenu = _this$$props.hasSiderMenu;
|
|
||||||
var props = this.$props;
|
|
||||||
var isTop = layout === 'topmenu';
|
|
||||||
var needSettingWidth = fixedHeader && hasSiderMenu && !isTop && !isMobile;
|
|
||||||
var className = {
|
|
||||||
'ant-pro-fixed-header': fixedHeader,
|
|
||||||
'ant-pro-top-menu': isTop
|
|
||||||
};
|
|
||||||
var calcWidth = collapsed ? collapsedWidth ? collapsedWidth : 80 : siderWidth; // 没有 <></> 暂时代替写法
|
|
||||||
|
|
||||||
return visible ? h(VueFragment, [fixedHeader && h(Header), h(Header, {
|
|
||||||
style: {
|
|
||||||
padding: 0,
|
|
||||||
width: needSettingWidth ? "calc(100% - ".concat(calcWidth, "px)") : '100%',
|
|
||||||
zIndex: 9,
|
|
||||||
right: fixedHeader ? 0 : undefined
|
|
||||||
},
|
|
||||||
"class": className
|
|
||||||
}, [renderContent(h, props)])]) : null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export default HeaderView;
|
|
91
node_modules/@ant-design-vue/pro-layout/es/Header.less
generated
vendored
91
node_modules/@ant-design-vue/pro-layout/es/Header.less
generated
vendored
@ -1,91 +0,0 @@
|
|||||||
@import "~ant-design-vue/es/style/themes/default";
|
|
||||||
|
|
||||||
@top-nav-header-prefix-cls: ~'@{ant-prefix}-pro-top-nav-header';
|
|
||||||
@pro-layout-fixed-header-prefix-cls: ~'@{ant-prefix}-pro-fixed-header';
|
|
||||||
|
|
||||||
.@{top-nav-header-prefix-cls} {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
height: @layout-header-height;
|
|
||||||
box-shadow: @box-shadow-base;
|
|
||||||
transition: background 0.3s, width 0.2s;
|
|
||||||
.ant-menu-submenu.ant-menu-submenu-horizontal {
|
|
||||||
height: 100%;
|
|
||||||
line-height: @layout-header-height;
|
|
||||||
.ant-menu-submenu-title {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.light {
|
|
||||||
background-color: @component-background;
|
|
||||||
h1 {
|
|
||||||
color: #002140;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-main {
|
|
||||||
display: flex;
|
|
||||||
height: @layout-header-height;
|
|
||||||
padding-left: 24px;
|
|
||||||
&.wide {
|
|
||||||
max-width: 1200px;
|
|
||||||
margin: auto;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
.left {
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
width: 324px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-logo {
|
|
||||||
position: relative;
|
|
||||||
width: 165px;
|
|
||||||
height: @layout-header-height;
|
|
||||||
overflow: hidden;
|
|
||||||
line-height: @layout-header-height;
|
|
||||||
transition: all 0.3s;
|
|
||||||
img, svg {
|
|
||||||
display: inline-block;
|
|
||||||
height: 32px;
|
|
||||||
width: 32px;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
display: inline-block;
|
|
||||||
margin: 0 0 0 12px;
|
|
||||||
color: @btn-primary-color;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 16px;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-menu {
|
|
||||||
.ant-menu.ant-menu-horizontal {
|
|
||||||
height: @layout-header-height;
|
|
||||||
line-height: @layout-header-height;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.@{pro-layout-fixed-header-prefix-cls} {
|
|
||||||
z-index: 9;
|
|
||||||
width: 100%;
|
|
||||||
transition: width 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drop-down {
|
|
||||||
&.menu {
|
|
||||||
.anticon {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
.ant-dropdown-menu-item {
|
|
||||||
min-width: 160px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
9
node_modules/@ant-design-vue/pro-layout/es/PageView.js
generated
vendored
9
node_modules/@ant-design-vue/pro-layout/es/PageView.js
generated
vendored
@ -1,9 +0,0 @@
|
|||||||
import { PageHeaderWrapper } from './components';
|
|
||||||
var PageView = {
|
|
||||||
name: 'PageView',
|
|
||||||
render: function render() {
|
|
||||||
var h = arguments[0];
|
|
||||||
return h(PageHeaderWrapper, [h("router-view")]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export default PageView;
|
|
39
node_modules/@ant-design-vue/pro-layout/es/WrapContent.js
generated
vendored
39
node_modules/@ant-design-vue/pro-layout/es/WrapContent.js
generated
vendored
@ -1,39 +0,0 @@
|
|||||||
import PropTypes from 'ant-design-vue/es/_util/vue-types';
|
|
||||||
import 'ant-design-vue/es/layout/style';
|
|
||||||
import Layout from 'ant-design-vue/es/layout';
|
|
||||||
import ConfigProvider from 'ant-design-vue/es/config-provider';
|
|
||||||
import GridContent from './components/GridContent';
|
|
||||||
var Content = Layout.Content;
|
|
||||||
var WrapContentProps = {
|
|
||||||
isChildrenLayout: PropTypes.bool,
|
|
||||||
location: PropTypes.any,
|
|
||||||
contentHeight: PropTypes.number,
|
|
||||||
contentWidth: PropTypes.oneOf(['Fluid', 'Fixed']).def('Fluid')
|
|
||||||
};
|
|
||||||
var WrapContent = {
|
|
||||||
name: 'WrapContent',
|
|
||||||
props: WrapContentProps,
|
|
||||||
render: function render(h) {
|
|
||||||
var _this$$props = this.$props,
|
|
||||||
isChildrenLayout = _this$$props.isChildrenLayout,
|
|
||||||
contentWidth = _this$$props.contentWidth;
|
|
||||||
return h(Content, [h(ConfigProvider, {
|
|
||||||
attrs: {
|
|
||||||
getPopupContainer: function getPopupContainer(el, dialogContext) {
|
|
||||||
if (isChildrenLayout) {
|
|
||||||
return el.parentNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
return document.body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [h("div", {
|
|
||||||
"class": "ant-pro-basicLayout-children-content-wrap"
|
|
||||||
}, [h(GridContent, {
|
|
||||||
attrs: {
|
|
||||||
contentWidth: contentWidth
|
|
||||||
}
|
|
||||||
}, [this.$slots["default"]])])])]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export default WrapContent;
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user