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

[Package Importer] Embedded Host #260

Merged
merged 31 commits into from
Feb 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
32e455f
Export nodePackageImporter
jamesnw Oct 26, 2023
8de2e60
Setup NodePackageImporter message
jamesnw Oct 27, 2023
67c812d
Add nodePackageImporter to legacy importers
jamesnw Oct 30, 2023
7bda416
Fix typo
jamesnw Nov 1, 2023
7b82352
Update protocol version
jamesnw Nov 9, 2023
e566b2f
Change export to Symbol
jamesnw Nov 17, 2023
e591fad
Remove type predicate, move check inline
jamesnw Nov 17, 2023
317ab80
Workaround symbol changes
jamesnw Nov 21, 2023
8c95697
Add link to Typescript issue
jamesnw Nov 22, 2023
5a5cfd2
Adjust entrypoint logic
jamesnw Nov 27, 2023
b3f5414
Address review
jamesnw Dec 4, 2023
cf4b0cc
Lint
jamesnw Dec 4, 2023
97b3685
review
jgerigmeyer Dec 15, 2023
34298c4
Workaround Node regression: https://github.com/nodejs/node/issues/51167
jgerigmeyer Dec 15, 2023
2417f0b
Merge branch 'main' into feature.package-importer
jgerigmeyer Dec 15, 2023
b5c84a6
Update NodePackageImporter to class
jamesnw Dec 19, 2023
8964f75
Revert legacyImporterProtocol
jamesnw Dec 20, 2023
a55acff
Fix path import, legacy importer options.
jamesnw Dec 20, 2023
a469cf1
Merge branch 'main' into feature.package-importer
jgerigmeyer Jan 5, 2024
0f7f3f9
remove outdated legacy importer syntax
jgerigmeyer Jan 5, 2024
75e338a
re-add legacy pkgImporter logic
jgerigmeyer Jan 5, 2024
b8e96d6
Address review
jgerigmeyer Jan 7, 2024
623a0b9
Merge branch 'main' of https://github.com/sass/embedded-host-node int…
jamesnw Jan 17, 2024
988fabb
Update protocol version
jamesnw Jan 17, 2024
abd2a71
Merge branch 'main' of https://github.com/sass/embedded-host-node int…
jamesnw Jan 18, 2024
f05aa50
Address review
jgerigmeyer Jan 25, 2024
83be63a
Update entry point to directory
jamesnw Feb 1, 2024
be27f0b
Use directory of require.main.filename
jamesnw Feb 1, 2024
dfe637a
Remove redundant cwd in p.resolve
jamesnw Feb 1, 2024
1f4489c
Make entryPointDirectoryKey readonly and non-nullable
jgerigmeyer Feb 2, 2024
f571bfe
typo
jgerigmeyer Feb 2, 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
10 changes: 7 additions & 3 deletions lib/src/importer-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {catchOr, thenOr, PromiseOr} from './utils';
const entryPointDirectoryKey = Symbol();

export class NodePackageImporter {
[entryPointDirectoryKey]?: string;
readonly [entryPointDirectoryKey]: string;

constructor(entryPointDirectory?: string) {
entryPointDirectory = entryPointDirectory
Expand Down Expand Up @@ -52,7 +52,11 @@ export class ImporterRegistry<sync extends 'sync' | 'async'> {

constructor(options?: Options<sync>) {
this.importers = (options?.importers ?? [])
.map(importer => this.register(importer))
.map(importer =>
this.register(
importer as Importer<sync> | FileImporter<sync> | NodePackageImporter
jgerigmeyer marked this conversation as resolved.
Show resolved Hide resolved
)
)
.concat(
(options?.loadPaths ?? []).map(
path =>
Expand All @@ -70,7 +74,7 @@ export class ImporterRegistry<sync extends 'sync' | 'async'> {
const message = new proto.InboundMessage_CompileRequest_Importer();
if (importer instanceof NodePackageImporter) {
const importerMessage = new proto.NodePackageImporter();
importerMessage.entryPointDirectory = importer[entryPointDirectoryKey]!;
importerMessage.entryPointDirectory = importer[entryPointDirectoryKey];
message.importer = {
case: 'nodePackageImporter',
value: importerMessage,
Expand Down
Loading