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

Conversation

jamesnw
Copy link
Contributor

@jamesnw jamesnw commented Oct 30, 2023

lib/src/importer-registry.ts Outdated Show resolved Hide resolved
lib/src/importer-registry.ts Outdated Show resolved Hide resolved
@jamesnw jamesnw marked this pull request as ready for review November 27, 2023 14:57
@jamesnw jamesnw requested a review from nex3 November 27, 2023 14:58
lib/src/compile.ts Outdated Show resolved Hide resolved
lib/src/legacy/index.ts Outdated Show resolved Hide resolved
lib/src/importer-registry.ts Outdated Show resolved Hide resolved
lib/src/importer-registry.ts Outdated Show resolved Hide resolved
lib/src/importer-registry.ts Outdated Show resolved Hide resolved
@jamesnw
Copy link
Contributor Author

jamesnw commented Dec 4, 2023

Review comments were addressed, but I'll wait to request re-review until after the entry point logic is ironed out.

lib/src/utils.test.ts Outdated Show resolved Hide resolved
* main:
  add comment
  update actions
  Specify node versions a la sass/sass-spec#1957
  Work around recent breaking change in Node
  update package.json
  Test against Node20, remove Node14.
  Add semicolons and remove duplicate TS config
@jgerigmeyer jgerigmeyer force-pushed the feature.package-importer branch from ceda6f8 to 2417f0b Compare December 15, 2023 22:38
@jamesnw jamesnw requested a review from nex3 December 20, 2023 20:37
* main:
  Update Dart Sass version and release
  Look for x64 version on arm64 windows (sass#266)
  Update Dart Sass version and release
  Support musl-libc and android (sass#265)
lib/src/importer-registry.ts Outdated Show resolved Hide resolved
lib/src/importer-registry.ts Outdated Show resolved Hide resolved
@jgerigmeyer jgerigmeyer requested a review from nex3 January 7, 2024 18:15
@ntkme

This comment was marked as resolved.

@jamesnw

This comment was marked as resolved.

lib/src/importer-registry.ts Outdated Show resolved Hide resolved
@jgerigmeyer jgerigmeyer requested a review from nex3 January 25, 2024 00:16
lib/src/importer-registry.ts Outdated Show resolved Hide resolved
const entryPointDirectoryKey = Symbol();

export class NodePackageImporter {
[entryPointDirectoryKey]?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this can be readonly and non-nullable, since it's always set in the constructor (if it doesn't throw an error).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted in 1f4489c. Because the Sass NodePackageImporter type does not include this property, TypeScript complains when calling register() because this NodePackageImporter no longer matches the expected type from Sass. I addressed that here by adding importer as Importer<sync> | FileImporter<sync> | NodePackageImporter, but if this trade-off isn't worth it I can revert this commit and go back to an optional entryPointDirectoryKey.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd definitely prefer to have this readonly and non-nullable, since that's a direct representation of the actual state of the class. The static errors raise an interesting issue, though—because TypeScript checks types structurally, and the existing NodePackageImporter type from the Sass package has no properties, it will effectively allow any object to be passed as an importer. It should probably have its own secret symbol property to avoid this, which will in turn mean that we will need a cast here no matter what.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nex3 Ah, ok -- that makes sense. So adding a private readonly non-nullable Symbol key to the definition in the Sass repo, correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgerigmeyer jgerigmeyer requested a review from nex3 February 2, 2024 16:00
lib/src/importer-registry.ts Show resolved Hide resolved
@nex3 nex3 merged commit 5e2abf5 into sass:main Feb 6, 2024
16 checks passed
@jgerigmeyer jgerigmeyer deleted the feature.package-importer branch February 7, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants