Compare commits

...

94 Commits

Author SHA1 Message Date
standardci
f275b48770 chore(release): publish new version
- @standardnotes/analytics@2.34.7
 - @standardnotes/api-gateway@1.89.1
 - @standardnotes/auth-server@1.177.0
 - @standardnotes/domain-events-infra@1.22.6
 - @standardnotes/domain-events@2.139.0
 - @standardnotes/files-server@1.37.0
 - @standardnotes/home-server@1.22.21
 - @standardnotes/revisions-server@1.51.7
 - @standardnotes/scheduler-server@1.27.12
 - @standardnotes/syncing-server@1.129.1
 - @standardnotes/websockets-server@1.22.3
2023-12-14 11:51:47 +00:00
Karol Sójko
de4fcf9a4c feat: add procedure for recalculating file quota for user (#980)
* fix(auth): safe guard file upload bytes used to be positive intiger

* feat: add procedure for recalculating file quota for user

* add more meta to logs
2023-12-14 12:31:19 +01:00
standardci
a1455d281f chore(release): publish new version
- @standardnotes/api-gateway@1.89.0
 - @standardnotes/auth-server@1.176.5
 - @standardnotes/home-server@1.22.20
 - @standardnotes/syncing-server@1.129.0
2023-12-12 12:18:49 +00:00
Karol Sójko
cfbe2bbac6 fix(auth): add user uuid context to sign in emails log context 2023-12-12 12:58:11 +01:00
Karol Sójko
398c10ce4b feat(syncing-server): add extended revisions frequency for free users (#965) 2023-12-12 12:42:31 +01:00
standardci
c7d21b092d chore(release): publish new version
- @standardnotes/auth-server@1.176.4
 - @standardnotes/home-server@1.22.19
2023-12-11 13:20:06 +00:00
Karol Sójko
031fa71e7d fix(auth): generate new recovery codes when enabling mfa (#964) 2023-12-11 13:59:57 +01:00
standardci
948e843ad6 chore(release): publish new version
- @standardnotes/analytics@2.34.6
 - @standardnotes/api-gateway@1.88.4
 - @standardnotes/auth-server@1.176.3
 - @standardnotes/domain-events-infra@1.22.5
 - @standardnotes/domain-events@2.138.2
 - @standardnotes/files-server@1.36.6
 - @standardnotes/home-server@1.22.18
 - @standardnotes/revisions-server@1.51.6
 - @standardnotes/scheduler-server@1.27.11
 - @standardnotes/syncing-server@1.128.2
 - @standardnotes/websockets-server@1.22.2
2023-12-11 11:25:27 +00:00
Karol Sójko
7b0ea0a069 fix(syncing-server): add user uuid for the emails requesting backup 2023-12-11 12:05:16 +01:00
standardci
8887b6e642 chore(release): publish new version
- @standardnotes/auth-server@1.176.2
 - @standardnotes/home-server@1.22.17
 - @standardnotes/syncing-server@1.128.1
2023-12-11 10:15:36 +00:00
Karol Sójko
597ff13393 fix(syncing-server): logs meta for email with backup requested 2023-12-11 10:55:16 +01:00
Karol Sójko
4ab61b94a4 fix(auth): error log meta on triggering email backups 2023-12-11 10:52:17 +01:00
standardci
e19652d62a chore(release): publish new version
- @standardnotes/api-gateway@1.88.3
 - @standardnotes/home-server@1.22.16
2023-12-08 16:15:29 +00:00
Karol Sójko
a341e78909 fix(api-gateway): add extra meta to logs 2023-12-08 16:55:18 +01:00
standardci
48e52ac48c chore(release): publish new version
- @standardnotes/home-server@1.22.15
 - @standardnotes/syncing-server@1.128.0
2023-12-08 12:30:03 +00:00
Karol Sójko
6dbb87708f feat(syncing-server): send websocket event to shared vault members upon items change in shared vault (#961) 2023-12-08 13:09:35 +01:00
standardci
d15d51eae6 chore(release): publish new version
- @standardnotes/api-gateway@1.88.2
 - @standardnotes/home-server@1.22.14
2023-12-07 13:48:28 +00:00
Karol Sójko
0058368681 fix(api-gateway): add userId to logs in error handler if possible 2023-12-07 14:28:12 +01:00
standardci
746c821698 chore(release): publish new version
- @standardnotes/analytics@2.34.5
 - @standardnotes/api-gateway@1.88.1
 - @standardnotes/auth-server@1.176.1
 - @standardnotes/files-server@1.36.5
 - @standardnotes/home-server@1.22.13
 - @standardnotes/revisions-server@1.51.5
 - @standardnotes/scheduler-server@1.27.10
 - @standardnotes/syncing-server@1.127.9
 - @standardnotes/websockets-server@1.22.1
2023-12-07 13:03:23 +00:00
Karol Sójko
3f2d8c902c fix(auth): logger meta on disabling settings 2023-12-07 13:43:21 +01:00
Karol Sójko
3637db2563 fix(api-gateway): response header on grpc websocket connection validation 2023-12-07 13:41:28 +01:00
Karol Sójko
8ac84c59af fix: logs meta 2023-12-07 13:39:30 +01:00
Karol Sójko
a2b1323568 fix: logger meta information 2023-12-07 13:29:36 +01:00
standardci
d35391288d chore(release): publish new version
- @standardnotes/api-gateway@1.88.0
 - @standardnotes/auth-server@1.176.0
 - @standardnotes/grpc@1.4.0
 - @standardnotes/home-server@1.22.12
 - @standardnotes/syncing-server@1.127.8
 - @standardnotes/websockets-server@1.22.0
2023-12-07 12:18:19 +00:00
Karol Sójko
d5c1b76de0 feat: replace websocket connection validation with grpc (#954)
* feat: replace websocket connection validation with grpc

* fix(api-gateway): error logs metadata details

* fix binding

* fix logs severity on websockets

* add user uuid to grpc call error logs
2023-12-07 12:58:07 +01:00
standardci
4600a49e88 chore(release): publish new version
- @standardnotes/websockets-server@1.21.4
2023-12-07 10:22:00 +00:00
Karol Sójko
96a2a67aa6 fix(websockets): remove connection trace when it is gone (#953) 2023-12-07 11:01:47 +01:00
standardci
bb380b5794 chore(release): publish new version
- @standardnotes/api-gateway@1.87.7
 - @standardnotes/auth-server@1.175.1
 - @standardnotes/grpc@1.3.2
 - @standardnotes/home-server@1.22.11
 - @standardnotes/syncing-server@1.127.7
2023-12-07 06:10:08 +00:00
Karol Sójko
47004fd20a chore: upgrade grpc-js 2023-12-07 06:49:47 +01:00
standardci
c9bf024109 chore(release): publish new version
- @standardnotes/api-gateway@1.87.6
 - @standardnotes/home-server@1.22.10
 - @standardnotes/websockets-server@1.21.3
2023-12-06 15:02:30 +00:00
Karol Sójko
529795d393 fix(api-gateway): add grpc logs for internal errors 2023-12-06 15:42:12 +01:00
Karol Sójko
79ae07623f fix(websockets): change error message on unknown errors 2023-12-05 14:58:48 +01:00
Micah Zoltu
6bdb524489 Adds support for loading environment vars from file. (#938)
* Adds support for loading environment from file.
2023-12-05 12:19:30 +01:00
standardci
480693fb9f chore(release): publish new version
- @standardnotes/auth-server@1.175.0
 - @standardnotes/home-server@1.22.9
2023-12-04 12:18:52 +00:00
Karol Sójko
e150930072 feat(auth): add renewal of shared subscriptions (#952) 2023-12-04 12:58:14 +01:00
standardci
edd92ef81a chore(release): publish new version
- @standardnotes/analytics@2.34.4
 - @standardnotes/api-gateway@1.87.5
 - @standardnotes/auth-server@1.174.4
 - @standardnotes/domain-events-infra@1.22.4
 - @standardnotes/files-server@1.36.4
 - @standardnotes/home-server@1.22.8
 - @standardnotes/revisions-server@1.51.4
 - @standardnotes/scheduler-server@1.27.9
 - @standardnotes/syncing-server@1.127.6
 - @standardnotes/websockets-server@1.21.2
2023-12-01 12:44:11 +00:00
Karol Sójko
49cd5be352 fix: upgrade aws deps (#946) 2023-12-01 13:23:18 +01:00
standardci
b1665779b5 chore(release): publish new version
- @standardnotes/api-gateway@1.87.4
 - @standardnotes/home-server@1.22.7
 - @standardnotes/syncing-server@1.127.5
2023-12-01 08:53:10 +00:00
Karol Sójko
a82192db42 fix(api-gateway): home server home page (#949)
* feat: add home server home page message

* fix: upgrade yarn
2023-12-01 09:32:56 +01:00
Karol Sójko
589b740f49 fix(syncing-server): remove the dice roll on whether to inform the client on items changed (#950) 2023-12-01 09:24:20 +01:00
Karol Sójko
3c10de3e5d fix: localstack version in docker compose example 2023-11-30 13:45:59 +01:00
standardci
41a04062c9 chore(release): publish new version
- @standardnotes/home-server@1.22.6
 - @standardnotes/syncing-server@1.127.4
2023-11-30 11:36:39 +00:00
Karol Sójko
db9d10c302 fix: upgrade localstack to latest version 2023-11-30 12:16:08 +01:00
Karol Sójko
5596d04040 fix: add outputing docker compose logs 2023-11-30 11:33:10 +01:00
Karol Sójko
341f69e301 Revert "chore: upgrade deps"
This reverts commit ef0464690b.
2023-11-30 10:49:55 +01:00
Karol Sójko
ef0464690b chore: upgrade deps 2023-11-30 10:06:56 +01:00
Karol Sójko
199ebeb4ea fix(syncing-server): increase chances for notifying of items change to 70% 2023-11-30 09:54:47 +01:00
standardci
c949670d4c chore(release): publish new version
- @standardnotes/home-server@1.22.5
 - @standardnotes/syncing-server@1.127.3
2023-11-29 08:55:04 +00:00
Karol Sójko
9dcd583b58 fix(syncing-server): dice roll specs 2023-11-29 09:32:14 +01:00
Karol Sójko
097e320490 fix(syncing-server): increase chances for notifying of items change 2023-11-29 07:54:43 +01:00
standardci
c9bfda91f4 chore(release): publish new version
- @standardnotes/home-server@1.22.4
 - @standardnotes/syncing-server@1.127.2
2023-11-28 10:43:30 +00:00
Karol Sójko
2d6a3ebf45 fix(syncing-server): add debug logs about sending items changed event 2023-11-28 11:21:54 +01:00
standardci
d0d4bd23fb chore(release): publish new version
- @standardnotes/analytics@2.34.3
 - @standardnotes/api-gateway@1.87.3
 - @standardnotes/auth-server@1.174.3
 - @standardnotes/domain-events-infra@1.22.3
 - @standardnotes/domain-events@2.138.1
 - @standardnotes/files-server@1.36.3
 - @standardnotes/home-server@1.22.3
 - @standardnotes/revisions-server@1.51.3
 - @standardnotes/scheduler-server@1.27.8
 - @standardnotes/security@1.17.2
 - @standardnotes/syncing-server@1.127.1
 - @standardnotes/websockets-server@1.21.1
2023-11-28 10:08:27 +00:00
Karol Sójko
edb0a768d0 fix(auth): pass session uuid to web sockets controller 2023-11-28 10:46:39 +01:00
Karol Sójko
4cc647ac07 fix(api-gateway): add session to response locals from web socket middleware 2023-11-28 10:44:56 +01:00
Karol Sójko
bcd1d830e6 fix: pass session uuid to websockets token 2023-11-28 10:39:25 +01:00
standardci
2597324876 chore(release): publish new version
- @standardnotes/analytics@2.34.2
 - @standardnotes/api-gateway@1.87.2
 - @standardnotes/auth-server@1.174.2
 - @standardnotes/domain-events-infra@1.22.2
 - @standardnotes/domain-events@2.138.0
 - @standardnotes/files-server@1.36.2
 - @standardnotes/home-server@1.22.2
 - @standardnotes/revisions-server@1.51.2
 - @standardnotes/scheduler-server@1.27.7
 - @standardnotes/syncing-server@1.127.0
 - @standardnotes/websockets-server@1.21.0
2023-11-28 08:53:10 +00:00
Karol Sójko
69b404f5d4 feat: send event to client upon items change on server (#941)
* feat(websockets): persist connections in mysql

* fix: add sending event to client upon items changed on server

* fix payload

* fix: add cathcing errors

* fix: send changed items event only on a 10% dice roll
2023-11-28 09:31:42 +01:00
standardci
e94b0d0b02 chore(release): publish new version
- @standardnotes/analytics@2.34.1
 - @standardnotes/api-gateway@1.87.1
 - @standardnotes/auth-server@1.174.1
 - @standardnotes/common@1.52.1
 - @standardnotes/domain-core@1.41.1
 - @standardnotes/domain-events-infra@1.22.1
 - @standardnotes/domain-events@2.137.1
 - @standardnotes/files-server@1.36.1
 - @standardnotes/grpc@1.3.1
 - @standardnotes/home-server@1.22.1
 - @standardnotes/predicates@1.8.1
 - @standardnotes/revisions-server@1.51.1
 - @standardnotes/scheduler-server@1.27.6
 - @standardnotes/security@1.17.1
 - @standardnotes/settings@1.23.1
 - @standardnotes/sncrypto-node@1.16.1
 - @standardnotes/syncing-server@1.126.1
 - @standardnotes/time@1.18.1
 - @standardnotes/websockets-server@1.20.4
2023-11-27 09:14:33 +00:00
Karol Sójko
ed1bf37287 fix: repository config in package.json files 2023-11-27 09:53:23 +01:00
standardci
3946f56261 chore(release): publish new version
- @standardnotes/analytics@2.34.0
 - @standardnotes/api-gateway@1.87.0
 - @standardnotes/auth-server@1.174.0
 - @standardnotes/common@1.52.0
 - @standardnotes/domain-core@1.41.0
 - @standardnotes/domain-events-infra@1.22.0
 - @standardnotes/domain-events@2.137.0
 - @standardnotes/files-server@1.36.0
 - @standardnotes/grpc@1.3.0
 - @standardnotes/home-server@1.22.0
 - @standardnotes/predicates@1.8.0
 - @standardnotes/revisions-server@1.51.0
 - @standardnotes/scheduler-server@1.27.5
 - @standardnotes/security@1.17.0
 - @standardnotes/settings@1.23.0
 - @standardnotes/sncrypto-node@1.16.0
 - @standardnotes/syncing-server@1.126.0
 - @standardnotes/time@1.18.0
 - @standardnotes/websockets-server@1.20.3
2023-11-27 08:43:38 +00:00
Karol Sójko
fc53dab007 feat: allow github publish action permission to mint id-token 2023-11-27 09:22:22 +01:00
Karol Sójko
e836abdef7 feat: add npm provenance to published packages 2023-11-27 09:20:10 +01:00
standardci
826482b1f0 chore(release): publish new version
- @standardnotes/analytics@2.33.4
 - @standardnotes/api-gateway@1.86.6
 - @standardnotes/auth-server@1.173.2
 - @standardnotes/domain-events-infra@1.21.4
 - @standardnotes/domain-events@2.136.0
 - @standardnotes/files-server@1.35.2
 - @standardnotes/home-server@1.21.11
 - @standardnotes/revisions-server@1.50.2
 - @standardnotes/scheduler-server@1.27.4
 - @standardnotes/syncing-server@1.125.2
 - @standardnotes/websockets-server@1.20.2
2023-11-23 09:34:26 +00:00
Karol Sójko
45bd00919c feat(domain-events): add email campaign send out requested event 2023-11-23 10:13:00 +01:00
standardci
4e1bae6daf chore(release): publish new version
- @standardnotes/api-gateway@1.86.5
 - @standardnotes/auth-server@1.173.1
 - @standardnotes/home-server@1.21.10
 - @standardnotes/syncing-server@1.125.1
2023-11-22 11:46:47 +00:00
Karol Sójko
8f23c8ab3f fix: error handling on gRPC (#937) 2023-11-22 12:25:42 +01:00
standardci
4d32f26631 chore(release): publish new version
- @standardnotes/analytics@2.33.3
 - @standardnotes/api-gateway@1.86.4
 - @standardnotes/auth-server@1.173.0
 - @standardnotes/domain-events-infra@1.21.3
 - @standardnotes/domain-events@2.135.0
 - @standardnotes/files-server@1.35.1
 - @standardnotes/home-server@1.21.9
 - @standardnotes/revisions-server@1.50.1
 - @standardnotes/scheduler-server@1.27.3
 - @standardnotes/syncing-server@1.125.0
 - @standardnotes/websockets-server@1.20.1
2023-11-22 10:22:09 +00:00
Karol Sójko
c11abe1bd3 feat: add verifiying if user has no items before mass deleting spam accounts (#936) 2023-11-22 11:00:56 +01:00
standardci
4d12566b0d chore(release): publish new version
- @standardnotes/home-server@1.21.8
 - @standardnotes/syncing-server@1.124.3
2023-11-21 14:59:47 +00:00
Karol Sójko
2200dca69d fix(syncing-server): front load themes and user prefs as high priority load items (#935) 2023-11-21 15:38:28 +01:00
standardci
d41dd3bdda chore(release): publish new version
- @standardnotes/api-gateway@1.86.3
 - @standardnotes/home-server@1.21.7
2023-11-21 08:42:31 +00:00
Karol Sójko
c5c24b3ac9 fix(api-gateway): add meta field to grpc sync calls (#934) 2023-11-21 09:21:54 +01:00
standardci
462ade2145 chore(release): publish new version
- @standardnotes/api-gateway@1.86.2
 - @standardnotes/auth-server@1.172.2
 - @standardnotes/home-server@1.21.6
 - @standardnotes/syncing-server@1.124.2
2023-11-20 14:22:00 +00:00
Karol Sójko
bfef16ce37 fix: define grpc max message size 2023-11-20 15:00:48 +01:00
standardci
aa4351c8e9 chore(release): publish new version
- @standardnotes/api-gateway@1.86.1
 - @standardnotes/auth-server@1.172.1
 - @standardnotes/home-server@1.21.5
 - @standardnotes/syncing-server@1.124.1
2023-11-20 13:14:28 +00:00
Karol Sójko
2dff6a2ed3 fix: setting gzip as default compression on grpc calls (#933) 2023-11-20 13:52:54 +01:00
standardci
7808cc8ed2 chore(release): publish new version
- @standardnotes/api-gateway@1.86.0
 - @standardnotes/auth-server@1.172.0
 - @standardnotes/grpc@1.2.0
 - @standardnotes/home-server@1.21.4
 - @standardnotes/syncing-server@1.124.0
2023-11-20 10:29:07 +00:00
Karol Sójko
5b84f078c6 feat(grpc): add syncing protocol buffers (#930)
* feat(grpc): add syncing protocol buffers

* wip

* feat: syncing implementation

* fix: sendign metadata

* fix: grpc sync request mapping

* fix grpc response mapper
2023-11-20 11:08:16 +01:00
standardci
cf5f44a4a5 chore(release): publish new version
- @standardnotes/api-gateway@1.85.1
 - @standardnotes/home-server@1.21.3
2023-11-16 12:17:57 +00:00
Karol Sójko
ed05ea553f fix(api-gateway): remove overly verbose debug messages 2023-11-16 12:57:07 +01:00
standardci
4418c38878 chore(release): publish new version
- @standardnotes/api-gateway@1.85.0
 - @standardnotes/auth-server@1.171.0
 - @standardnotes/home-server@1.21.2
2023-11-16 11:31:52 +00:00
Karol Sójko
6391a01b57 feat: add debug logs for grpc communication 2023-11-16 12:10:51 +01:00
standardci
9dbcec198d chore(release): publish new version
- @standardnotes/api-gateway@1.84.1
 - @standardnotes/home-server@1.21.1
2023-11-16 10:25:54 +00:00
Karol Sójko
78fbeb595f fix(api-gateway): bindings 2023-11-16 11:04:44 +01:00
standardci
d894a87e87 chore(release): publish new version
- @standardnotes/api-gateway@1.84.0
 - @standardnotes/auth-server@1.170.0
 - @standardnotes/files-server@1.35.0
 - @standardnotes/grpc@1.1.0
 - @standardnotes/home-server@1.21.0
 - @standardnotes/revisions-server@1.50.0
 - @standardnotes/syncing-server@1.123.0
 - @standardnotes/websockets-server@1.20.0
2023-11-16 09:31:37 +00:00
Karol Sójko
4f62cac213 feat: add grpc sessions validation server (#928)
* feat: add grpc sessions validation server

* feat: add client implementation on api gateway

* fix: response codes

* fix: errored response

* feat: add configuring grpc as optional service proxy

* fix env vars

* fix linter issue
2023-11-16 10:10:42 +01:00
standardci
ce081274da chore(release): publish new version
- @standardnotes/api-gateway@1.83.5
 - @standardnotes/home-server@1.20.5
2023-11-14 14:18:46 +00:00
Karol Sójko
fd997f4849 fix(api-gateway): remove unused imports 2023-11-14 14:57:41 +01:00
Karol Sójko
3ddd671c47 fix(api-gateway): remove the verify body function 2023-11-14 14:55:55 +01:00
standardci
c19de13cac chore(release): publish new version
- @standardnotes/api-gateway@1.83.4
 - @standardnotes/home-server@1.20.4
2023-11-14 13:30:24 +00:00
Karol Sójko
f65809ef30 fix(api-gateway): checking for buffer length 2023-11-14 14:09:10 +01:00
Karol Sójko
2823ed8612 fix(api-gateway): buffer encoding 2023-11-14 14:07:55 +01:00
Karol Sójko
420bf9ec54 fix(api-gateway): add verification if json is valid on request 2023-11-14 14:04:58 +01:00
415 changed files with 16067 additions and 5174 deletions

View File

@@ -17,6 +17,8 @@ jobs:
name: (Self Hosting) E2E Test Suite
strategy:
fail-fast: false
matrix:
service_proxy_type: [http, grpc]
runs-on: ubuntu-latest
services:
@@ -42,6 +44,14 @@ jobs:
env:
DB_TYPE: mysql
CACHE_TYPE: redis
SERVICE_PROXY_TYPE: ${{ matrix.service_proxy_type }}
- name: Output Server Logs to File
run: docker compose -f docker-compose.ci.yml logs -f > logs/docker-compose.log 2>&1 &
env:
DB_TYPE: mysql
CACHE_TYPE: redis
SERVICE_PROXY_TYPE: ${{ matrix.service_proxy_type }}
- name: Wait for server to start
run: docker/is-available.sh http://localhost:3123 $(pwd)/logs

View File

@@ -4,6 +4,9 @@ on:
push:
branches: [ main ]
permissions:
id-token: write
jobs:
build:
if: contains(github.event.head_commit.message, 'chore(release)') == false

2388
.pnp.cjs generated

File diff suppressed because it is too large Load Diff

127
.pnp.loader.mjs generated
View File

@@ -1,9 +1,9 @@
import fs from 'fs';
import { URL as URL$1, fileURLToPath, pathToFileURL } from 'url';
import path from 'path';
import moduleExports, { Module } from 'module';
import { createHash } from 'crypto';
import { EOL } from 'os';
import moduleExports, { isBuiltin } from 'module';
import assert from 'assert';
const SAFE_TIME = 456789e3;
@@ -16,14 +16,16 @@ const PortablePath = {
const npath = Object.create(path);
const ppath = Object.create(path.posix);
npath.cwd = () => process.cwd();
ppath.cwd = () => toPortablePath(process.cwd());
ppath.resolve = (...segments) => {
if (segments.length > 0 && ppath.isAbsolute(segments[0])) {
return path.posix.resolve(...segments);
} else {
return path.posix.resolve(ppath.cwd(), ...segments);
}
};
ppath.cwd = process.platform === `win32` ? () => toPortablePath(process.cwd()) : process.cwd;
if (process.platform === `win32`) {
ppath.resolve = (...segments) => {
if (segments.length > 0 && ppath.isAbsolute(segments[0])) {
return path.posix.resolve(...segments);
} else {
return path.posix.resolve(ppath.cwd(), ...segments);
}
};
}
const contains = function(pathUtils, from, to) {
from = pathUtils.normalize(from);
to = pathUtils.normalize(to);
@@ -37,17 +39,13 @@ const contains = function(pathUtils, from, to) {
return null;
}
};
npath.fromPortablePath = fromPortablePath;
npath.toPortablePath = toPortablePath;
npath.contains = (from, to) => contains(npath, from, to);
ppath.contains = (from, to) => contains(ppath, from, to);
const WINDOWS_PATH_REGEXP = /^([a-zA-Z]:.*)$/;
const UNC_WINDOWS_PATH_REGEXP = /^\/\/(\.\/)?(.*)$/;
const PORTABLE_PATH_REGEXP = /^\/([a-zA-Z]:.*)$/;
const UNC_PORTABLE_PATH_REGEXP = /^\/unc\/(\.dot\/)?(.*)$/;
function fromPortablePath(p) {
if (process.platform !== `win32`)
return p;
function fromPortablePathWin32(p) {
let portablePathMatch, uncPortablePathMatch;
if (portablePathMatch = p.match(PORTABLE_PATH_REGEXP))
p = portablePathMatch[1];
@@ -57,9 +55,7 @@ function fromPortablePath(p) {
return p;
return p.replace(/\//g, `\\`);
}
function toPortablePath(p) {
if (process.platform !== `win32`)
return p;
function toPortablePathWin32(p) {
p = p.replace(/\\/g, `/`);
let windowsPathMatch, uncWindowsPathMatch;
if (windowsPathMatch = p.match(WINDOWS_PATH_REGEXP))
@@ -68,6 +64,10 @@ function toPortablePath(p) {
p = `/unc/${uncWindowsPathMatch[1] ? `.dot/` : ``}${uncWindowsPathMatch[2]}`;
return p;
}
const toPortablePath = process.platform === `win32` ? toPortablePathWin32 : (p) => p;
const fromPortablePath = process.platform === `win32` ? fromPortablePathWin32 : (p) => p;
npath.fromPortablePath = fromPortablePath;
npath.toPortablePath = toPortablePath;
function convertPath(targetPathUtils, sourcePath) {
return targetPathUtils === npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath);
}
@@ -902,6 +902,12 @@ class ProxiedFS extends FakeFS {
}
}
function direntToPortable(dirent) {
const portableDirent = dirent;
if (typeof dirent.path === `string`)
portableDirent.path = npath.toPortablePath(dirent.path);
return portableDirent;
}
class NodeFS extends BasePortableFakeFS {
constructor(realFs = fs) {
super();
@@ -1228,15 +1234,31 @@ class NodeFS extends BasePortableFakeFS {
async readdirPromise(p, opts) {
return await new Promise((resolve, reject) => {
if (opts) {
this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject));
if (opts.recursive && process.platform === `win32`) {
if (opts.withFileTypes) {
this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback((results) => resolve(results.map(direntToPortable)), reject));
} else {
this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback((results) => resolve(results.map(npath.toPortablePath)), reject));
}
} else {
this.realFs.readdir(npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject));
}
} else {
this.realFs.readdir(npath.fromPortablePath(p), this.makeCallback((value) => resolve(value), reject));
this.realFs.readdir(npath.fromPortablePath(p), this.makeCallback(resolve, reject));
}
});
}
readdirSync(p, opts) {
if (opts) {
return this.realFs.readdirSync(npath.fromPortablePath(p), opts);
if (opts.recursive && process.platform === `win32`) {
if (opts.withFileTypes) {
return this.realFs.readdirSync(npath.fromPortablePath(p), opts).map(direntToPortable);
} else {
return this.realFs.readdirSync(npath.fromPortablePath(p), opts).map(npath.toPortablePath);
}
} else {
return this.realFs.readdirSync(npath.fromPortablePath(p), opts);
}
} else {
return this.realFs.readdirSync(npath.fromPortablePath(p));
}
@@ -1372,10 +1394,8 @@ class VirtualFS extends ProxiedFS {
const [major, minor] = process.versions.node.split(`.`).map((value) => parseInt(value, 10));
const WATCH_MODE_MESSAGE_USES_ARRAYS = major > 19 || major === 19 && minor >= 2 || major === 18 && minor >= 13;
const HAS_LAZY_LOADED_TRANSLATORS = major > 19 || major === 19 && minor >= 3;
const HAS_LAZY_LOADED_TRANSLATORS = major === 20 && minor < 6 || major === 19 && minor >= 3;
const builtinModules = new Set(Module.builtinModules || Object.keys(process.binding(`natives`)));
const isBuiltinModule = (request) => request.startsWith(`node:`) || builtinModules.has(request);
function readPackageScope(checkPath) {
const rootSeparatorIndex = checkPath.indexOf(npath.sep);
let separatorIndex;
@@ -1963,7 +1983,7 @@ async function resolvePrivateRequest(specifier, issuer, context, nextResolve) {
}
async function resolve$1(originalSpecifier, context, nextResolve) {
const { findPnpApi } = moduleExports;
if (!findPnpApi || isBuiltinModule(originalSpecifier))
if (!findPnpApi || isBuiltin(originalSpecifier))
return nextResolve(originalSpecifier, context, nextResolve);
let specifier = originalSpecifier;
const url = tryParseURL(specifier, isRelativeRegexp.test(specifier) ? context.parentURL : void 0);
@@ -2022,31 +2042,46 @@ async function resolve$1(originalSpecifier, context, nextResolve) {
if (!HAS_LAZY_LOADED_TRANSLATORS) {
const binding = process.binding(`fs`);
const originalfstat = binding.fstat;
const ZIP_MASK = 4278190080;
const ZIP_MAGIC = 704643072;
binding.fstat = function(...args) {
const [fd, useBigint, req] = args;
if ((fd & ZIP_MASK) === ZIP_MAGIC && useBigint === false && req === void 0) {
const originalReadFile = binding.readFileUtf8 || binding.readFileSync;
if (originalReadFile) {
binding[originalReadFile.name] = function(...args) {
try {
const stats = fs.fstatSync(fd);
return new Float64Array([
stats.dev,
stats.mode,
stats.nlink,
stats.uid,
stats.gid,
stats.rdev,
stats.blksize,
stats.ino,
stats.size,
stats.blocks
]);
return fs.readFileSync(args[0], {
encoding: `utf8`,
flag: args[1]
});
} catch {
}
}
return originalfstat.apply(this, args);
};
return originalReadFile.apply(this, args);
};
} else {
const binding2 = process.binding(`fs`);
const originalfstat = binding2.fstat;
const ZIP_MASK = 4278190080;
const ZIP_MAGIC = 704643072;
binding2.fstat = function(...args) {
const [fd, useBigint, req] = args;
if ((fd & ZIP_MASK) === ZIP_MAGIC && useBigint === false && req === void 0) {
try {
const stats = fs.fstatSync(fd);
return new Float64Array([
stats.dev,
stats.mode,
stats.nlink,
stats.uid,
stats.gid,
stats.rdev,
stats.blksize,
stats.ino,
stats.size,
stats.blocks
]);
} catch {
}
}
return originalfstat.apply(this, args);
};
}
}
const resolve = resolve$1;

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More