mirror of
https://github.com/standardnotes/server
synced 2026-01-21 08:04:27 -05:00
Compare commits
76 Commits
@standardn
...
@standardn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f4776b52b | ||
|
|
d20f03127a | ||
|
|
4b6c7774e0 | ||
|
|
d02bca8879 | ||
|
|
5e654ccf94 | ||
|
|
7d3e5c22fb | ||
|
|
23eb61ee5f | ||
|
|
2cded4b2d1 | ||
|
|
ba7662fc1e | ||
|
|
832a48ac76 | ||
|
|
2db0c125fe | ||
|
|
20d9624bc6 | ||
|
|
f20ee68f50 | ||
|
|
cbf45ce3eb | ||
|
|
2e7fdd93dd | ||
|
|
8ce38f82b5 | ||
|
|
ec5429eeec | ||
|
|
4b17c4045d | ||
|
|
aaf42e4693 | ||
|
|
0e3cbfc40b | ||
|
|
a95ca05c10 | ||
|
|
56b600dbdc | ||
|
|
80a013d0a3 | ||
|
|
7ef59bb74c | ||
|
|
9cf1a9e25c | ||
|
|
0fce6c0cd4 | ||
|
|
2d444e9aa0 | ||
|
|
7c393b1125 | ||
|
|
78ab4dc94d | ||
|
|
6a5904cfaa | ||
|
|
a6061ec2a9 | ||
|
|
51c777304b | ||
|
|
fbd535f2c5 | ||
|
|
7d456671c2 | ||
|
|
dd4924c925 | ||
|
|
f73129cd7e | ||
|
|
4983c8741e | ||
|
|
c5798640ff | ||
|
|
5803a8018a | ||
|
|
e2aae8ac8a | ||
|
|
2917aeeb32 | ||
|
|
9377c03c3f | ||
|
|
9b926fbad6 | ||
|
|
8db19c3e2b | ||
|
|
ca970781c7 | ||
|
|
e7beee2788 | ||
|
|
d266eada88 | ||
|
|
11b8b078b4 | ||
|
|
37912fa29a | ||
|
|
b97dafe6f3 | ||
|
|
2a29151395 | ||
|
|
8b988d89c0 | ||
|
|
c0908f1b58 | ||
|
|
bb46044f7c | ||
|
|
60b3dd6138 | ||
|
|
22c1f936c3 | ||
|
|
e899874b04 | ||
|
|
04c6888cf6 | ||
|
|
29c56c6919 | ||
|
|
c98ed9cc85 | ||
|
|
88f7530c13 | ||
|
|
bb820437af | ||
|
|
d1a4bd38e0 | ||
|
|
d18f6ccd32 | ||
|
|
aa317c964e | ||
|
|
7ae8845ae9 | ||
|
|
123a6dbe0c | ||
|
|
dda8d79526 | ||
|
|
de5293955a | ||
|
|
96669bff5b | ||
|
|
a99762f004 | ||
|
|
1fc3c9b83e | ||
|
|
af86b6f664 | ||
|
|
a0208dd5b3 | ||
|
|
1c5c8b81d5 | ||
|
|
79c3e33434 |
9
.github/workflows/analytics.yml
vendored
9
.github/workflows/analytics.yml
vendored
@@ -11,19 +11,18 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call_server_application_workflow:
|
||||
name: Server Application
|
||||
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
|
||||
call_server_utility_workflow:
|
||||
name: Server Utility
|
||||
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main
|
||||
with:
|
||||
service_name: analytics
|
||||
workspace_name: "@standardnotes/analytics"
|
||||
e2e_tag_parameter_name: analytics_image_tag
|
||||
deploy_web: false
|
||||
package_path: packages/analytics
|
||||
secrets: inherit
|
||||
|
||||
newrelic:
|
||||
needs: call_server_application_workflow
|
||||
needs: call_server_utility_workflow
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
||||
164
.github/workflows/common-server-utility.yml
vendored
Normal file
164
.github/workflows/common-server-utility.yml
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
name: Reusable Server Utility Workflow
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
service_name:
|
||||
required: true
|
||||
type: string
|
||||
workspace_name:
|
||||
required: true
|
||||
type: string
|
||||
deploy_web:
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
deploy_worker:
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
package_path:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
DOCKER_USERNAME:
|
||||
required: true
|
||||
DOCKER_PASSWORD:
|
||||
required: true
|
||||
CI_PAT_TOKEN:
|
||||
required: true
|
||||
AWS_ACCESS_KEY_ID:
|
||||
required: true
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
temp_dir: ${{ steps.bundle-dir.outputs.temp_dir }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Create Bundle Dir
|
||||
id: bundle-dir
|
||||
run: echo "temp_dir=$(mktemp -d -t ${{ inputs.service_name }}-${{ github.sha }}-XXXXXXX)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache build
|
||||
id: cache-build
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
packages/**/dist
|
||||
${{ steps.bundle-dir.outputs.temp_dir }}
|
||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
node-version-file: '.nvmrc'
|
||||
|
||||
- name: Build
|
||||
run: yarn build ${{ inputs.package_path }}
|
||||
|
||||
- name: Bundle
|
||||
run: yarn workspace ${{ inputs.workspace_name }} bundle --no-compress --output-directory ${{ steps.bundle-dir.outputs.temp_dir }}
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache build
|
||||
id: cache-build
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
packages/**/dist
|
||||
${{ needs.build.outputs.temp_dir }}
|
||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
node-version-file: '.nvmrc'
|
||||
|
||||
- name: Build
|
||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
||||
run: yarn build ${{ inputs.package_path }}
|
||||
|
||||
- name: Lint
|
||||
run: yarn lint:${{ inputs.service_name }}
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs: build
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache build
|
||||
id: cache-build
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
packages/**/dist
|
||||
${{ needs.build.outputs.temp_dir }}
|
||||
key: ${{ runner.os }}-${{ inputs.service_name }}-build-${{ github.sha }}
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
node-version-file: '.nvmrc'
|
||||
|
||||
- name: Build
|
||||
if: steps.cache-build.outputs.cache-hit != 'true'
|
||||
run: yarn build ${{ inputs.package_path }}
|
||||
|
||||
- name: Test
|
||||
run: yarn test ${{ inputs.package_path }}
|
||||
|
||||
publish:
|
||||
needs: [ build, test, lint ]
|
||||
|
||||
name: Publish Docker Image
|
||||
uses: standardnotes/server/.github/workflows/common-docker-image.yml@main
|
||||
with:
|
||||
service_name: ${{ inputs.service_name }}
|
||||
bundle_dir: ${{ needs.build.outputs.temp_dir }}
|
||||
package_path: ${{ inputs.package_path }}
|
||||
workspace_name: ${{ inputs.workspace_name }}
|
||||
secrets: inherit
|
||||
|
||||
deploy-web:
|
||||
if: ${{ inputs.deploy_web }}
|
||||
|
||||
needs: publish
|
||||
|
||||
name: Deploy Web
|
||||
uses: standardnotes/server/.github/workflows/common-deploy.yml@main
|
||||
with:
|
||||
service_name: ${{ inputs.service_name }}
|
||||
docker_image: ${{ inputs.service_name }}:${{ github.sha }}
|
||||
secrets: inherit
|
||||
|
||||
deploy-worker:
|
||||
if: ${{ inputs.deploy_worker }}
|
||||
|
||||
needs: publish
|
||||
|
||||
name: Deploy Worker
|
||||
uses: standardnotes/server/.github/workflows/common-deploy.yml@main
|
||||
with:
|
||||
service_name: ${{ inputs.service_name }}-worker
|
||||
docker_image: ${{ inputs.service_name }}:${{ github.sha }}
|
||||
secrets: inherit
|
||||
9
.github/workflows/event-store.yml
vendored
9
.github/workflows/event-store.yml
vendored
@@ -11,19 +11,18 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call_server_application_workflow:
|
||||
name: Server Application
|
||||
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
|
||||
call_server_utility_workflow:
|
||||
name: Server Utility
|
||||
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main
|
||||
with:
|
||||
service_name: event-store
|
||||
workspace_name: "@standardnotes/event-store"
|
||||
e2e_tag_parameter_name: event_store_image_tag
|
||||
deploy_web: false
|
||||
package_path: packages/event-store
|
||||
secrets: inherit
|
||||
|
||||
newrelic:
|
||||
needs: call_server_application_workflow
|
||||
needs: call_server_utility_workflow
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
||||
9
.github/workflows/scheduler.yml
vendored
9
.github/workflows/scheduler.yml
vendored
@@ -11,19 +11,18 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call_server_application_workflow:
|
||||
name: Server Application
|
||||
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
|
||||
call_server_utility_workflow:
|
||||
name: Server Utility
|
||||
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main
|
||||
with:
|
||||
service_name: scheduler
|
||||
workspace_name: "@standardnotes/scheduler-server"
|
||||
e2e_tag_parameter_name: scheduler_image_tag
|
||||
deploy_web: false
|
||||
package_path: packages/scheduler
|
||||
secrets: inherit
|
||||
|
||||
newrelic:
|
||||
needs: call_server_application_workflow
|
||||
needs: call_server_utility_workflow
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
||||
9
.github/workflows/websockets.yml
vendored
9
.github/workflows/websockets.yml
vendored
@@ -11,18 +11,17 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call_server_application_workflow:
|
||||
name: Server Application
|
||||
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
|
||||
call_server_utility_workflow:
|
||||
name: Server Utility
|
||||
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main
|
||||
with:
|
||||
service_name: websockets
|
||||
workspace_name: "@standardnotes/websockets-server"
|
||||
e2e_tag_parameter_name: websockets_image_tag
|
||||
package_path: packages/websockets
|
||||
secrets: inherit
|
||||
|
||||
newrelic:
|
||||
needs: call_server_application_workflow
|
||||
needs: call_server_utility_workflow
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
9
.github/workflows/workspace.yml
vendored
9
.github/workflows/workspace.yml
vendored
@@ -11,18 +11,17 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call_server_application_workflow:
|
||||
name: Server Application
|
||||
uses: standardnotes/server/.github/workflows/common-server-application.yml@main
|
||||
call_server_utility_workflow:
|
||||
name: Server Utility
|
||||
uses: standardnotes/server/.github/workflows/common-server-utility.yml@main
|
||||
with:
|
||||
service_name: workspace
|
||||
workspace_name: "@standardnotes/workspace-server"
|
||||
e2e_tag_parameter_name: workspace_image_tag
|
||||
package_path: packages/workspace
|
||||
secrets: inherit
|
||||
|
||||
newrelic:
|
||||
needs: call_server_application_workflow
|
||||
needs: call_server_utility_workflow
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
BIN
.yarn/cache/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7-228ed71b87.zip
vendored
Normal file
BIN
.yarn/cache/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7-228ed71b87.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@eslint-eslintrc-npm-1.4.1-007f670de2-4e469ed508.zip
vendored
Normal file
BIN
.yarn/cache/@eslint-eslintrc-npm-1.4.1-007f670de2-4e469ed508.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@grpc-grpc-js-npm-1.8.4-287c8bdac8-6367a2ee38.zip
vendored
Normal file
BIN
.yarn/cache/@grpc-grpc-js-npm-1.8.4-287c8bdac8-6367a2ee38.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@grpc-proto-loader-npm-0.7.4-43d91344a0-1f5d4211fe.zip
vendored
Normal file
BIN
.yarn/cache/@grpc-proto-loader-npm-0.7.4-43d91344a0-1f5d4211fe.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@humanwhocodes-config-array-npm-0.11.8-7955bfecc2-010892ba3c.zip
vendored
Normal file
BIN
.yarn/cache/@humanwhocodes-config-array-npm-0.11.8-7955bfecc2-010892ba3c.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@standardnotes-features-npm-1.58.1-a51ef65e8a-558e4506d8.zip
vendored
Normal file
BIN
.yarn/cache/@standardnotes-features-npm-1.58.1-a51ef65e8a-558e4506d8.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@types-jsonwebtoken-npm-9.0.1-5f660fdf38-44d3fccc6b.zip
vendored
Normal file
BIN
.yarn/cache/@types-jsonwebtoken-npm-9.0.1-5f660fdf38-44d3fccc6b.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@types-newrelic-npm-9.4.0-72a77bd5e6-adb12973e8.zip
vendored
Normal file
BIN
.yarn/cache/@types-newrelic-npm-9.4.0-72a77bd5e6-adb12973e8.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.48.2-4f86b96814-773d1b78d4.zip
vendored
Normal file
BIN
.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.48.2-4f86b96814-773d1b78d4.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@typescript-eslint-scope-manager-npm-5.48.2-9a72dae708-788edc410b.zip
vendored
Normal file
BIN
.yarn/cache/@typescript-eslint-scope-manager-npm-5.48.2-9a72dae708-788edc410b.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@typescript-eslint-types-npm-5.48.2-bdebd4d2d7-8842362cca.zip
vendored
Normal file
BIN
.yarn/cache/@typescript-eslint-types-npm-5.48.2-bdebd4d2d7-8842362cca.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@typescript-eslint-typescript-estree-npm-5.48.2-2166870a0a-6d3da2b252.zip
vendored
Normal file
BIN
.yarn/cache/@typescript-eslint-typescript-estree-npm-5.48.2-2166870a0a-6d3da2b252.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@typescript-eslint-utils-npm-5.48.2-0126c67a53-f2f51f1bf6.zip
vendored
Normal file
BIN
.yarn/cache/@typescript-eslint-utils-npm-5.48.2-0126c67a53-f2f51f1bf6.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@typescript-eslint-visitor-keys-npm-5.48.2-b644f53ee6-7a4ea8035b.zip
vendored
Normal file
BIN
.yarn/cache/@typescript-eslint-visitor-keys-npm-5.48.2-b644f53ee6-7a4ea8035b.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/express-robots-txt-npm-1.0.0-dcc8bd8f0a-54f066f6c3.zip
vendored
Normal file
BIN
.yarn/cache/express-robots-txt-npm-1.0.0-dcc8bd8f0a-54f066f6c3.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/globals-npm-13.19.0-a63c75a2dd-3f3d6606b7.zip
vendored
Normal file
BIN
.yarn/cache/globals-npm-13.19.0-a63c75a2dd-3f3d6606b7.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/jsonwebtoken-npm-9.0.0-36fd1594c0-7ccbd0b7bf.zip
vendored
Normal file
BIN
.yarn/cache/jsonwebtoken-npm-9.0.0-36fd1594c0-7ccbd0b7bf.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/long-npm-5.2.1-3a12730171-f81b18ff29.zip
vendored
Normal file
BIN
.yarn/cache/long-npm-5.2.1-3a12730171-f81b18ff29.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/lru-cache-npm-7.14.1-d3ba9407b6-e4c8c073d9.zip
vendored
Normal file
BIN
.yarn/cache/lru-cache-npm-7.14.1-d3ba9407b6-e4c8c073d9.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/mysql2-npm-3.0.1-ceda50bb4d-6bbee1ee05.zip
vendored
Normal file
BIN
.yarn/cache/mysql2-npm-3.0.1-ceda50bb4d-6bbee1ee05.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/named-placeholders-npm-1.1.3-1b385febe5-1cd77eb10c.zip
vendored
Normal file
BIN
.yarn/cache/named-placeholders-npm-1.1.3-1b385febe5-1cd77eb10c.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/natural-compare-lite-npm-1.4.0-12b6b308ed-e554405686.zip
vendored
Normal file
BIN
.yarn/cache/natural-compare-lite-npm-1.4.0-12b6b308ed-e554405686.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/newrelic-npm-9.8.0-4c49b89cbc-ed3b893298.zip
vendored
Normal file
BIN
.yarn/cache/newrelic-npm-9.8.0-4c49b89cbc-ed3b893298.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/protobufjs-npm-7.1.2-2e50888192-d9cfc7c168.zip
vendored
Normal file
BIN
.yarn/cache/protobufjs-npm-7.1.2-2e50888192-d9cfc7c168.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/semver-npm-7.3.8-25a996cb4f-94ad80ee14.zip
vendored
Normal file
BIN
.yarn/cache/semver-npm-7.3.8-25a996cb4f-94ad80ee14.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
18
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/LICENSE
generated
vendored
Normal file
18
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
Copyright 2022 Contrast Security, Inc
|
||||
|
||||
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.
|
||||
43
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/README.md
generated
vendored
Normal file
43
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/README.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# @contrast/fn-inspect
|
||||
|
||||
[](https://github.com/Contrast-Security-Inc/node-fn-inspect/actions/workflows/test.yml)
|
||||
|
||||
This module exposes some useful information from the underlying v8 engine,
|
||||
including:
|
||||
|
||||
- file and line number given a function reference
|
||||
- code events (i.e. `'LAZY_COMPILE'`)
|
||||
|
||||
## Usage
|
||||
|
||||
Getting details about a function:
|
||||
|
||||
```js
|
||||
const { funcInfo } = require('@contrast/fn-inspect');
|
||||
|
||||
function testFn() {}
|
||||
|
||||
const results = funcInfo(testFn);
|
||||
// => { lineNumber: 2, column: 15, file: 'example.js', method: 'testFn', type: 'Function' }
|
||||
```
|
||||
|
||||
Registering a listener for code events:
|
||||
|
||||
```js
|
||||
const { setCodeEventListener } = require('@contrast/fn-inspect');
|
||||
|
||||
setCodeEventListener((event) => {
|
||||
console.log(event);
|
||||
});
|
||||
```
|
||||
|
||||
## Building locally
|
||||
|
||||
`npm run build` will build the project for your current OS and architecture.
|
||||
|
||||
`npm run download` will pull the most recent build artifacts from GitHub.
|
||||
|
||||
## Publishing
|
||||
|
||||
Simply run `npm version` and `git push && git push --tags`. CI will take care of
|
||||
releasing on taggedcommits.
|
||||
36
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/binding.gyp
generated
vendored
Normal file
36
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/binding.gyp
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"variables" : {
|
||||
"openssl_fips": "",
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"target_name": "fninspect",
|
||||
"sources": [
|
||||
"src/addon.cc",
|
||||
"src/code-events.cc",
|
||||
"src/event-queue.cc",
|
||||
"src/func-info.cc"
|
||||
],
|
||||
"include_dirs": [
|
||||
"<!(node -e \"require('nan')\")"
|
||||
],
|
||||
"conditions": [
|
||||
[
|
||||
"OS == 'mac'",
|
||||
{
|
||||
"xcode_settings": {
|
||||
"OTHER_CFLAGS": [
|
||||
"-arch x86_64",
|
||||
"-arch arm64"
|
||||
],
|
||||
"OTHER_LDFLAGS": [
|
||||
"-arch x86_64",
|
||||
"-arch arm64"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
45
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/index.d.ts
generated
vendored
Normal file
45
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/* eslint-disable @typescript-eslint/ban-types */
|
||||
|
||||
declare interface FunctionInfo {
|
||||
file: string;
|
||||
column: number;
|
||||
lineNumber: number;
|
||||
method: string;
|
||||
type: 'AsyncFunction' | 'Function';
|
||||
}
|
||||
|
||||
declare interface CodeEvent {
|
||||
func: string;
|
||||
lineNumber: number;
|
||||
script: string;
|
||||
type:
|
||||
| 'Builtin'
|
||||
| 'Callback'
|
||||
| 'Eval'
|
||||
| 'Function'
|
||||
| 'InterpretedFunction'
|
||||
| 'Handler'
|
||||
| 'BytecodeHandler'
|
||||
| 'LazyCompile'
|
||||
| 'RegExp'
|
||||
| 'Script'
|
||||
| 'Stub'
|
||||
| 'Relocation'
|
||||
}
|
||||
|
||||
declare const fnInspect: {
|
||||
/** Retrieves name, type, column, lineNumber and file from a function reference */
|
||||
funcInfo(fn: Function): FunctionInfo | null;
|
||||
|
||||
/**
|
||||
* Sets the function for processing v8 code events.
|
||||
* Will start listening for code events if not already listening.
|
||||
* starts a timer which polls for an available code event once every `interval` ms.
|
||||
*/
|
||||
setCodeEventListener(cb: (event: CodeEvent) => void, interval?: number): void;
|
||||
|
||||
/** Stop listening for v8 code events */
|
||||
stopListening(): void;
|
||||
};
|
||||
|
||||
export = fnInspect;
|
||||
58
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/index.js
generated
vendored
Normal file
58
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/index.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
const binding = require('node-gyp-build')(__dirname);
|
||||
|
||||
let codeEventsInited = false;
|
||||
let codeEventListener = null;
|
||||
let timer = null;
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Retrieves name, type, column, lineNumber and file from a function reference
|
||||
*
|
||||
* @param {Function} fn function reference to obtain info
|
||||
* @return {FunctionInfo | null}
|
||||
*/
|
||||
funcInfo(fn) {
|
||||
const info = binding.funcInfo(fn);
|
||||
if (info === null) return null;
|
||||
|
||||
info.type = fn.constructor.name;
|
||||
return info;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the function for processing v8 code events.
|
||||
* Will start listening for code events if not already listening.
|
||||
* starts a timer which polls for an available code event once every `interval` value.
|
||||
*
|
||||
* @param {Function} cb callback function to call
|
||||
* @param {number} [interval=1] how often to get code events in ms
|
||||
*/
|
||||
setCodeEventListener(cb, interval = 1) {
|
||||
if (codeEventsInited) {
|
||||
codeEventListener = cb;
|
||||
return;
|
||||
}
|
||||
|
||||
binding.initHandler();
|
||||
codeEventsInited = true;
|
||||
codeEventListener = cb;
|
||||
timer = setInterval(() => {
|
||||
const codeEvent = binding.getNextCodeEvent();
|
||||
if (codeEvent) codeEventListener(codeEvent);
|
||||
}, interval);
|
||||
},
|
||||
|
||||
/**
|
||||
* Stop listening for v8 code events
|
||||
*/
|
||||
stopListening() {
|
||||
if (!codeEventsInited) return;
|
||||
|
||||
clearInterval(timer);
|
||||
binding.deinitHandler();
|
||||
codeEventListener = null;
|
||||
codeEventsInited = false;
|
||||
},
|
||||
};
|
||||
63
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/package.json
generated
vendored
Normal file
63
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "@contrast/fn-inspect",
|
||||
"version": "3.3.0",
|
||||
"description": "Retrieve function name and line number from a function reference",
|
||||
"keywords": [
|
||||
"instrumentation"
|
||||
],
|
||||
"author": "Contrast Security",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Contrast-Security-Inc/node-fn-inspect.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Contrast-Security-Inc/node-fn-inspect/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Contrast-Security-Inc/node-fn-inspect#readme",
|
||||
"files": [
|
||||
"prebuilds/",
|
||||
"src/",
|
||||
"binding.gyp",
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"install": "node-gyp-build",
|
||||
"prepare": "husky install",
|
||||
"build": "prebuildify -t 12.13.0 -t 14.15.0 -t 16.9.1 -t 18.7.0 --strip",
|
||||
"build:linux": "prebuildify-cross -i centos7-devtoolset7 -i alpine -i linux-arm64 -t 12.13.0 -t 14.15.0 -t 16.9.1 -t 18.7.0 --strip",
|
||||
"build:darwin": "npm run build -- --arch x64+arm64",
|
||||
"build:win32": "npm run build",
|
||||
"clean": "rimraf build/ coverage/ prebuilds/",
|
||||
"download": "node scripts/download-artifacts.js",
|
||||
"test": "c8 --reporter lcov --reporter text mocha .",
|
||||
"test:valgrind": "valgrind --xml=yes --xml-file=./valgrind.xml --trace-children=yes --leak-check=full --show-leak-kinds=all mocha . && node scripts/parse-valgrind.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.13.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"nan": "^2.16.0",
|
||||
"node-gyp-build": "^4.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@contrast/eslint-config": "^3.1.1",
|
||||
"@ls-lint/ls-lint": "^1.11.2",
|
||||
"@octokit/rest": "^18.12.0",
|
||||
"c8": "^7.11.3",
|
||||
"chai": "^4.3.6",
|
||||
"husky": "^8.0.1",
|
||||
"inquirer": "^8.2.4",
|
||||
"lint-staged": "^13.0.1",
|
||||
"mocha": "^10.0.0",
|
||||
"node-gyp": "^9.0.0",
|
||||
"prebuildify": "^5.0.0",
|
||||
"prebuildify-cross": "^5.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"unzipper": "^0.10.11",
|
||||
"xml-js": "^1.6.11"
|
||||
}
|
||||
}
|
||||
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/node.abi108.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/node.abi108.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/node.abi72.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/node.abi72.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/node.abi83.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/node.abi83.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/node.abi93.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/darwin-x64+arm64/node.abi93.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/node.abi108.armv8.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/node.abi108.armv8.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/node.abi72.armv8.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/node.abi72.armv8.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/node.abi83.armv8.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/node.abi83.armv8.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/node.abi93.armv8.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-arm64/node.abi93.armv8.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi108.glibc.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi108.glibc.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi108.musl.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi108.musl.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi72.glibc.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi72.glibc.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi72.musl.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi72.musl.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi83.glibc.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi83.glibc.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi83.musl.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi83.musl.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi93.glibc.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi93.glibc.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi93.musl.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/linux-x64/node.abi93.musl.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/node.abi108.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/node.abi108.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/node.abi72.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/node.abi72.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/node.abi83.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/node.abi83.node
generated
vendored
Normal file
Binary file not shown.
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/node.abi93.node
generated
vendored
Normal file
BIN
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/prebuilds/win32-x64/node.abi93.node
generated
vendored
Normal file
Binary file not shown.
14
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/addon.cc
generated
vendored
Normal file
14
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/addon.cc
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <nan.h>
|
||||
|
||||
#include "code-events.h"
|
||||
#include "func-info.h"
|
||||
|
||||
NAN_MODULE_INIT(Init) {
|
||||
NAN_EXPORT(target, initHandler);
|
||||
NAN_EXPORT(target, deinitHandler);
|
||||
NAN_EXPORT(target, getNextCodeEvent);
|
||||
|
||||
NAN_EXPORT(target, funcInfo);
|
||||
}
|
||||
|
||||
NODE_MODULE(addon, Init)
|
||||
75
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/code-events.cc
generated
vendored
Normal file
75
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/code-events.cc
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
#include "code-events.h"
|
||||
#include "event-queue.h"
|
||||
|
||||
using namespace v8;
|
||||
|
||||
class FnInspectCodeEventHandler : public CodeEventHandler {
|
||||
public:
|
||||
FnInspectCodeEventHandler(Isolate *isolate) : CodeEventHandler(isolate) {
|
||||
this->isolate = isolate;
|
||||
}
|
||||
|
||||
void Handle(CodeEvent *event) {
|
||||
/*
|
||||
* If Handle() is invoked from a worker thread (i.e. during
|
||||
* garbage collection) we don't have access to the isolate
|
||||
* so just bail
|
||||
*/
|
||||
if (Isolate::GetCurrent() != isolate) {
|
||||
return;
|
||||
}
|
||||
events.enqueue(event);
|
||||
}
|
||||
|
||||
EventNode *dequeue() {
|
||||
return this->events.dequeue();
|
||||
}
|
||||
|
||||
unsigned int eventCount() {
|
||||
return this->events.length;
|
||||
}
|
||||
|
||||
private:
|
||||
Isolate *isolate;
|
||||
EventQueue events;
|
||||
};
|
||||
|
||||
FnInspectCodeEventHandler *handler;
|
||||
|
||||
NAN_METHOD(initHandler) {
|
||||
handler = new FnInspectCodeEventHandler(info.GetIsolate());
|
||||
handler->Enable();
|
||||
}
|
||||
|
||||
NAN_METHOD(deinitHandler) {
|
||||
handler->Disable();
|
||||
|
||||
delete handler;
|
||||
handler = NULL;
|
||||
}
|
||||
|
||||
NAN_METHOD(getNextCodeEvent) {
|
||||
EventNode *node = handler->dequeue();
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
Local<Object> obj = Nan::New<Object>();
|
||||
|
||||
Nan::Set(obj,
|
||||
Nan::New("script").ToLocalChecked(),
|
||||
Nan::New(node->script).ToLocalChecked());
|
||||
Nan::Set(obj,
|
||||
Nan::New("func").ToLocalChecked(),
|
||||
Nan::New(node->func).ToLocalChecked());
|
||||
Nan::Set(obj,
|
||||
Nan::New("type").ToLocalChecked(),
|
||||
Nan::New(node->type).ToLocalChecked());
|
||||
Nan::Set(obj,
|
||||
Nan::New("lineNumber").ToLocalChecked(),
|
||||
Nan::New(node->lineNumber));
|
||||
|
||||
info.GetReturnValue().Set(obj);
|
||||
|
||||
delete node;
|
||||
}
|
||||
11
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/code-events.h
generated
vendored
Normal file
11
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/code-events.h
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <nan.h>
|
||||
#include <v8-profiler.h>
|
||||
#include <v8.h>
|
||||
|
||||
#include "event-queue.h"
|
||||
|
||||
NAN_METHOD(initHandler);
|
||||
NAN_METHOD(deinitHandler);
|
||||
NAN_METHOD(getNextCodeEvent);
|
||||
61
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/event-queue.cc
generated
vendored
Normal file
61
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/event-queue.cc
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
#include <v8-profiler.h>
|
||||
#include <v8.h>
|
||||
|
||||
#include "event-queue.h"
|
||||
|
||||
using namespace v8;
|
||||
|
||||
EventQueue::EventQueue() {
|
||||
this->head = NULL;
|
||||
this->tail = NULL;
|
||||
this->length = 0;
|
||||
}
|
||||
|
||||
EventQueue::~EventQueue() {
|
||||
EventNode *tmp;
|
||||
while (this->head) {
|
||||
tmp = this->head;
|
||||
;
|
||||
this->head = this->head->next;
|
||||
delete tmp;
|
||||
}
|
||||
}
|
||||
|
||||
void EventQueue::enqueue(CodeEvent *event) {
|
||||
if (Nan::Utf8String(event->GetScriptName()).length() == 0)
|
||||
return;
|
||||
|
||||
EventNode *node = new EventNode();
|
||||
|
||||
node->type = strdup(CodeEvent::GetCodeEventTypeName(event->GetCodeType()));
|
||||
node->script = strdup(*Nan::Utf8String(event->GetScriptName()));
|
||||
node->func = strdup(*Nan::Utf8String(event->GetFunctionName()));
|
||||
node->lineNumber = event->GetScriptLine();
|
||||
|
||||
if (this->tail) {
|
||||
this->tail->next = node;
|
||||
this->tail = node;
|
||||
} else {
|
||||
this->head = node;
|
||||
this->tail = node;
|
||||
}
|
||||
|
||||
this->length += 1;
|
||||
}
|
||||
|
||||
EventNode *EventQueue::dequeue() {
|
||||
EventNode *node = this->head;
|
||||
|
||||
if (!node)
|
||||
return NULL;
|
||||
|
||||
this->head = this->head->next;
|
||||
|
||||
if (this->head == NULL) {
|
||||
this->tail = NULL;
|
||||
}
|
||||
|
||||
this->length -= 1;
|
||||
|
||||
return node;
|
||||
}
|
||||
46
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/event-queue.h
generated
vendored
Normal file
46
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/event-queue.h
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include <nan.h>
|
||||
#include <v8-profiler.h>
|
||||
#include <v8.h>
|
||||
|
||||
using namespace v8;
|
||||
|
||||
class EventNode {
|
||||
public:
|
||||
char *type;
|
||||
char *script;
|
||||
char *func;
|
||||
int lineNumber;
|
||||
EventNode *next;
|
||||
~EventNode() {
|
||||
free(this->type);
|
||||
free(this->script);
|
||||
free(this->func);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Implements a simple queue of code events that can be
|
||||
* consumed.
|
||||
*
|
||||
* Thread-Safety: There's no locking on these methods so
|
||||
* they aren't thread safe. However this should be OK
|
||||
* as the expectation is these methods are only ever called
|
||||
* from the main JS thread and they are blocking, there will
|
||||
* only ever be a single thread calling it as a time. We
|
||||
* may want to revisit this if we ever want to support
|
||||
* handling events from worker_threads.
|
||||
*/
|
||||
class EventQueue {
|
||||
public:
|
||||
EventQueue();
|
||||
~EventQueue();
|
||||
void enqueue(CodeEvent *event);
|
||||
EventNode *dequeue();
|
||||
unsigned int length;
|
||||
|
||||
private:
|
||||
EventNode *head;
|
||||
EventNode *tail;
|
||||
};
|
||||
28
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/func-info.cc
generated
vendored
Normal file
28
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/func-info.cc
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "func-info.h"
|
||||
|
||||
using namespace v8;
|
||||
|
||||
NAN_METHOD(funcInfo) {
|
||||
if (info.Length() < 1 || info[0].IsEmpty() || !info[0]->IsFunction()) {
|
||||
info.GetReturnValue().Set(Nan::Null());
|
||||
return;
|
||||
}
|
||||
|
||||
Local<Function> fn = info[0].As<Function>();
|
||||
|
||||
Local<Object> obj = Nan::New<Object>();
|
||||
Local<Value> resourceName = fn->GetScriptOrigin().ResourceName();
|
||||
|
||||
if (!resourceName.IsEmpty()) {
|
||||
Nan::Set(obj, Nan::New("file").ToLocalChecked(), resourceName);
|
||||
Nan::Set(obj,
|
||||
Nan::New("lineNumber").ToLocalChecked(),
|
||||
Nan::New(fn->GetScriptLineNumber()));
|
||||
Nan::Set(obj, Nan::New("method").ToLocalChecked(), fn->GetName());
|
||||
Nan::Set(obj,
|
||||
Nan::New("column").ToLocalChecked(),
|
||||
Nan::New(fn->GetScriptColumnNumber()));
|
||||
}
|
||||
|
||||
info.GetReturnValue().Set(obj);
|
||||
}
|
||||
6
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/func-info.h
generated
vendored
Normal file
6
.yarn/unplugged/@contrast-fn-inspect-npm-3.3.0-c6a8faa5b7/node_modules/@contrast/fn-inspect/src/func-info.h
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <nan.h>
|
||||
#include <v8.h>
|
||||
|
||||
NAN_METHOD(funcInfo);
|
||||
1027
.yarn/unplugged/protobufjs-npm-6.11.3-566fb31188/node_modules/protobufjs/CHANGELOG.md
generated
vendored
1027
.yarn/unplugged/protobufjs-npm-6.11.3-566fb31188/node_modules/protobufjs/CHANGELOG.md
generated
vendored
File diff suppressed because it is too large
Load Diff
6
.yarn/unplugged/protobufjs-npm-6.11.3-566fb31188/node_modules/protobufjs/bin/pbjs
generated
vendored
6
.yarn/unplugged/protobufjs-npm-6.11.3-566fb31188/node_modules/protobufjs/bin/pbjs
generated
vendored
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
var path = require("path"),
|
||||
cli = require(path.join(__dirname, "..", "cli", "pbjs.js"));
|
||||
var ret = cli.main(process.argv.slice(2));
|
||||
if (typeof ret === 'number')
|
||||
process.exit(ret);
|
||||
6
.yarn/unplugged/protobufjs-npm-6.11.3-566fb31188/node_modules/protobufjs/bin/pbts
generated
vendored
6
.yarn/unplugged/protobufjs-npm-6.11.3-566fb31188/node_modules/protobufjs/bin/pbts
generated
vendored
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
var path = require("path"),
|
||||
cli = require(path.join(__dirname, "..", "cli", "pbts.js"));
|
||||
var ret = cli.main(process.argv.slice(2));
|
||||
if (typeof ret === 'number')
|
||||
process.exit(ret);
|
||||
33
.yarn/unplugged/protobufjs-npm-6.11.3-566fb31188/node_modules/protobufjs/cli/LICENSE
generated
vendored
33
.yarn/unplugged/protobufjs-npm-6.11.3-566fb31188/node_modules/protobufjs/cli/LICENSE
generated
vendored
@@ -1,33 +0,0 @@
|
||||
Copyright (c) 2016, Daniel Wirtz All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of its author, nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
---
|
||||
|
||||
Code generated by the command line utilities is owned by the owner
|
||||
of the input file used when generating it. This code is not
|
||||
standalone and requires a support library to be linked with it. This
|
||||
support library is itself covered by the above license.
|
||||
174
.yarn/unplugged/protobufjs-npm-6.11.3-566fb31188/node_modules/protobufjs/cli/README.md
generated
vendored
174
.yarn/unplugged/protobufjs-npm-6.11.3-566fb31188/node_modules/protobufjs/cli/README.md
generated
vendored
@@ -1,174 +0,0 @@
|
||||
protobufjs-cli
|
||||
==============
|
||||
[](https://www.npmjs.com/package/protobufjs-cli)
|
||||
|
||||
Command line interface (CLI) for [protobuf.js](https://github.com/dcodeIO/protobuf.js). Translates between file formats and generates static code as well as TypeScript definitions.
|
||||
|
||||
* [CLI Documentation](https://github.com/dcodeIO/protobuf.js#command-line)
|
||||
|
||||
**Note** that moving the CLI to its own package is a work in progress. At the moment, it's still part of the main package.
|
||||
* [pbjs for JavaScript](#pbjs-for-javascript)
|
||||
* [pbts for TypeScript](#pbts-for-typescript)
|
||||
* [Reflection vs. static code](#reflection-vs-static-code)
|
||||
* [Command line API](#command-line-api)<br />
|
||||
|
||||
### pbjs for JavaScript
|
||||
|
||||
```
|
||||
Translates between file formats and generates static code.
|
||||
|
||||
-t, --target Specifies the target format. Also accepts a path to require a custom target.
|
||||
|
||||
json JSON representation
|
||||
json-module JSON representation as a module
|
||||
proto2 Protocol Buffers, Version 2
|
||||
proto3 Protocol Buffers, Version 3
|
||||
static Static code without reflection (non-functional on its own)
|
||||
static-module Static code without reflection as a module
|
||||
|
||||
-p, --path Adds a directory to the include path.
|
||||
|
||||
-o, --out Saves to a file instead of writing to stdout.
|
||||
|
||||
--sparse Exports only those types referenced from a main file (experimental).
|
||||
|
||||
Module targets only:
|
||||
|
||||
-w, --wrap Specifies the wrapper to use. Also accepts a path to require a custom wrapper.
|
||||
|
||||
default Default wrapper supporting both CommonJS and AMD
|
||||
commonjs CommonJS wrapper
|
||||
amd AMD wrapper
|
||||
es6 ES6 wrapper (implies --es6)
|
||||
closure A closure adding to protobuf.roots where protobuf is a global
|
||||
|
||||
-r, --root Specifies an alternative protobuf.roots name.
|
||||
|
||||
-l, --lint Linter configuration. Defaults to protobuf.js-compatible rules:
|
||||
|
||||
eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins
|
||||
|
||||
--es6 Enables ES6 syntax (const/let instead of var)
|
||||
|
||||
Proto sources only:
|
||||
|
||||
--keep-case Keeps field casing instead of converting to camel case.
|
||||
|
||||
Static targets only:
|
||||
|
||||
--no-create Does not generate create functions used for reflection compatibility.
|
||||
--no-encode Does not generate encode functions.
|
||||
--no-decode Does not generate decode functions.
|
||||
--no-verify Does not generate verify functions.
|
||||
--no-convert Does not generate convert functions like from/toObject
|
||||
--no-delimited Does not generate delimited encode/decode functions.
|
||||
--no-beautify Does not beautify generated code.
|
||||
--no-comments Does not output any JSDoc comments.
|
||||
--no-service Does not output service classes.
|
||||
|
||||
--force-long Enforces the use of 'Long' for s-/u-/int64 and s-/fixed64 fields.
|
||||
--force-number Enforces the use of 'number' for s-/u-/int64 and s-/fixed64 fields.
|
||||
--force-message Enforces the use of message instances instead of plain objects.
|
||||
|
||||
usage: pbjs [options] file1.proto file2.json ... (or pipe) other | pbjs [options] -
|
||||
```
|
||||
|
||||
For production environments it is recommended to bundle all your .proto files to a single .json file, which minimizes the number of network requests and avoids any parser overhead (hint: works with just the **light** library):
|
||||
|
||||
```
|
||||
$> pbjs -t json file1.proto file2.proto > bundle.json
|
||||
```
|
||||
|
||||
Now, either include this file in your final bundle:
|
||||
|
||||
```js
|
||||
var root = protobuf.Root.fromJSON(require("./bundle.json"));
|
||||
```
|
||||
|
||||
or load it the usual way:
|
||||
|
||||
```js
|
||||
protobuf.load("bundle.json", function(err, root) {
|
||||
...
|
||||
});
|
||||
```
|
||||
|
||||
Generated static code, on the other hand, works with just the **minimal** library. For example
|
||||
|
||||
```
|
||||
$> pbjs -t static-module -w commonjs -o compiled.js file1.proto file2.proto
|
||||
```
|
||||
|
||||
will generate static code for definitions within `file1.proto` and `file2.proto` to a CommonJS module `compiled.js`.
|
||||
|
||||
**ProTip!** Documenting your .proto files with `/** ... */`-blocks or (trailing) `/// ...` lines translates to generated static code.
|
||||
|
||||
|
||||
### pbts for TypeScript
|
||||
|
||||
```
|
||||
Generates TypeScript definitions from annotated JavaScript files.
|
||||
|
||||
-o, --out Saves to a file instead of writing to stdout.
|
||||
|
||||
-g, --global Name of the global object in browser environments, if any.
|
||||
|
||||
--no-comments Does not output any JSDoc comments.
|
||||
|
||||
Internal flags:
|
||||
|
||||
-n, --name Wraps everything in a module of the specified name.
|
||||
|
||||
-m, --main Whether building the main library without any imports.
|
||||
|
||||
usage: pbts [options] file1.js file2.js ... (or) other | pbts [options] -
|
||||
```
|
||||
|
||||
Picking up on the example above, the following not only generates static code to a CommonJS module `compiled.js` but also its respective TypeScript definitions to `compiled.d.ts`:
|
||||
|
||||
```
|
||||
$> pbjs -t static-module -w commonjs -o compiled.js file1.proto file2.proto
|
||||
$> pbts -o compiled.d.ts compiled.js
|
||||
```
|
||||
|
||||
Additionally, TypeScript definitions of static modules are compatible with their reflection-based counterparts (i.e. as exported by JSON modules), as long as the following conditions are met:
|
||||
|
||||
1. Instead of using `new SomeMessage(...)`, always use `SomeMessage.create(...)` because reflection objects do not provide a constructor.
|
||||
2. Types, services and enums must start with an uppercase letter to become available as properties of the reflected types as well (i.e. to be able to use `MyMessage.MyEnum` instead of `root.lookup("MyMessage.MyEnum")`).
|
||||
|
||||
For example, the following generates a JSON module `bundle.js` and a `bundle.d.ts`, but no static code:
|
||||
|
||||
```
|
||||
$> pbjs -t json-module -w commonjs -o bundle.js file1.proto file2.proto
|
||||
$> pbjs -t static-module file1.proto file2.proto | pbts -o bundle.d.ts -
|
||||
```
|
||||
|
||||
### Reflection vs. static code
|
||||
|
||||
While using .proto files directly requires the full library respectively pure reflection/JSON the light library, pretty much all code but the relatively short descriptors is shared.
|
||||
|
||||
Static code, on the other hand, requires just the minimal library, but generates additional source code without any reflection features. This also implies that there is a break-even point where statically generated code becomes larger than descriptor-based code once the amount of code generated exceeds the size of the full respectively light library.
|
||||
|
||||
There is no significant difference performance-wise as the code generated statically is pretty much the same as generated at runtime and both are largely interchangeable as seen in the previous section.
|
||||
|
||||
| Source | Library | Advantages | Tradeoffs
|
||||
|--------|---------|------------|-----------
|
||||
| .proto | full | Easily editable<br />Interoperability with other libraries<br />No compile step | Some parsing and possibly network overhead
|
||||
| JSON | light | Easily editable<br />No parsing overhead<br />Single bundle (no network overhead) | protobuf.js specific<br />Has a compile step
|
||||
| static | minimal | Works where `eval` access is restricted<br />Fully documented<br />Small footprint for small protos | Can be hard to edit<br />No reflection<br />Has a compile step
|
||||
|
||||
### Command line API
|
||||
|
||||
Both utilities can be used programmatically by providing command line arguments and a callback to their respective `main` functions:
|
||||
|
||||
```js
|
||||
var pbjs = require("protobufjs-cli/pbjs"); // or require("protobufjs-cli").pbjs / .pbts
|
||||
|
||||
pbjs.main([ "--target", "json-module", "path/to/myproto.proto" ], function(err, output) {
|
||||
if (err)
|
||||
throw err;
|
||||
// do something with output
|
||||
});
|
||||
```
|
||||
|
||||
**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user