Skip to content

Convert require calls to imports #15

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

Closed

Conversation

jakebailey
Copy link
Owner

@jakebailey jakebailey commented Sep 7, 2022

Although the existing require calls would work fine, it's more
consistent to make them actual imports and let them be converted at
compile/bundle time. It also lets us emit ESM if needed.

There are still conditional requires present for things like the node
System, but that's a more difficult problem to solve.


Please do not comment on this PR. Depending on how this set of PRs evolves, this PR's contents may change entirely based on the order of commits.

This PR is a part of a stack:

  1. Make a few changes to allow all code to be loaded as one project
  2. Explicitly reference ts namespace in tsserverlibrary
  3. Generated module conversion step - unindent
  4. Generated module conversion step - explicitify
  5. Generated module conversion step - stripNamespaces
  6. Generated module conversion step - inlineImports
  7. Generated module conversion step - .git-ignore-blame-revs
  8. Add gitlens settings suggestion
  9. Make processDiagnosticMessages generate a module
  10. Fix up linting, make lint clean
  11. Undo changes needed to load codebase into ts-morph
  12. Add JSDoc eslint rule
  13. Fix all internal JSDoc comments
  14. Convert require calls to imports (this PR)
  15. Remove typescriptServices, protocol.d.ts, typescript_standalone.d.ts
  16. Get codebase building pre bundling
  17. Add build via esbuild
  18. Add dts bundling
  19. Consolidate checks that test if the current environment is Node
  20. Add ts to globalThis in run.js for convenience during debugging
  21. Rename Gulpfile to Herebyfile for improved git diff
  22. Change build system to hereby
  23. Update baselines for corrected line endings in lib files
  24. Use jsonc-parser instead of LKG compiler in build
  25. Modernize localize script, use new XML library
  26. Don't use needsUpdate for quick tasks
  27. Remove mkdirp
  28. Export ts namespace from tsserver for hacky-post patching
  29. Directly import namespaces for improved esbuild output
  30. Ensure ts object passed to plugins contains deprecatedCompat declarations
  31. Move compiler-debug into Debug namespace, which allows the compiler to be tree shaken
  32. Remove Promise redeclaration
  33. Remove globalThisShim and globalThis modification for TypeScriptServicesFactory
  34. Disable slow CodeQL queries
  35. Remove outFiles from launch.json
  36. Remove dynamicImport and setDynamicImport

@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 739e71d to a31b0ef Compare September 13, 2022 16:52
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from d60d508 to a3b3d68 Compare September 13, 2022 16:52
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from a31b0ef to 223a3f5 Compare September 13, 2022 20:27
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from a3b3d68 to 4f53563 Compare September 13, 2022 20:27
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 223a3f5 to 9b79d42 Compare September 13, 2022 21:02
@jakebailey jakebailey changed the title Add api-extractor Get entrypoints working Sep 13, 2022
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 4f53563 to 3a93e7a Compare September 13, 2022 21:02
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 9b79d42 to 72d390c Compare September 13, 2022 21:47
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 3a93e7a to abad547 Compare September 13, 2022 21:47
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 72d390c to ff637c0 Compare September 13, 2022 21:58
@jakebailey jakebailey changed the title Get entrypoints working Add api-extractor Sep 13, 2022
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from abad547 to fca4bc0 Compare September 13, 2022 21:58
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from ff637c0 to 40f3f72 Compare September 13, 2022 23:22
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from fca4bc0 to 6fac93a Compare September 13, 2022 23:22
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 40f3f72 to d4005a7 Compare September 14, 2022 17:26
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 6fac93a to 1993fa1 Compare September 14, 2022 17:26
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from d4005a7 to c80e914 Compare September 16, 2022 04:35
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 1993fa1 to 286195b Compare September 16, 2022 04:35
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from c80e914 to 1764185 Compare September 16, 2022 04:37
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 286195b to b740f77 Compare September 16, 2022 04:37
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 1764185 to ebf0539 Compare September 16, 2022 05:43
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from b740f77 to ea26c2f Compare September 16, 2022 05:43
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from ebf0539 to 22a440a Compare September 19, 2022 20:11
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from ea26c2f to e08154d Compare September 19, 2022 20:11
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 22a440a to e744bbc Compare September 19, 2022 20:38
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from e08154d to aece916 Compare September 19, 2022 20:38
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from e744bbc to 0d8842b Compare September 20, 2022 05:06
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from aece916 to fc8b8a7 Compare September 20, 2022 05:06
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 0d8842b to 99362b4 Compare September 20, 2022 05:10
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from fc8b8a7 to 7190b1f Compare September 20, 2022 05:10
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from fb79c58 to d611199 Compare October 25, 2022 02:23
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from fc64d7a to f135ee7 Compare October 25, 2022 02:23
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from d611199 to f73b5d5 Compare October 27, 2022 04:22
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from f135ee7 to a7ad51b Compare October 27, 2022 04:22
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from f73b5d5 to f9a831b Compare October 27, 2022 17:40
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from a7ad51b to e9091ce Compare October 27, 2022 17:40
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from f9a831b to 55034d7 Compare October 28, 2022 02:22
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from e9091ce to cf0cc6d Compare October 28, 2022 02:22
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 55034d7 to 875c9e5 Compare October 31, 2022 21:33
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from cf0cc6d to dd49c2d Compare October 31, 2022 21:33
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 875c9e5 to a976a7b Compare November 2, 2022 00:43
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from dd49c2d to 6bbd4d1 Compare November 2, 2022 00:43
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from a976a7b to 0034428 Compare November 2, 2022 16:55
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 6bbd4d1 to 15edfcc Compare November 2, 2022 16:55
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 0034428 to bd75883 Compare November 2, 2022 19:45
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 15edfcc to 9fa23f3 Compare November 2, 2022 19:45
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from bd75883 to 6549b80 Compare November 6, 2022 21:52
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 9fa23f3 to b33f0f4 Compare November 6, 2022 21:52
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 6549b80 to 48ab28c Compare November 6, 2022 21:58
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from b33f0f4 to 0b737aa Compare November 6, 2022 21:58
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from 48ab28c to b71c759 Compare November 7, 2022 03:53
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 0b737aa to 7e24d04 Compare November 7, 2022 03:53
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from b71c759 to dcef3b9 Compare November 7, 2022 19:27
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 7e24d04 to 50300fe Compare November 7, 2022 19:27
@jakebailey jakebailey force-pushed the transform-stack-commit-13 branch from dcef3b9 to 597e4a7 Compare November 7, 2022 21:37
Although the existing require calls would work fine, it's more
consistent to make them actual imports and let them be converted at
compile/bundle time. It also lets us emit ESM if needed.

There are still conditional requires present for things like the node
System, but that's a more difficult problem to solve.
@jakebailey jakebailey force-pushed the transform-stack-commit-14 branch from 50300fe to 588ed82 Compare November 7, 2022 21:38
@jakebailey jakebailey deleted the branch transform-stack-commit-13 November 7, 2022 23:54
@jakebailey jakebailey closed this Nov 7, 2022
@jakebailey jakebailey deleted the transform-stack-commit-14 branch November 7, 2022 23:54
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.

1 participant