Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: New Deno runtime #665

Merged
merged 112 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
d1e2e99
Add Deno runtime
d-gubert Sep 8, 2023
cb7864f
Add new runtime class
d-gubert Sep 8, 2023
08a4233
wip
d-gubert Sep 21, 2023
d58a058
wip: migrated ast fixing algorithm
d-gubert Sep 21, 2023
11b8d1f
Sanitize AST lib
d-gubert Sep 30, 2023
2669abc
Fix reassignment recognition algorithm
d-gubert Oct 2, 2023
a7427e0
Add unit tests
d-gubert Oct 2, 2023
b733b5d
App instantiation with fake proxies
d-gubert Oct 6, 2023
56d73ba
Add Deno's linter
d-gubert Oct 9, 2023
d358a85
Small polish to initialization process
d-gubert Oct 10, 2023
4a4640f
Refactor before branching off
d-gubert Oct 10, 2023
9e41f0e
Improve runtime API and JSON RPC related functions (#669)
d-gubert Nov 1, 2023
8c28628
Adopt jsonrpc-lite package (#671)
d-gubert Nov 3, 2023
eb4a862
Create mocks to call accessors from Deno (#670)
d-gubert Nov 9, 2023
c10c691
Create the AppObjectRegistry (#673)
d-gubert Nov 10, 2023
419ae51
Change deps to AppManager parameter for runtime and controller
d-gubert Nov 27, 2023
8e2e905
Adapted config accessors (#675)
d-gubert Nov 28, 2023
f7e0eb1
Merge branch 'alpha' into feat/deno-runtime
d-gubert Nov 28, 2023
4110cc4
Add Deno tests to CI
d-gubert Dec 1, 2023
632c285
Fix job execution order in Github Actions
d-gubert Dec 1, 2023
092f19b
Modify Accessors (#680)
d-gubert Dec 5, 2023
b574afb
Add ModifyUpdater accessors (#681)
d-gubert Dec 5, 2023
1e36587
Add ModifyExtender accessors (#682)
d-gubert Dec 5, 2023
1e4839b
Create logger (#674)
tapiarafael Dec 14, 2023
6f9da6f
Refactor app initialization (#684)
d-gubert Dec 15, 2023
30d41d4
Refactor slashcommand execution to new Runtime API (#686)
d-gubert Dec 20, 2023
0d8d413
Refactor app construct handler (#687)
d-gubert Dec 21, 2023
213d6b1
Refactor app initialize method call (#688)
d-gubert Dec 21, 2023
4a6c7e5
Prevent proxies from sending toJSON calls via IPC (#689)
d-gubert Dec 22, 2023
0ed2fd6
Add handlers for App methods on Deno and refactor their usages on Nod…
d-gubert Dec 27, 2023
18cc8d2
Fix logger assignment to App instance on request handling
d-gubert Dec 27, 2023
4a7a913
Fix handleInitialize import
d-gubert Dec 27, 2023
f09427e
feat: videoconf handler (#691)
tapiarafael Dec 29, 2023
5375ea4
Refactor listener methods (#692)
d-gubert Jan 4, 2024
5a866c5
Add handlers for UIKit methods in Deno and refactor Manager usage (#693)
d-gubert Jan 5, 2024
e49d340
feat: add api handler (#694)
tapiarafael Jan 6, 2024
d9020f9
Refactor `IApp.getStatus` implementation and usages (#698)
d-gubert Jan 8, 2024
0cb935f
Remove method `hasMethod` from ProxiedApp and its usages (#697)
d-gubert Jan 8, 2024
5853a39
Fix imports in accessors, builders and extenders (#695)
d-gubert Jan 8, 2024
66bf1f3
Scheduler handlers (#696)
d-gubert Jan 8, 2024
9c553f0
Refactor getAppUserUsername usages (#699)
d-gubert Jan 8, 2024
c8cef26
Remove `getAccessors` from ProxiedApp (#700)
d-gubert Jan 8, 2024
4cec6b7
refactor: remove app logger (#701)
tapiarafael Jan 8, 2024
9161cfa
Add publishing of deno tag for testing
d-gubert Jan 8, 2024
de6438f
Fix app construct handler (#702)
d-gubert Jan 10, 2024
a87b848
Debugging improvements and some ironing out (#703)
d-gubert Jan 11, 2024
46be1ff
Improve incoming message handling on both Node and Deno (#704)
d-gubert Jan 12, 2024
7e2c030
Deno logger and linting some files
d-gubert Jan 12, 2024
97fc160
fix: add Buffer conversion for file uploads (#705)
tapiarafael Jan 16, 2024
241e6a6
Add a routine to stop the subprocess in the applicable situations (#706)
d-gubert Jan 18, 2024
ff5f4da
Fix batch (#707)
d-gubert Jan 20, 2024
953d5d9
Fix batch (2) (#708)
d-gubert Jan 20, 2024
abe468b
fix: soft lock when an app uses its accessors (#709)
pierre-lehnen-rc Jan 23, 2024
91a0e1e
fix: bridges (#711)
tapiarafael Jan 25, 2024
750a875
Added error handling for optional methods in listener manager (#713)
d-gubert Jan 25, 2024
2d76d79
Add undo step to recover from installation errors (#712)
d-gubert Jan 25, 2024
1f35719
fix: accessors proxy message (#715)
tapiarafael Jan 25, 2024
f3ce567
fix: buffer import (#716)
tapiarafael Jan 26, 2024
eecb6bc
Remove accessors being sent as parameters on settings event handlers …
d-gubert Jan 30, 2024
e393e25
Prevent timeout if subprocess not available for getStatus (#719)
d-gubert Jan 30, 2024
91eb871
Add logs to app method handlers on Deno (#717)
d-gubert Jan 30, 2024
7168ae7
Adopt msgpack to encode messages instead of JSON (#720)
d-gubert Feb 7, 2024
fe4aff4
fix: providedApiEndpoints (#721)
tapiarafael Feb 8, 2024
1a22439
fix: get providedApiEndpoints from registered endpoints (#722)
tapiarafael Feb 14, 2024
cb16119
Overwrite the name `console` when evaluating the app's code in Deno (…
d-gubert Feb 15, 2024
88e17e5
Small refactors (#724)
d-gubert Feb 15, 2024
0db022f
Fix codec and providedApiEndpoints (#725)
d-gubert Feb 16, 2024
474f857
fix: scheduler execution (#726)
tapiarafael Feb 20, 2024
58534e5
Fix Deno not writing full messages to stdout (#727)
d-gubert Feb 20, 2024
af4c57d
Improve logs (#728)
d-gubert Feb 21, 2024
9ca2c91
Remove unnecessary await in Node's message handler (#729)
d-gubert Feb 21, 2024
056ab3d
Add Queue to Messenger (#730)
d-gubert Feb 22, 2024
d792f32
fix: remove buffer converter (#732)
tapiarafael Feb 23, 2024
3f845c8
Fix bridge response when result is undefined (#731)
d-gubert Feb 23, 2024
41f88cd
fix: remove buffer (#733)
tapiarafael Feb 26, 2024
f89c7ba
Fix permissions for Deno subprocess when package is installed (#734)
d-gubert Feb 26, 2024
8d09c7c
Grant networking permission to Deno subprocess (#736)
d-gubert Mar 12, 2024
55ebc83
fix: wrap `room.usernames` with await (#737)
tapiarafael Mar 13, 2024
924e834
Bundle legacy apps (#743)
d-gubert Mar 18, 2024
f59a2bf
Add new Deno task definition and cache path (#683)
d-gubert Mar 18, 2024
2331aed
fix: deno wrapper path (#744)
tapiarafael Mar 18, 2024
ac30850
fix: test api endpoint import (#745)
tapiarafael Mar 19, 2024
595df04
Merge remote-tracking branch 'origin/alpha' into feat/deno-runtime
d-gubert Mar 19, 2024
24b3562
Add debug package (#746)
d-gubert Mar 20, 2024
34cbbba
fix: handle api endpoint execution exceptions (#747)
tapiarafael Mar 21, 2024
b837ad1
Fix video conf provider calls (#748)
d-gubert Mar 22, 2024
677ee3b
Add time debugger for requests
d-gubert Mar 22, 2024
4b250cd
increase wait for app to build for debug
tapiarafael Mar 25, 2024
c550988
fix: http extend handlers (#751)
tapiarafael Apr 10, 2024
86c3b45
Fix imports in http accessors on Deno
d-gubert Apr 10, 2024
a2d1c2f
chore: ignore .deno folder
tapiarafael Apr 11, 2024
6b3df5a
test: remove since its on deno side
tapiarafael Apr 12, 2024
ac6d54a
Add ping method (#755)
d-gubert Apr 15, 2024
e1d5a42
Improve validation for process spawning
d-gubert Apr 15, 2024
e797c21
Add handler for 'error' event on child_process.spawn
d-gubert Apr 15, 2024
6231a21
Merge commit 'origin/alpha' into feat/deno-runtime
d-gubert Apr 16, 2024
28e4b41
Allow 'fs' module for compatibility
d-gubert Apr 18, 2024
872526a
Improve ping (#758)
d-gubert Apr 22, 2024
efe62b0
test: mock videoConferenceBridge
tapiarafael Apr 22, 2024
b0e84e9
Revert the request timeout to the previous value
d-gubert Apr 22, 2024
7ec1948
Improve ping time (#759)
d-gubert Apr 24, 2024
9425792
Log execution time for failed requests as well
d-gubert Apr 25, 2024
1399cd7
Improve debugging messages of accessor handler
d-gubert Apr 25, 2024
d327b75
Fix unhandled exception if ping times out
d-gubert Apr 25, 2024
daaff54
Fix creator and updater modifiers usage of the senderFn
d-gubert Apr 25, 2024
da47188
Allow Deno process to read NODE_EXTRA_CA_CERTS env var (#761)
d-gubert Apr 29, 2024
39445db
Fix wrong method name in Deno Logger class
d-gubert Apr 30, 2024
46f998e
Fix codec extension for buffer transfer
d-gubert May 13, 2024
a09ff8e
Merge remote-tracking branch 'origin/alpha' into feat/deno-runtime
d-gubert May 13, 2024
5abe1d7
Comments for clarification
d-gubert May 23, 2024
bf642f9
Merge remote-tracking branch 'origin/alpha' into feat/deno-runtime
d-gubert Jun 13, 2024
6e1b09a
Remove automation to publish the 'deno' tag
d-gubert Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
/docs
/server
/lib
/deno-runtime
/.deno
23 changes: 15 additions & 8 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
branches:
- 'alpha'
- 'beta'
- 'feat/deno-runtime'

env:
DENO_DIR: .deno

jobs:
prepare:
Expand Down Expand Up @@ -45,13 +49,18 @@ jobs:
id: cache-nodemodules
uses: actions/cache@v2
with:
path: ./node_modules
key: ${{ runner.OS }}-node_modules-4-${{ hashFiles('./package-lock.json', '.github/workflows/build_and_test.yml') }}
path: |
./node_modules
./deno-runtime/${{ env.DENO_DIR }}
key: ${{ runner.OS }}-node_modules-deno-cache-5-${{ hashFiles('./package-lock.json', './deno-runtime/deno.lock', '.github/workflows/build_and_test.yml') }}

- name: npm install
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: npm install

- name: Deno Info
run: npx deno-bin info

- name: Prepare workspace
run: |
tar czf /tmp/workspace.tar.gz .
Expand Down Expand Up @@ -85,7 +94,7 @@ jobs:

test:
runs-on: ubuntu-latest
needs: prepare
needs: build

steps:
- name: Use Node.js 14.19.3
Expand All @@ -103,13 +112,11 @@ jobs:
tar xzf /tmp/workspace.tar.gz .

- name: Test TypeScript Code
run: npm run unit-tests
run: npm run test

build:
runs-on: ubuntu-latest
needs:
- lint
- test
needs: lint

steps:
- name: Use Node.js 14.19.3
Expand Down Expand Up @@ -141,7 +148,7 @@ jobs:
publish:
runs-on: ubuntu-latest
if: github.event_name == 'release' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta'
needs: build
needs: test

steps:
- name: Use Node.js 14.19.3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jspm_packages
# Optional npm cache directory
.npm

.deno

# Optional REPL history
.node_repl_history

Expand Down
1 change: 1 addition & 0 deletions deno-runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.deno/
26 changes: 26 additions & 0 deletions deno-runtime/AppObjectRegistry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export type Maybe<T> = T | null | undefined;

export const AppObjectRegistry = new class {
registry: Record<string, unknown> = {};

public get<T>(key: string): Maybe<T> {
return this.registry[key] as Maybe<T>;
}

public set(key: string, value: unknown): void {
this.registry[key] = value;
}

public has(key: string): boolean {
return key in this.registry;
}

public delete(key: string): void {
delete this.registry[key];
}

public clear(): void {
this.registry = {};
}
}

170 changes: 170 additions & 0 deletions deno-runtime/acorn-walk.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
import type acorn from "./acorn.d.ts";

export type FullWalkerCallback<TState> = (
node: acorn.AnyNode,
state: TState,
type: string
) => void

export type FullAncestorWalkerCallback<TState> = (
node: acorn.AnyNode,
state: TState,
ancestors: acorn.AnyNode[],
type: string
) => void

type AggregateType = {
Expression: acorn.Expression,
Statement: acorn.Statement,
Pattern: acorn.Pattern,
ForInit: acorn.VariableDeclaration | acorn.Expression
}

export type SimpleVisitors<TState> = {
[type in acorn.AnyNode["type"]]?: (node: Extract<acorn.AnyNode, { type: type }>, state: TState) => void
} & {
[type in keyof AggregateType]?: (node: AggregateType[type], state: TState) => void
}

export type AncestorVisitors<TState> = {
[type in acorn.AnyNode["type"]]?: ( node: Extract<acorn.AnyNode, { type: type }>, state: TState, ancestors: acorn.Node[]
) => void
} & {
[type in keyof AggregateType]?: (node: AggregateType[type], state: TState, ancestors: acorn.Node[]) => void
}

export type WalkerCallback<TState> = (node: acorn.Node, state: TState) => void

export type RecursiveVisitors<TState> = {
[type in acorn.AnyNode["type"]]?: ( node: Extract<acorn.AnyNode, { type: type }>, state: TState, callback: WalkerCallback<TState>) => void
} & {
[type in keyof AggregateType]?: (node: AggregateType[type], state: TState, callback: WalkerCallback<TState>) => void
}

export type FindPredicate = (type: string, node: acorn.Node) => boolean

export interface Found<TState> {
node: acorn.Node,
state: TState
}

/**
* does a 'simple' walk over a tree
* @param node the AST node to walk
* @param visitors an object with properties whose names correspond to node types in the {@link https://github.com/estree/estree | ESTree spec}. The properties should contain functions that will be called with the node object and, if applicable the state at that point.
* @param base a walker algorithm
* @param state a start state. The default walker will simply visit all statements and expressions and not produce a meaningful state. (An example of a use of state is to track scope at each point in the tree.)
*/
export function simple<TState>(
node: acorn.Node,
visitors: SimpleVisitors<TState>,
base?: RecursiveVisitors<TState>,
state?: TState
): void

/**
* does a 'simple' walk over a tree, building up an array of ancestor nodes (including the current node) and passing the array to the callbacks as a third parameter.
* @param node
* @param visitors
* @param base
* @param state
*/
export function ancestor<TState>(
node: acorn.Node,
visitors: AncestorVisitors<TState>,
base?: RecursiveVisitors<TState>,
state?: TState
): void

/**
* does a 'recursive' walk, where the walker functions are responsible for continuing the walk on the child nodes of their target node.
* @param node
* @param state the start state
* @param functions contain an object that maps node types to walker functions
* @param base provides the fallback walker functions for node types that aren't handled in the {@link functions} object. If not given, the default walkers will be used.
*/
export function recursive<TState>(
node: acorn.Node,
state: TState,
functions: RecursiveVisitors<TState>,
base?: RecursiveVisitors<TState>
): void

/**
* does a 'full' walk over a tree, calling the {@link callback} with the arguments (node, state, type) for each node
* @param node
* @param callback
* @param base
* @param state
*/
export function full<TState>(
node: acorn.Node,
callback: FullWalkerCallback<TState>,
base?: RecursiveVisitors<TState>,
state?: TState
): void

/**
* does a 'full' walk over a tree, building up an array of ancestor nodes (including the current node) and passing the array to the callbacks as a third parameter.
* @param node
* @param callback
* @param base
* @param state
*/
export function fullAncestor<TState>(
node: acorn.AnyNode,
callback: FullAncestorWalkerCallback<TState>,
base?: RecursiveVisitors<TState>,
state?: TState
): void

/**
* builds a new walker object by using the walker functions in {@link functions} and filling in the missing ones by taking defaults from {@link base}.
* @param functions
* @param base
*/
export function make<TState>(
functions: RecursiveVisitors<TState>,
base?: RecursiveVisitors<TState>
): RecursiveVisitors<TState>

/**
* tries to locate a node in a tree at the given start and/or end offsets, which satisfies the predicate test. {@link start} and {@link end} can be either `null` (as wildcard) or a `number`. {@link test} may be a string (indicating a node type) or a function that takes (nodeType, node) arguments and returns a boolean indicating whether this node is interesting. {@link base} and {@link state} are optional, and can be used to specify a custom walker. Nodes are tested from inner to outer, so if two nodes match the boundaries, the inner one will be preferred.
* @param node
* @param start
* @param end
* @param type
* @param base
* @param state
*/
export function findNodeAt<TState>(
node: acorn.AnyNode,
start: number | undefined,
end?: number | undefined,
type?: FindPredicate | string,
base?: RecursiveVisitors<TState>,
state?: TState
): Found<TState> | undefined

/**
* like {@link findNodeAt}, but will match any node that exists 'around' (spanning) the given position.
* @param node
* @param start
* @param type
* @param base
* @param state
*/
export function findNodeAround<TState>(
node: acorn.AnyNode,
start: number | undefined,
type?: FindPredicate | string,
base?: RecursiveVisitors<TState>,
state?: TState
): Found<TState> | undefined

/**
* similar to {@link findNodeAround}, but will match all nodes after the given position (testing outer nodes before inner nodes).
*/
export const findNodeAfter: typeof findNodeAround

export const base: RecursiveVisitors<unknown>
Loading
Loading