-
Notifications
You must be signed in to change notification settings - Fork 80
Add a target suitable for nodejs. #190
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
Comments
@engelsdamien you probably would depend on the polyfill package? |
The current node package (api_only as commonjs) unfortunately breaks:
as we're now expecting a browser environment in trustedtypes.js, to test for browser behavior. |
https://www.npmjs.com/package/element-closest has something close to what we need. https://github.com/airbnb/browser-shims has a short list of polyfills we might take a look at for comparison. |
Is the idea that we provide an API that, given a TrustedTypesPolicyConfiguration and an HTMLDocument, returns a TrustedTypesPolicyFactory? |
Sorry for the late response. Yes :) |
That probably means publishing an npm package that
api_only.js
entry point) (TrustedTypes.createPolicy
etc.).These can be separate modules, but should all be packaged in one package, such that one can (I'm making up the API shape completely here):
For the time being, this should probably be packaged as CommonJS modules, as ES modules are still experimental in Node 12, but we should explore how to migrate to ES modules eventually. It sounds like we might be able to package both variants together : https://nodejs.org/api/esm.html#esm_package_entry_points.
The text was updated successfully, but these errors were encountered: