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

use observablehq:stdlib instead of npm:@observablehq/stdlib #1670

Merged
merged 4 commits into from
Sep 21, 2024

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Sep 18, 2024

The goal here is to differentiate packages that are built-in to Framework from ones that are published and loaded from npm. This PR only makes this change for the standard library (observablehq:stdlib), but if other built-in modules are provided in the future, we could use observablehq: for that, too.

Note that there are several other libraries such as npm:@observablehq/dot that we intend to publish to npm in the future, but for pragmatism are currently implemented as built-ins. We don’t want to switch these to observablehq: because the desired future state is for these libraries to be published to and imported from npm rather than being built-in.

Also some libraries as npm:@observablehq/xlsx and npm:@observablehq/zip should be private built-ins as these are not intended to be published to npm nor imported directly; they are only intended to be used by FileAttachment and are imported as observablehq:stdlib/xlsx and observablehq:stdlib/zip.

Related #852.

@mbostock mbostock requested a review from Fil September 18, 2024 02:56
@mbostock
Copy link
Member Author

Should I expand this to include other built-in libraries @Fil? Basically anything that I don’t think is really worth it to publish as a standalone library to npm? (We could always publish it to npm in the future if there’s demand to use a library outside of Framework, but most of these are pretty trivial…)

And should I add an “Observable imports” section to the Imports documentation that describes the observablehq: protocol?

@Fil
Copy link
Contributor

Fil commented Sep 19, 2024

Yes it would be good to clarify all of this. Doesn't seem blocking for this PR though.

@mbostock
Copy link
Member Author

I sketched out what it would look like to use e.g. observablehq:stdlib/sqlite instead of npm:@observablehq/sqlite, and it feels like the more we embrace observablehq:, the higher risk of confusion since we need to explain the protocol. Maybe we should stick with the original plan and try to publish these to npm and favor decoupling when possible. Though I think it seems reasonable for observablehq:stdlib to still be a built-in since it is tightly coupled with Framework (e.g. view depends on Generators.input). Hmm. 🤔

@mbostock
Copy link
Member Author

TODO Add documentation for observablehq: imports.

@mbostock mbostock merged commit 5170bbf into main Sep 21, 2024
4 checks passed
@mbostock mbostock deleted the mbostock/observable-imports branch September 21, 2024 17:31
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.

2 participants