{"id":15493354,"url":"https://github.com/gulp-plugin/alias","last_synced_at":"2025-04-15T06:16:14.199Z","repository":{"id":37802385,"uuid":"167262471","full_name":"gulp-plugin/alias","owner":"gulp-plugin","description":"Resolve TypeScript import aliases and paths.","archived":false,"fork":false,"pushed_at":"2023-05-03T17:00:06.000Z","size":1012,"stargazers_count":20,"open_issues_count":22,"forks_count":12,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-15T06:16:03.613Z","etag":null,"topics":["alias-resolver","gulp","javascript","nodejs","tsconfig-paths","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gulp-plugin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-23T22:14:07.000Z","updated_at":"2023-11-20T00:41:03.000Z","dependencies_parsed_at":"2024-06-18T17:08:05.771Z","dependency_job_id":"b8ab51db-3c51-436d-b2dc-92f3a185c706","html_url":"https://github.com/gulp-plugin/alias","commit_stats":{"total_commits":166,"total_committers":7,"mean_commits":"23.714285714285715","dds":0.6746987951807228,"last_synced_commit":"d293c55259ebaf78f4742b41a2be661b66d5242a"},"previous_names":["dhkatz/gulp-ts-alias"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulp-plugin%2Falias","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulp-plugin%2Falias/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulp-plugin%2Falias/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulp-plugin%2Falias/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gulp-plugin","download_url":"https://codeload.github.com/gulp-plugin/alias/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249016643,"owners_count":21198833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alias-resolver","gulp","javascript","nodejs","tsconfig-paths","typescript"],"created_at":"2024-10-02T08:05:45.210Z","updated_at":"2025-04-15T06:16:14.175Z","avatar_url":"https://github.com/gulp-plugin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @gulp-plugin/alias ![npm (custom registry)](https://img.shields.io/npm/v/@gulp-plugin/alias?logo=npm) [![GitHub Package Registry version](https://img.shields.io/github/release/gulp-plugin/alias.svg?label=gpr\u0026logo=github)](https://github.com/gulp-plugin/alias/packages/896973)\n\n\n[![Build](https://github.com/dhkatz/gulp-ts-alias/actions/workflows/node.js.yml/badge.svg)](https://github.com/dhkatz/gulp-ts-alias/actions/workflows/node.js.yml)\n[![Coverage Status](https://coveralls.io/repos/github/dhkatz/gulp-ts-alias/badge.svg?branch=master)](https://coveralls.io/github/dhkatz/gulp-ts-alias?branch=master) [![dependencies Status](https://david-dm.org/gulp-plugin/alias/status.svg)](https://david-dm.org/gulp-plugin/alias)\n\nResolve TypeScript import aliases and paths defined in `tsconfig`.\n\n## Install\n\n`npm install --save-dev @gulp-plugin/alias`\n\n## Information\n\n### Features\n\n* Supports all import types: `import`, `require`, `await import()`\n* Supports wild card aliases\n\n### Motivation\n\nThere have been previous attempts at releasing Gulp plugins that accomplish something similar, but all have become unmaintained.\n\nFor legacy’s sake, here is a list of previous packages/scripts that have been considered:\n\n[gulp-ts-paths](https://www.npmjs.com/package/gulp-ts-paths)\n\n[path-alias-resolver](https://gist.github.com/azarus/f369ee2ab0283ba0793b0ccf0e9ec590)\n\n**Note:** Imports within multiline comments may also be replaced.\n\n## Usage\n\n```javascript\nconst typescript = require('gulp-typescript');\nconst sourcemaps = require('gulp-sourcemaps');\nconst alias = require('@gulp-plugin/alias');\n\nconst { config } = typescript.createProject('tsconfig.json');\n\nfunction build() {\n  const compiled = src('./src/**/*.ts')\n    .pipe(alias(config))\n    // or .pipe(alias('tsconfig.json'))\n    // or even .pipe(alias())\n    .pipe(sourcemaps.init())\n    .pipe(project());\n\n  return compiled.js\n    .pipe(sourcemaps.write({ sourceRoot: file =\u003e path.relative(path.join(file.cwd, file.path), file.base) }))\n    .pipe(dest('build/'))\n}\n```\n\n## Example\n\nThe following configuration is common in `tsconfig` configuration files\n\n```json\n{\n  \"rootDir\": \"./src\",\n  \"baseUrl\": \".\",\n  \"paths\": {\n    \"@/*\": [\"src/*\"]\n  }\n}\n```\n\nIn practice, these path aliases are often used in this fashion\n\nInput:\n\n```typescript\nimport express from 'express';\n\nimport A from './file'; // Normal relative import\n\n// Aliased import, resolves to some relative path to rootDir\nimport B from '@/components';\n```\n\nOutput:\n\n```typescript\nimport express from 'express';\n\nimport A from './file';\n\n// gulp-ts-alias finds the correct relative path\n// and replaces it before compilation\nimport B from '../../components';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgulp-plugin%2Falias","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgulp-plugin%2Falias","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgulp-plugin%2Falias/lists"}