Giter Site home page Giter Site logo

tscpaths's Issues

Improvement of the program

Hello! I cloned your job and I arranged it. You can visit it at https://github.com/justkey007/tsc-alias.
Currently, just take the typed configuration and without the other options. Excuse me I speak French which I used the machine translation but my message was poorly translated and I noticed too late.

replaces paths with .ts instead of .js

Not sure why this would be happening. It does it regardless of if I chain the tsc and tscpaths commands or not.

Output:
require("../shared/index.ts");

Expected:
require("../shared/index.js");

Is the project abandoned?

Hi @joonhocho, cc: @jonkwheeler, @adam187,

I’m seeing that there are issues opened since 2018 and pull requests from 2019. Any chance that you have decided to no longer maintain this project anymore?

In that case, it would be good to state it in the README, I use this package in all my libraries and I would like to address some of the issues that it has. I would be also open to being a maintainer of the project or taking it over if you are no longer interested.

Regards

Breaks if tsconfig.json extends from a config defined in node_modules

My tsconfig.json contains an extends property, which targets a config that is a node_module dependency:

{
  "extends": "@org/ts-config",
  ...
}

however this breaks tscpaths:

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '<redacted>/@org/ts-config'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.exports.loadConfig (<redacted>/node_modules/tscpaths/cjs/util.js:16:12)
    at Object.exports.loadConfig (<redacted>/node_modules/tscpaths/cjs/util.js:28:38)
    at Object.<anonymous> (<redacted>/node_modules/tscpaths/cjs/index.js:37:43)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

it seems loadConfig() in utils is not able to correctly resolve non-relative/non-absolute extends clauses.

It doesn't work when using the alias as the root of the import

require("alias/file") works fine, but if you have an index file under the alias and reference only require("alias"), it doesn't work. Imports to the root of an alias never gets replaced.

From what I see, this project has been abandoned, if anyone goes through the same problem, you need to replace the line 105 in this file for:

if (modulePath.startsWith(prefix) || modulePath === prefix.replace(/\/$/, '')) {

Input / Output source paths

I don't mind providing the input and output directory.

But I think the output should be directly reference compilerOptions.outDir found in the tsconfig.json description.

windows path replacement error

on the Windows operating system, path alias will be compiled to backslash, but it is good on the Mac.
below is my screenshots

  • windows:
    windows

  • Mac:
    mac

and my useage is:
rimraf dist && tsc --project tsconfig.json && tscpaths -p tsconfig.json -s ./src -o ./dist

Not able to replace image assets

I've been running this over some image assets that are aliased and getting back "could not replace". When this line executes with a .ts file, it looks like the path is getting combined with the file name to get the full location. But when it executes with a .png file, only the image file name comes back.

const moduleSrc = resolve(apath, modulePathRel);

I wonder if something as simple as path + filename would suffice here, rather than using the resolve function.

moderate security severity on globby dependency

https://www.npmjs.com/advisories/1751

node_modules/glob-parent
fast-glob <=2.2.7
Depends on vulnerable versions of glob-parent
node_modules/tscpaths/node_modules/fast-glob
globby 8.0.0 - 9.2.0
Depends on vulnerable versions of fast-glob
node_modules/tscpaths/node_modules/globby
tscpaths *
Depends on vulnerable versions of globby
node_modules/tscpaths

please update the globby package to fix this issue, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.