GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support 'exports' field in package.json of published modules. · Issue #1389 · TypeScriptToLua/TypeScriptToLua

Support 'exports' field in package.json of published modules. #1389

New issue
Copy link
New issue
Copy link
Open
Open
Support 'exports' field in package.json of published modules.#1389
Copy link
Labels
feature requestscope: transpileAny transpilation not directly related to code transformsAny transpilation not directly related to code transforms

Description

@pilaoda
pilaoda
opened on Feb 2, 2023
Issue body actions

There are two problems about this field.

First:

TypeScriptToLua/src/transpilation/resolve.ts

Lines 13 to 19 in 93ff05d

const resolver = resolve.ResolverFactory.createResolver({
extensions: [".lua"],
enforceExtension: true, // Resolved file must be a lua file
fileSystem: { ...new resolve.CachedInputFileSystem(fs) },
useSyncFileSystemCalls: true,
symlinks: false, // Do not resolve symlinks to their original paths (that breaks node_modules detection)
});

The resolver should add conditions to support export conditions in a published module's package.json like:

{
    "exports": {
        "./client": {
            "require": "./dist/client/index.lua",
            "types": "./src/index.ts"
        }
    },
}

I guess we should add ["node", "require"], and maybe "tstl" ?
Related doc:

  • https://nodejs.org/api/packages.html#conditional-exports
  • https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#esm-nodejs

Second:

TypeScriptToLua/src/transpilation/utils.ts

Line 54 in 93ff05d

resolved = resolve.sync(query, { basedir, extensions: [".js", ".ts", ".tsx"] });

resolvePlugin use node-resolve rather than enhanced-resolve, which not support this "exports" field.

Activity

  1. Perryvw
    added
    feature request
    scope: transpileAny transpilation not directly related to code transformsAny transpilation not directly related to code transforms
    on Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestscope: transpileAny transpilation not directly related to code transformsAny transpilation not directly related to code transforms

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.