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

chore: move xml2js into the repo to eliminate npm git dependency #11660

Merged
merged 2 commits into from
Jun 6, 2024

Conversation

mcdurdin
Copy link
Member

@mcdurdin mcdurdin commented Jun 3, 2024

Small rewrites to the xml2js code as ES6 modules. Based on https://github.com/keymanapp/dependency-node-xml2js

Fixes: #8616

@keymanapp-test-bot skip

@@ -1,4 +1,4 @@
import * as xml2js from 'xml2js';
import * as xml2js from '../deps/xml2js/xml2js.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

Possibly worth considering: subpath imports.

In the common/web/types/package.json, you could define a package-internal import (say, #xml2js) and not have to worry about potential variations in the relative pathing.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can give it a go but am concerned that our bundling will break with it -- we already have to copy published packages into a temp folder to avoid problems with hoisting and workspaces when bundling (see

function do_bundle() {
).

When importing all of events with:

    import * as events from 'events';

tsc for kmc-ldml (but not for common/web/types) would error with:

    ../../../common/web/types/build/src/deps/xml2js/parser.d.ts:17:25 - error TS2306: File '.../node_modules/@types/node/events.d.ts' is not a module.

    17 import * as events from "node/events.js";

I am not clear why. Changing to the following side-stepped this:

    import { EventEmitter } from 'events';
Base automatically changed from chore/8616-remove-restructure-git-dep to master June 6, 2024 03:02
@mcdurdin mcdurdin merged commit 23f9391 into master Jun 6, 2024
19 checks passed
@mcdurdin mcdurdin deleted the chore/8616-bring-xml2js-into-repo branch June 6, 2024 03:02
@mcdurdin mcdurdin restored the chore/8616-bring-xml2js-into-repo branch June 6, 2024 03:36
@mcdurdin mcdurdin deleted the chore/8616-bring-xml2js-into-repo branch June 6, 2024 04:44
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.50-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chore(developer): resolve external dependencies xml2js and restructure that are currently based on github refs
3 participants