├── dummy.js
├── src
├── test
│ ├── fixtures
│ │ ├── target
│ │ │ ├── file.txt
│ │ │ ├── deep
│ │ │ │ ├── file.txt
│ │ │ │ ├── web
│ │ │ │ │ └── file.txt
│ │ │ │ ├── linux-x64
│ │ │ │ │ └── file.txt
│ │ │ │ ├── random
│ │ │ │ │ └── file.txt
│ │ │ │ └── darwin-arm64
│ │ │ │ │ └── file.txt
│ │ │ ├── web
│ │ │ │ └── file.txt
│ │ │ ├── linux-x64
│ │ │ │ └── file.txt
│ │ │ ├── random
│ │ │ │ └── file.txt
│ │ │ ├── darwin-arm64
│ │ │ │ └── file.txt
│ │ │ └── package.json
│ │ ├── env
│ │ │ ├── README.md
│ │ │ ├── LICENSE
│ │ │ ├── .env
│ │ │ ├── main.ts
│ │ │ └── package.json
│ │ ├── secrets
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── secret1Ignore
│ │ │ ├── secret2Ignore
│ │ │ ├── noSecret1Ignore
│ │ │ ├── noSecret2Ignore
│ │ │ ├── noSecret3Ignore
│ │ │ ├── secret2.ts
│ │ │ ├── package.json
│ │ │ ├── noSecret3.ts
│ │ │ ├── noSecret2.ts
│ │ │ ├── secret1.ts
│ │ │ └── noSecret1.ts
│ │ ├── manifestFiles
│ │ │ ├── README.md
│ │ │ ├── logger.log
│ │ │ ├── LICENSE
│ │ │ ├── foo
│ │ │ │ └── bar
│ │ │ │ │ └── hello.txt
│ │ │ ├── .vscode
│ │ │ │ └── tasks.json
│ │ │ ├── foo2
│ │ │ │ └── bar2
│ │ │ │ │ ├── ignore.me
│ │ │ │ │ └── include.me
│ │ │ ├── package.json
│ │ │ └── foo3
│ │ │ │ └── bar3
│ │ │ │ └── hello.txt
│ │ ├── vscodeignore
│ │ │ ├── logger.log
│ │ │ ├── foo
│ │ │ │ └── bar
│ │ │ │ │ └── hello.txt
│ │ │ ├── .vscode
│ │ │ │ └── tasks.json
│ │ │ ├── package.json
│ │ │ └── .vscodeignore
│ │ ├── vsixmanifest
│ │ │ ├── ohno.vsixmanifest
│ │ │ └── package.json
│ │ ├── devDependencies
│ │ │ ├── node_modules
│ │ │ │ ├── fake
│ │ │ │ │ ├── .dotfile
│ │ │ │ │ ├── dependency.js
│ │ │ │ │ └── package.json
│ │ │ │ ├── real
│ │ │ │ │ ├── dependency.js
│ │ │ │ │ ├── node_modules
│ │ │ │ │ │ └── real_sub
│ │ │ │ │ │ │ ├── dependency.js
│ │ │ │ │ │ │ └── package.json
│ │ │ │ │ └── package.json
│ │ │ │ ├── real2
│ │ │ │ │ ├── dependency.js
│ │ │ │ │ └── package.json
│ │ │ │ └── real_sub
│ │ │ │ │ ├── dependency.js
│ │ │ │ │ └── package.json
│ │ │ └── package.json
│ │ ├── packagedDependencies
│ │ │ ├── node_modules
│ │ │ │ ├── isexe
│ │ │ │ │ ├── .npmignore
│ │ │ │ │ ├── access.js
│ │ │ │ │ ├── package.json
│ │ │ │ │ ├── windows.js
│ │ │ │ │ ├── mode.js
│ │ │ │ │ ├── README.md
│ │ │ │ │ ├── index.js
│ │ │ │ │ └── test
│ │ │ │ │ │ └── basic.js
│ │ │ │ ├── which
│ │ │ │ │ ├── node_modules
│ │ │ │ │ │ └── isexe
│ │ │ │ │ │ │ ├── .npmignore
│ │ │ │ │ │ │ ├── LICENSE
│ │ │ │ │ │ │ ├── package.json
│ │ │ │ │ │ │ ├── windows.js
│ │ │ │ │ │ │ ├── mode.js
│ │ │ │ │ │ │ ├── index.js
│ │ │ │ │ │ │ ├── README.md
│ │ │ │ │ │ │ └── test
│ │ │ │ │ │ │ └── basic.js
│ │ │ │ │ ├── LICENSE
│ │ │ │ │ ├── package.json
│ │ │ │ │ ├── bin
│ │ │ │ │ │ └── which
│ │ │ │ │ ├── README.md
│ │ │ │ │ ├── CHANGELOG.md
│ │ │ │ │ └── which.js
│ │ │ │ └── .yarn-integrity
│ │ │ ├── package.json
│ │ │ └── yarn.lock
│ │ ├── icon
│ │ │ ├── icon.png
│ │ │ ├── package.json
│ │ │ └── package-lock.json
│ │ ├── uuid
│ │ │ └── package.json
│ │ ├── version
│ │ │ └── package.json
│ │ ├── readme
│ │ │ ├── readme.github.md
│ │ │ ├── readme.gitlab.md
│ │ │ ├── readme.github.expected.md
│ │ │ ├── readme.gitlab.expected.md
│ │ │ ├── readme.md
│ │ │ ├── readme.branch.override.content.expected.md
│ │ │ ├── readme.gitlab.branch.override.content.expected.md
│ │ │ ├── readme.branch.override.images.expected.md
│ │ │ ├── readme.gitlab.branch.override.images.expected.md
│ │ │ ├── readme.images.expected.md
│ │ │ ├── readme.default.md
│ │ │ ├── readme.branch.main.expected.md
│ │ │ ├── readme.expected.md
│ │ │ ├── readme.gitlab.default.md
│ │ │ └── readme.gitlab.branch.main.expected.md
│ │ └── nls
│ │ │ ├── package.nls.json
│ │ │ └── package.json
│ ├── store.test.ts
│ └── validation.test.ts
├── typings
│ └── parse-semver.d.ts
├── nls.ts
├── auth.ts
├── xml.ts
├── publicgalleryapi.ts
├── zip.ts
├── viewutils.ts
├── search.ts
├── api.ts
├── manifest.ts
├── validation.ts
├── show.ts
├── secretLint.ts
├── npm.ts
├── store.ts
├── util.ts
└── publish.ts
├── vsce
├── .gitignore
├── .npmignore
├── .dockerignore
├── Dockerfile
├── .vscode
├── settings.json
├── extensions.json
├── launch.json
└── tasks.json
├── tsconfig.json
├── .github
└── workflows
│ └── ci.yml
├── LICENSE
├── SECURITY.md
├── README.md
├── package.json
└── ThirdPartyNotices.txt
/dummy.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/target/file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/env/README.md:
--------------------------------------------------------------------------------
1 | Test
--------------------------------------------------------------------------------
/src/test/fixtures/target/deep/file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/target/web/file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/env/LICENSE:
--------------------------------------------------------------------------------
1 | LICENSE...
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/LICENSE:
--------------------------------------------------------------------------------
1 | LICENSE...
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/README.md:
--------------------------------------------------------------------------------
1 | Test
--------------------------------------------------------------------------------
/src/test/fixtures/target/deep/web/file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/target/linux-x64/file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/target/random/file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/env/.env:
--------------------------------------------------------------------------------
1 | A=1
2 | B=2
3 | C=3
--------------------------------------------------------------------------------
/src/test/fixtures/manifestFiles/README.md:
--------------------------------------------------------------------------------
1 | Test
--------------------------------------------------------------------------------
/src/test/fixtures/manifestFiles/logger.log:
--------------------------------------------------------------------------------
1 | log
--------------------------------------------------------------------------------
/src/test/fixtures/target/darwin-arm64/file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/target/deep/linux-x64/file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/target/deep/random/file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/vscodeignore/logger.log:
--------------------------------------------------------------------------------
1 | log
--------------------------------------------------------------------------------
/src/test/fixtures/manifestFiles/LICENSE:
--------------------------------------------------------------------------------
1 | LICENSE...
--------------------------------------------------------------------------------
/src/test/fixtures/target/deep/darwin-arm64/file.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/manifestFiles/foo/bar/hello.txt:
--------------------------------------------------------------------------------
1 | hi there
--------------------------------------------------------------------------------
/src/test/fixtures/vscodeignore/foo/bar/hello.txt:
--------------------------------------------------------------------------------
1 | hi there
--------------------------------------------------------------------------------
/src/test/fixtures/vsixmanifest/ohno.vsixmanifest:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/fake/.dotfile:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/fake/dependency.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/real/dependency.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/real2/dependency.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/real_sub/dependency.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vsce:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | require('./out/main')(process.argv);
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/manifestFiles/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "tasks": [],
3 | }
--------------------------------------------------------------------------------
/src/test/fixtures/vscodeignore/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "tasks": [],
3 | }
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/secret1Ignore:
--------------------------------------------------------------------------------
1 | **secret**
2 | **noSecret**
3 | !secret1.ts
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/secret2Ignore:
--------------------------------------------------------------------------------
1 | **secret**
2 | **noSecret**
3 | !secret2.ts
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/real/node_modules/real_sub/dependency.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/noSecret1Ignore:
--------------------------------------------------------------------------------
1 | **secret**
2 | **noSecret**
3 | !noSecret1.ts
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/noSecret2Ignore:
--------------------------------------------------------------------------------
1 | **secret**
2 | **noSecret**
3 | !noSecret2.ts
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/noSecret3Ignore:
--------------------------------------------------------------------------------
1 | **secret**
2 | **noSecret**
3 | !noSecret3.ts
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/isexe/.npmignore:
--------------------------------------------------------------------------------
1 | .nyc_output/
2 | coverage/
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/secret2.ts:
--------------------------------------------------------------------------------
1 | export const k = `npm_Ab3kZy0X9QpLmN4tUvW7aBcDeFgHiJkLmNoPqRsTu`
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | out/
3 | dist/
4 | npm-debug.log
5 | !src/test/**/node_modules
6 | yarn.lock
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/fake/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fake",
3 | "version": "1.0.0"
4 | }
--------------------------------------------------------------------------------
/src/test/fixtures/manifestFiles/foo2/bar2/ignore.me:
--------------------------------------------------------------------------------
1 | This should be ignored as if it was added to the .vscodeignore file
--------------------------------------------------------------------------------
/src/test/fixtures/manifestFiles/foo2/bar2/include.me:
--------------------------------------------------------------------------------
1 | This file is included because it is in package.json files property
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/.npmignore:
--------------------------------------------------------------------------------
1 | .nyc_output/
2 | coverage/
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/icon/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-vsce/HEAD/src/test/fixtures/icon/icon.png
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/real_sub/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "real_sub",
3 | "version": "2.0.0"
4 | }
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/real/node_modules/real_sub/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "real_sub",
3 | "version": "1.0.0"
4 | }
--------------------------------------------------------------------------------
/src/test/fixtures/target/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "target",
3 | "publisher": "joaomoreno",
4 | "version": "1.0.0",
5 | "engines": { "vscode": "*" }
6 | }
--------------------------------------------------------------------------------
/src/test/fixtures/uuid/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "uuid",
3 | "publisher": "joaomoreno",
4 | "version": "1.0.0",
5 | "engines": { "vscode": "*" }
6 | }
--------------------------------------------------------------------------------
/src/test/fixtures/vsixmanifest/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "uuid",
3 | "publisher": "joaomoreno",
4 | "version": "1.0.0",
5 | "engines": { "vscode": "*" }
6 | }
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "uuid",
3 | "publisher": "joaomoreno",
4 | "version": "1.0.0",
5 | "engines": {
6 | "vscode": "*"
7 | }
8 | }
--------------------------------------------------------------------------------
/src/test/fixtures/version/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "version",
3 | "publisher": "felipecrs",
4 | "version": "1.0.0",
5 | "engines": {
6 | "vscode": "*"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/test/fixtures/vscodeignore/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "uuid",
3 | "publisher": "joaomoreno",
4 | "version": "1.0.0",
5 | "engines": { "vscode": "*" },
6 | "files": []
7 | }
--------------------------------------------------------------------------------
/src/test/fixtures/env/main.ts:
--------------------------------------------------------------------------------
1 |
2 | // Here a Fibonacci sequence function
3 | export function fib(n: number): number {
4 | if (n <= 1) return n;
5 | return fib(n - 1) + fib(n - 2);
6 | }
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/real/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "real",
3 | "version": "1.0.0",
4 | "dependencies": {
5 | "real_sub": "1.0.0",
6 | "real2": "*"
7 | }
8 | }
--------------------------------------------------------------------------------
/src/test/fixtures/icon/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "version",
3 | "publisher": "joaomoreno",
4 | "version": "1.0.0",
5 | "icon": "./icon.png",
6 | "engines": {
7 | "vscode": "*"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .github/
2 | .vscode/
3 | build/
4 | src/
5 | out/test/
6 | out/**/*.d.ts
7 | .dockerignore
8 | .gitignore
9 | Dockerfile
10 | SECURITY.md
11 | tsconfig.json
12 | api-extractor.json
13 | **/*.js.map
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | out/
3 | npm-debug.log
4 | !src/test/**/node_modules
5 | Dockerfile
6 | .gitignore
7 | .npmignore
8 | LICENSE
9 | README.md
10 | SECURITY.md
11 | azure-pipelines.yml
12 | ThirdPartyNotices.txt
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "root-test-package",
3 | "publisher": "jrieken",
4 | "version": "1.0.0",
5 | "engines": {
6 | "vscode": "*"
7 | },
8 | "dependencies": {
9 | "isexe": "1.0.0",
10 | "which": "1.3.1"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/node_modules/real2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "real2",
3 | "description": "This package is needed by real to include real_sub@1.0.0 and real_sub@2.0.0",
4 | "version": "1.0.0",
5 | "dependencies": {
6 | "real_sub": "2.0.0"
7 | }
8 | }
--------------------------------------------------------------------------------
/src/test/fixtures/devDependencies/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "root-test-package",
3 | "publisher": "joaomoreno",
4 | "version": "1.0.0",
5 | "engines": { "vscode": "*" },
6 | "dependencies": {
7 | "real": "*"
8 | },
9 | "devDependencies": {
10 | "fake": "*"
11 | }
12 | }
--------------------------------------------------------------------------------
/src/test/fixtures/env/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "uuid",
3 | "publisher": "joaomoreno",
4 | "version": "1.0.0",
5 | "engines": {
6 | "vscode": "*"
7 | },
8 | "files": [
9 | "main.ts",
10 | "package.json",
11 | "LICENSE",
12 | "README.md",
13 | ".env"
14 | ]
15 | }
--------------------------------------------------------------------------------
/src/typings/parse-semver.d.ts:
--------------------------------------------------------------------------------
1 | declare module 'parse-semver' {
2 | interface Result {
3 | readonly name: string;
4 | readonly range: string;
5 | readonly version: string;
6 | }
7 | module parseSemver {}
8 | function parseSemver(input: string): Result;
9 | export = parseSemver;
10 | }
11 |
--------------------------------------------------------------------------------
/src/test/fixtures/icon/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "version",
3 | "version": "1.0.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "version",
9 | "version": "1.0.0",
10 | "engines": {
11 | "vscode": "*"
12 | }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/test/fixtures/vscodeignore/.vscodeignore:
--------------------------------------------------------------------------------
1 | # pattern of dotted directory without backslash
2 | .vscode
3 |
4 | # pattern of directory with trailing backslash
5 | out/
6 |
7 | # pattern of file name
8 | *.log
9 |
10 | # https://github.com/microsoft/vscode-vsce/issues/588
11 | foo
12 | !foo/bar/hello.txt
--------------------------------------------------------------------------------
/src/test/fixtures/manifestFiles/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "uuid",
3 | "publisher": "joaomoreno",
4 | "version": "1.0.0",
5 | "engines": {
6 | "vscode": "*"
7 | },
8 | "files": [
9 | "foo",
10 | "foo2/bar2/include.me",
11 | "*/bar3/**",
12 | "package.json",
13 | "LICENSE",
14 | "README.md"
15 | ]
16 | }
--------------------------------------------------------------------------------
/src/test/fixtures/manifestFiles/foo3/bar3/hello.txt:
--------------------------------------------------------------------------------
1 | Some text in here!
2 | Some text in here!
3 | Some text in here!
4 | Some text in here!
5 | Some text in here!
6 | Some text in here!
7 | Some text in here!
8 | Some text in here!
9 | Some text in here!
10 | Some text in here!
11 | Some text in here!
12 | Some text in here!
13 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:18-alpine
2 | RUN apk add --update-cache \
3 | libsecret \
4 | && rm -rf /var/cache/apk/*
5 | WORKDIR /opt/vsce
6 | COPY package.json package-lock.json ./
7 | RUN npm install
8 | COPY . .
9 | RUN npm run compile
10 | RUN rm package-lock.json tsconfig.json
11 | VOLUME /workspace
12 | WORKDIR /workspace
13 | ENTRYPOINT ["/opt/vsce/vsce"]
14 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/isexe/access.js:
--------------------------------------------------------------------------------
1 | module.exports = isexe
2 | isexe.sync = sync
3 |
4 | var fs = require('fs')
5 |
6 | function isexe (path, cb) {
7 | fs.access(path, fs.X_OK, function (er) {
8 | cb(er, !er)
9 | })
10 | }
11 |
12 | function sync (path) {
13 | fs.accessSync(path, fs.X_OK)
14 | return true
15 | }
16 |
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/noSecret3.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/microsoft/vscode-vsce/issues/1153
2 | function npm_i_save_dev_types_Slashjest_or_npm_i_(){}
3 | function npm_i_save_dev_types_Slash_1_if_it_exists(){}
4 | function Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig(){}
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "editor.insertSpaces": false,
4 | "search.exclude": {
5 | "**/node_modules": true,
6 | "out": true
7 | },
8 | "typescript.tsdk": "./node_modules/typescript/lib",
9 | "git.branchProtection": ["main"],
10 | "files.associations": { "*.json": "jsonc" }
11 | }
12 |
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/noSecret2.ts:
--------------------------------------------------------------------------------
1 | // https://github.com/microsoft/vscode-vsce/issues/1147
2 | let privateB64 = '-----BEGIN PRIVATE KEY-----\n';
3 | privateB64 += 'ABC\n';
4 | privateB64 += '-----END PRIVATE KEY-----\n';
5 |
6 | const description = ` This is some description test
7 |
8 | \`\`\`ini
9 | key="-----BEGIN PRIVATE KEY-----\\nXXXX\\nXXXX\\n-----END PRIVATE KEY-----"
10 | \`\`\`
11 |
12 | some other text.
13 | `;
14 |
15 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3 | // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4 | // List of extensions which should be recommended for users of this workspace.
5 | "recommendations": ["hbenl.vscode-mocha-test-adapter"],
6 | // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
7 | "unwantedRecommendations": []
8 | }
9 |
--------------------------------------------------------------------------------
/src/test/fixtures/readme/readme.github.md:
--------------------------------------------------------------------------------
1 | # Replace
2 |
3 | #8
4 |
5 | * Some issue in same repository: #7
6 | * Some issue in other repository: other/repositoryName#8
7 | * Some issue in other repository with fancy name: my_user-name/my-rep_o12#6
8 |
9 | # Do not touch this:
10 | * username#4 (no valid github link)
11 | * /#7
12 | * foo/$234/#7
13 | * [#7](http://shouldnottouchthis/)
14 | * [other/repositoryName#8](http://shouldnottouchthis/)
15 | * [Email me](MAILTO:example@example.com)
16 |
--------------------------------------------------------------------------------
/src/test/fixtures/readme/readme.gitlab.md:
--------------------------------------------------------------------------------
1 | # Replace
2 |
3 | #8
4 |
5 | * Some issue in same repository: #7
6 | * Some issue in other repository: other/repositoryName#8
7 | * Some issue in other repository with fancy name: my_user-name/my-rep_o12#6
8 |
9 | # Do not touch this:
10 | * username#4 (no valid gitlab link)
11 | * /#7
12 | * foo/$234/#7
13 | * [#7](http://shouldnottouchthis/)
14 | * [other/repositoryName#8](http://shouldnottouchthis/)
15 | * [Email me](MAILTO:example@example.com)
16 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2020",
4 | "module": "commonjs",
5 | "lib": ["es2020"],
6 | "esModuleInterop": true,
7 | "outDir": "out",
8 | "allowJs": true,
9 | "strict": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "noUnusedLocals": true,
12 | "noUnusedParameters": true,
13 | "noImplicitReturns": true,
14 | "declaration": true,
15 | "sourceMap": true
16 | },
17 | "include": ["src"],
18 | "ts-node": {
19 | "files": true
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/isexe/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "isexe",
3 | "version": "1.0.0",
4 | "description": "Minimal module to check if a file is executable.",
5 | "main": "index.js",
6 | "directories": {
7 | "test": "test"
8 | },
9 | "devDependencies": {
10 | "mkdirp": "^0.5.1",
11 | "rimraf": "^2.5.0",
12 | "tap": "^5.0.1"
13 | },
14 | "scripts": {
15 | "test": "tap test/*.js --cov"
16 | },
17 | "author": "Isaac Z. Schlueter (http://blog.izs.me/)",
18 | "license": "ISC"
19 | }
20 |
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/secret1.ts:
--------------------------------------------------------------------------------
1 | export const k = `
2 | -----BEGIN OPENSSH PRIVATE KEY-----
3 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAaAAAABNlY2RzYS
4 | 1zaGEyLW5pc3RwMjU2A564CG5pc3RwMjU2AAAAQQR+598gRY+O8LM7Jk80+etTh+Hi4zUW
5 | Pj7jrQoOPbvvkLKhPMHPXaVsXScxbFe87++o9Qn0h9AKtp+Rvf4mHSqwAAAAoKDtkvGg7Z
6 | LxAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAA123bmlzdHAyNTYAAABBBH7n3yBFj47wszsm
7 | TzT561OH4eLjNRY+PuOtCg49u++QsqE8wc9dpWxdJzFsV7zv76j1CfSH0Aq2n5G9/iYdKr
8 | AAAAAgNbbtcAGWxT7sR5Rbth6D/4MPQd+LO5ljjbjHQlu9KdUAAAAGbm9uYW1lAQI=
9 | -----END OPENSSH PRIVATE KEY-----
10 | `
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "type": "node",
9 | "request": "launch",
10 | "name": "Launch Program",
11 | // "cwd": "",
12 | "program": "${workspaceFolder}/vsce",
13 | "args": [
14 | "--version"
15 | // "ls", "package", "publish"
16 | ],
17 | "sourceMaps": true,
18 | "outputCapture": "std"
19 | }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=733558
3 | // for the documentation about the tasks.json format
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "type": "npm",
8 | "script": "watch:build",
9 | "problemMatcher": ["$tsc-watch"],
10 | "group": {
11 | "kind": "build",
12 | "isDefault": true
13 | },
14 | "isBackground": true
15 | },
16 | {
17 | "type": "npm",
18 | "script": "test",
19 | "problemMatcher": [],
20 | "label": "npm: test",
21 | "detail": "mocha",
22 | "group": {
23 | "kind": "test",
24 | "isDefault": true
25 | }
26 | }
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | isexe@1.0.0:
6 | version "1.0.0"
7 | resolved "https://registry.yarnpkg.com/isexe/-/isexe-1.0.0.tgz#9aa37a1d11d27b523bec4f8791b72af1ead44ee3"
8 |
9 | isexe@^2.0.0:
10 | version "2.0.0"
11 | resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
12 |
13 | which@1.3.1:
14 | version "1.3.1"
15 | resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
16 | dependencies:
17 | isexe "^2.0.0"
18 |
--------------------------------------------------------------------------------
/src/test/fixtures/readme/readme.github.expected.md:
--------------------------------------------------------------------------------
1 | # Replace
2 |
3 | [#8](https://github.com/username/repository/issues/8)
4 |
5 | * Some issue in same repository: [#7](https://github.com/username/repository/issues/7)
6 | * Some issue in other repository: [other/repositoryName#8](https://github.com/other/repositoryName/issues/8)
7 | * Some issue in other repository with fancy name: [my_user-name/my-rep_o12#6](https://github.com/my_user-name/my-rep_o12/issues/6)
8 |
9 | # Do not touch this:
10 | * username#4 (no valid github link)
11 | * /#7
12 | * foo/$234/#7
13 | * [#7](http://shouldnottouchthis/)
14 | * [other/repositoryName#8](http://shouldnottouchthis/)
15 | * [Email me](MAILTO:example@example.com)
16 |
--------------------------------------------------------------------------------
/src/test/fixtures/readme/readme.gitlab.expected.md:
--------------------------------------------------------------------------------
1 | # Replace
2 |
3 | [#8](https://gitlab.com/username/repository/-/issues/8)
4 |
5 | * Some issue in same repository: [#7](https://gitlab.com/username/repository/-/issues/7)
6 | * Some issue in other repository: [other/repositoryName#8](https://gitlab.com/other/repositoryName/-/issues/8)
7 | * Some issue in other repository with fancy name: [my_user-name/my-rep_o12#6](https://gitlab.com/my_user-name/my-rep_o12/-/issues/6)
8 |
9 | # Do not touch this:
10 | * username#4 (no valid gitlab link)
11 | * /#7
12 | * foo/$234/#7
13 | * [#7](http://shouldnottouchthis/)
14 | * [other/repositoryName#8](http://shouldnottouchthis/)
15 | * [Email me](MAILTO:example@example.com)
16 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | pull_request:
5 | branches: [main]
6 | push:
7 | branches: [main]
8 |
9 | jobs:
10 | test:
11 | name: Test on ${{ matrix.os }}
12 | runs-on: ${{ matrix.os }}
13 | strategy:
14 | matrix:
15 | os: [ubuntu-latest, windows-latest, macos-latest]
16 |
17 | steps:
18 | - name: Checkout code
19 | uses: actions/checkout@v4
20 | with:
21 | persist-credentials: false
22 |
23 | - name: Setup Node.js
24 | uses: actions/setup-node@v4
25 | with:
26 | node-version: '20.x'
27 |
28 | - name: Install dependencies
29 | run: npm ci
30 |
31 | - name: Run tests
32 | run: npm test
33 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/.yarn-integrity:
--------------------------------------------------------------------------------
1 | {
2 | "systemParams": "darwin-x64-57",
3 | "modulesFolders": [
4 | "node_modules"
5 | ],
6 | "flags": [],
7 | "linkedModules": [
8 | "vscode-nls-dev"
9 | ],
10 | "topLevelPatterns": [
11 | "isexe@1.0.0",
12 | "which@1.3.1"
13 | ],
14 | "lockfileEntries": {
15 | "isexe@1.0.0": "https://registry.yarnpkg.com/isexe/-/isexe-1.0.0.tgz#9aa37a1d11d27b523bec4f8791b72af1ead44ee3",
16 | "isexe@^2.0.0": "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10",
17 | "which@1.3.1": "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
18 | },
19 | "files": [],
20 | "artifacts": {}
21 | }
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/isexe/windows.js:
--------------------------------------------------------------------------------
1 | module.exports = isexe
2 | isexe.sync = sync
3 |
4 | var fs = require('fs')
5 |
6 | function checkPathExt (path) {
7 | var pathext = process.env.PATHEXT
8 | if (!pathext) {
9 | return true
10 | }
11 | pathext = pathext.split(';')
12 | for (var i = 0; i < pathext.length; i++) {
13 | var p = pathext[i].toLowerCase()
14 | if (p && path.substr(-p.length).toLowerCase() === p) {
15 | return true
16 | }
17 | }
18 | return false
19 | }
20 |
21 | function isexe (path, cb) {
22 | fs.stat(path, function (er, st) {
23 | cb(er, er ? false : checkPathExt(path))
24 | })
25 | }
26 |
27 | function sync (path) {
28 | fs.statSync(path)
29 | return checkPathExt(path)
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/isexe/mode.js:
--------------------------------------------------------------------------------
1 | module.exports = isexe
2 | isexe.sync = sync
3 |
4 | var fs = require('fs')
5 |
6 | function isexe (path, cb) {
7 | fs.stat(path, function (er, st) {
8 | cb(er, er ? false : checkMode(st))
9 | })
10 | }
11 |
12 | function sync (path) {
13 | return checkMode(fs.statSync(path))
14 | }
15 |
16 | function checkMode (stat) {
17 | var mod = stat.mode
18 | var uid = stat.uid
19 | var gid = stat.gid
20 | var u = parseInt('100', 8)
21 | var g = parseInt('010', 8)
22 | var o = parseInt('001', 8)
23 | var ug = u | g
24 |
25 | var ret = (mod & o) ||
26 | (mod & g) && process.getgid && gid === process.getgid() ||
27 | (mod & u) && process.getuid && uid === process.getuid() ||
28 | (mod & ug) && process.getuid && process.getuid() === 0
29 |
30 | return ret
31 | }
32 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/LICENSE:
--------------------------------------------------------------------------------
1 | The ISC License
2 |
3 | Copyright (c) Isaac Z. Schlueter and Contributors
4 |
5 | Permission to use, copy, modify, and/or distribute this software for any
6 | purpose with or without fee is hereby granted, provided that the above
7 | copyright notice and this permission notice appear in all copies.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/LICENSE:
--------------------------------------------------------------------------------
1 | The ISC License
2 |
3 | Copyright (c) Isaac Z. Schlueter and Contributors
4 |
5 | Permission to use, copy, modify, and/or distribute this software for any
6 | purpose with or without fee is hereby granted, provided that the above
7 | copyright notice and this permission notice appear in all copies.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 |
--------------------------------------------------------------------------------
/src/test/fixtures/secrets/noSecret1.ts:
--------------------------------------------------------------------------------
1 | export const k = {
2 | 'type': 'service_account',
3 | 'project_id': 'my-gcp-project',
4 | 'private_key_id': 'abcdef1234567890abcdef1234567890abcdef12',
5 | 'private_key': '-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkq...\n-----END PRIVATE KEY-----\n',
6 | 'client_email': 'my-service-account@my-gcp-project.iam.gserviceaccount.com',
7 | 'client_id': '123456789012345678901',
8 | 'auth_uri': 'https://accounts.google.com/o/oauth2/auth',
9 | 'token_uri': 'https://oauth2.googleapis.com/token',
10 | 'auth_provider_x509_cert_url': 'https://www.googleapis.com/oauth2/v1/certs',
11 | 'client_x509_cert_url': 'https://www.googleapis.com/robot/v1/metadata/x509/my-service-account%40my-gcp-project.iam.gserviceaccount.com'
12 | };
13 |
14 | // Here a Fibonacci sequence function
15 | export function fib(n: number): number {
16 | if (n <= 1) return n;
17 | return fib(n - 1) + fib(n - 2);
18 | }
--------------------------------------------------------------------------------
/src/nls.ts:
--------------------------------------------------------------------------------
1 | import { ManifestPackage } from './manifest';
2 |
3 | export interface ITranslations {
4 | [key: string]: string;
5 | }
6 |
7 | const regex = /^%([\w\d.]+)%$/i;
8 |
9 | function createPatcher(translations: ITranslations): (value: T) => T {
10 | return (value: T): T => {
11 | if (typeof value !== 'string') {
12 | return value;
13 | }
14 |
15 | const match = regex.exec(value);
16 |
17 | if (!match) {
18 | return value;
19 | }
20 |
21 | const translation = translations[match[1]] as unknown;
22 | if (translation === undefined) {
23 | throw new Error(`No translation found for ${value}`);
24 | }
25 |
26 | return translation as T;
27 | };
28 | }
29 |
30 | export function patchNLS(manifest: ManifestPackage, translations: ITranslations): ManifestPackage {
31 | const patcher = createPatcher(translations);
32 | return JSON.parse(JSON.stringify(manifest, (_, value: any) => patcher(value)));
33 | }
34 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "Isaac Z. Schlueter (http://blog.izs.me)",
3 | "name": "which",
4 | "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
5 | "version": "1.3.1",
6 | "repository": {
7 | "type": "git",
8 | "url": "git://github.com/isaacs/node-which.git"
9 | },
10 | "main": "which.js",
11 | "bin": "./bin/which",
12 | "license": "ISC",
13 | "dependencies": {
14 | "isexe": "^2.0.0"
15 | },
16 | "devDependencies": {
17 | "mkdirp": "^0.5.0",
18 | "rimraf": "^2.6.2",
19 | "tap": "^12.0.1"
20 | },
21 | "scripts": {
22 | "test": "tap test/*.js --cov",
23 | "changelog": "bash gen-changelog.sh",
24 | "postversion": "npm run changelog && git add CHANGELOG.md && git commit -m 'update changelog - '${npm_package_version}"
25 | },
26 | "files": [
27 | "which.js",
28 | "bin/which"
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "isexe",
3 | "version": "2.0.0",
4 | "description": "Minimal module to check if a file is executable.",
5 | "main": "index.js",
6 | "directories": {
7 | "test": "test"
8 | },
9 | "devDependencies": {
10 | "mkdirp": "^0.5.1",
11 | "rimraf": "^2.5.0",
12 | "tap": "^10.3.0"
13 | },
14 | "scripts": {
15 | "test": "tap test/*.js --100",
16 | "preversion": "npm test",
17 | "postversion": "npm publish",
18 | "postpublish": "git push origin --all; git push origin --tags"
19 | },
20 | "author": "Isaac Z. Schlueter (http://blog.izs.me/)",
21 | "license": "ISC",
22 | "repository": {
23 | "type": "git",
24 | "url": "git+https://github.com/isaacs/isexe.git"
25 | },
26 | "keywords": [],
27 | "bugs": {
28 | "url": "https://github.com/isaacs/isexe/issues"
29 | },
30 | "homepage": "https://github.com/isaacs/isexe#readme"
31 | }
32 |
--------------------------------------------------------------------------------
/src/auth.ts:
--------------------------------------------------------------------------------
1 | import { AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential, ChainedTokenCredential, EnvironmentCredential, ManagedIdentityCredential } from "@azure/identity";
2 |
3 | function createChainedTokenCredential(): ChainedTokenCredential {
4 | return new ChainedTokenCredential(
5 | new EnvironmentCredential(),
6 | new AzureCliCredential(),
7 | new ManagedIdentityCredential({ clientId: process.env.AZURE_CLIENT_ID }),
8 | new AzurePowerShellCredential({ tenantId: process.env.AZURE_TENANT_ID }),
9 | new AzureDeveloperCliCredential({ tenantId: process.env.AZURE_TENANT_ID })
10 | );
11 | }
12 |
13 | export async function getAzureCredentialAccessToken(): Promise {
14 | try {
15 | const credential = createChainedTokenCredential()
16 | const token = await credential.getToken('499b84ac-1321-427f-aa17-267ca6975798/.default', {
17 | tenantId: process.env.AZURE_TENANT_ID
18 | });
19 |
20 | return token.token;
21 | } catch (error) {
22 | throw new Error('Can not acquire a Microsoft Entra ID access token. Additional information:\n\n' + error)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/windows.js:
--------------------------------------------------------------------------------
1 | module.exports = isexe
2 | isexe.sync = sync
3 |
4 | var fs = require('fs')
5 |
6 | function checkPathExt (path, options) {
7 | var pathext = options.pathExt !== undefined ?
8 | options.pathExt : process.env.PATHEXT
9 |
10 | if (!pathext) {
11 | return true
12 | }
13 |
14 | pathext = pathext.split(';')
15 | if (pathext.indexOf('') !== -1) {
16 | return true
17 | }
18 | for (var i = 0; i < pathext.length; i++) {
19 | var p = pathext[i].toLowerCase()
20 | if (p && path.substr(-p.length).toLowerCase() === p) {
21 | return true
22 | }
23 | }
24 | return false
25 | }
26 |
27 | function checkStat (stat, path, options) {
28 | if (!stat.isSymbolicLink() && !stat.isFile()) {
29 | return false
30 | }
31 | return checkPathExt(path, options)
32 | }
33 |
34 | function isexe (path, options, cb) {
35 | fs.stat(path, function (er, stat) {
36 | cb(er, er ? false : checkStat(stat, path, options))
37 | })
38 | }
39 |
40 | function sync (path, options) {
41 | return checkStat(fs.statSync(path), path, options)
42 | }
43 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) Microsoft Corporation
3 |
4 | All rights reserved.
5 |
6 | MIT License
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
9 | files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
10 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
11 | is furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
17 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
18 | OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/mode.js:
--------------------------------------------------------------------------------
1 | module.exports = isexe
2 | isexe.sync = sync
3 |
4 | var fs = require('fs')
5 |
6 | function isexe (path, options, cb) {
7 | fs.stat(path, function (er, stat) {
8 | cb(er, er ? false : checkStat(stat, options))
9 | })
10 | }
11 |
12 | function sync (path, options) {
13 | return checkStat(fs.statSync(path), options)
14 | }
15 |
16 | function checkStat (stat, options) {
17 | return stat.isFile() && checkMode(stat, options)
18 | }
19 |
20 | function checkMode (stat, options) {
21 | var mod = stat.mode
22 | var uid = stat.uid
23 | var gid = stat.gid
24 |
25 | var myUid = options.uid !== undefined ?
26 | options.uid : process.getuid && process.getuid()
27 | var myGid = options.gid !== undefined ?
28 | options.gid : process.getgid && process.getgid()
29 |
30 | var u = parseInt('100', 8)
31 | var g = parseInt('010', 8)
32 | var o = parseInt('001', 8)
33 | var ug = u | g
34 |
35 | var ret = (mod & o) ||
36 | (mod & g) && gid === myGid ||
37 | (mod & u) && uid === myUid ||
38 | (mod & ug) && myUid === 0
39 |
40 | return ret
41 | }
42 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/bin/which:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | var which = require("../")
3 | if (process.argv.length < 3)
4 | usage()
5 |
6 | function usage () {
7 | console.error('usage: which [-as] program ...')
8 | process.exit(1)
9 | }
10 |
11 | var all = false
12 | var silent = false
13 | var dashdash = false
14 | var args = process.argv.slice(2).filter(function (arg) {
15 | if (dashdash || !/^-/.test(arg))
16 | return true
17 |
18 | if (arg === '--') {
19 | dashdash = true
20 | return false
21 | }
22 |
23 | var flags = arg.substr(1).split('')
24 | for (var f = 0; f < flags.length; f++) {
25 | var flag = flags[f]
26 | switch (flag) {
27 | case 's':
28 | silent = true
29 | break
30 | case 'a':
31 | all = true
32 | break
33 | default:
34 | console.error('which: illegal option -- ' + flag)
35 | usage()
36 | }
37 | }
38 | return false
39 | })
40 |
41 | process.exit(args.reduce(function (pv, current) {
42 | try {
43 | var f = which.sync(current, { all: all })
44 | if (all)
45 | f = f.join('\n')
46 | if (!silent)
47 | console.log(f)
48 | return pv;
49 | } catch (e) {
50 | return 1;
51 | }
52 | }, 0))
53 |
--------------------------------------------------------------------------------
/src/xml.ts:
--------------------------------------------------------------------------------
1 | import { promisify } from 'util';
2 | import { parseString } from 'xml2js';
3 |
4 | function createXMLParser(): (raw: string) => Promise {
5 | return promisify(parseString);
6 | }
7 |
8 | export type XMLManifest = {
9 | PackageManifest: {
10 | $: { Version: string; xmlns: string; 'xmlns:d': string };
11 | Metadata: {
12 | Description: { _: string }[];
13 | DisplayName: string[];
14 | Identity: { $: { Id: string; Version: string; Publisher: string; TargetPlatform?: string } }[];
15 | Tags: string[];
16 | GalleryFlags: string[];
17 | License: string[];
18 | Icon: string[];
19 | Properties: { Property: { $: { Id: string; Value: string } }[] }[];
20 | Categories: string[];
21 | Badges: { Badge: { $: { Link: string; ImgUri: string; Description: string } }[] }[];
22 | }[];
23 | Installation: { InstallationTarget: { $: { Id: string } }[] }[];
24 | Dependencies: string[];
25 | Assets: { Asset: { $: { Type: string; Path: string } }[] }[];
26 | };
27 | };
28 |
29 | export type ContentTypes = {
30 | Types: {
31 | Default: { $: { Extension: string; ContentType: string } }[];
32 | };
33 | };
34 |
35 | export const parseXmlManifest = createXMLParser();
36 | export const parseContentTypes = createXMLParser();
37 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/isexe/README.md:
--------------------------------------------------------------------------------
1 | # isexe
2 |
3 | Minimal module to check if a file is executable.
4 |
5 | Uses `fs.access` if available, and tests against the `PATHEXT`
6 | environment variable on Windows.
7 |
8 | ## USAGE
9 |
10 | ```javascript
11 | var isexe = require('isexe')
12 | isexe('some-file-name', function (err, isExe) {
13 | if (err) {
14 | console.error('probably file does not exist or something', err)
15 | } else if (isExe) {
16 | console.error('this thing can be run')
17 | } else {
18 | console.error('cannot be run')
19 | }
20 | })
21 |
22 | // same thing but synchronous, throws errors
23 | var isExe = isexe.sync('some-file-name')
24 |
25 | // treat errors as just "not executable"
26 | isexe('maybe-missing-file', { ignoreErrors: true }, callback)
27 | var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
28 | ```
29 |
30 | ## API
31 |
32 | ### `isexe(path, [options], [callback])`
33 |
34 | Check if the path is executable. If no callback provided, and a
35 | global `Promise` object is available, then a Promise will be returned.
36 |
37 | Will raise whatever errors may be raised by `fs.access` or `fs.stat`,
38 | unless `options.ignoreErrors` is set to true.
39 |
40 | ### `isexe.sync(path, [options])`
41 |
42 | Same as `isexe` but returns the value and throws any errors raised.
43 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/index.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs')
2 | var core
3 | if (process.platform === 'win32' || global.TESTING_WINDOWS) {
4 | core = require('./windows.js')
5 | } else {
6 | core = require('./mode.js')
7 | }
8 |
9 | module.exports = isexe
10 | isexe.sync = sync
11 |
12 | function isexe (path, options, cb) {
13 | if (typeof options === 'function') {
14 | cb = options
15 | options = {}
16 | }
17 |
18 | if (!cb) {
19 | if (typeof Promise !== 'function') {
20 | throw new TypeError('callback not provided')
21 | }
22 |
23 | return new Promise(function (resolve, reject) {
24 | isexe(path, options || {}, function (er, is) {
25 | if (er) {
26 | reject(er)
27 | } else {
28 | resolve(is)
29 | }
30 | })
31 | })
32 | }
33 |
34 | core(path, options || {}, function (er, is) {
35 | // ignore EACCES because that just means we aren't allowed to run it
36 | if (er) {
37 | if (er.code === 'EACCES' || options && options.ignoreErrors) {
38 | er = null
39 | is = false
40 | }
41 | }
42 | cb(er, is)
43 | })
44 | }
45 |
46 | function sync (path, options) {
47 | // my kingdom for a filtered catch
48 | try {
49 | return core.sync(path, options || {})
50 | } catch (er) {
51 | if (options && options.ignoreErrors || er.code === 'EACCES') {
52 | return false
53 | } else {
54 | throw er
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/README.md:
--------------------------------------------------------------------------------
1 | # which
2 |
3 | Like the unix `which` utility.
4 |
5 | Finds the first instance of a specified executable in the PATH
6 | environment variable. Does not cache the results, so `hash -r` is not
7 | needed when the PATH changes.
8 |
9 | ## USAGE
10 |
11 | ```javascript
12 | var which = require('which')
13 |
14 | // async usage
15 | which('node', function (er, resolvedPath) {
16 | // er is returned if no "node" is found on the PATH
17 | // if it is found, then the absolute path to the exec is returned
18 | })
19 |
20 | // sync usage
21 | // throws if not found
22 | var resolved = which.sync('node')
23 |
24 | // if nothrow option is used, returns null if not found
25 | resolved = which.sync('node', {nothrow: true})
26 |
27 | // Pass options to override the PATH and PATHEXT environment vars.
28 | which('node', { path: someOtherPath }, function (er, resolved) {
29 | if (er)
30 | throw er
31 | console.log('found at %j', resolved)
32 | })
33 | ```
34 |
35 | ## CLI USAGE
36 |
37 | Same as the BSD `which(1)` binary.
38 |
39 | ```
40 | usage: which [-as] program ...
41 | ```
42 |
43 | ## OPTIONS
44 |
45 | You may pass an options object as the second argument.
46 |
47 | - `path`: Use instead of the `PATH` environment variable.
48 | - `pathExt`: Use instead of the `PATHEXT` environment variable.
49 | - `all`: Return all matches, instead of just the first one. Note that
50 | this means the function returns an array of strings instead of a
51 | single string.
52 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/isexe/index.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs')
2 | var core
3 | if (process.platform === 'win32' || global.TESTING_WINDOWS) {
4 | core = require('./windows.js')
5 | } else if (typeof fs.access === 'function') {
6 | core = require('./access.js')
7 | } else {
8 | core = require('./mode.js')
9 | }
10 |
11 | module.exports = isexe
12 | isexe.sync = sync
13 |
14 | function isexe (path, options, cb) {
15 | if (typeof options === 'function') {
16 | cb = options
17 | options = {}
18 | }
19 |
20 | if (!cb) {
21 | if (typeof Promise !== 'function') {
22 | throw new TypeError('callback not provided')
23 | }
24 |
25 | return new Promise(function (resolve, reject) {
26 | isexe(path, options, function (er, is) {
27 | if (er) {
28 | reject(er)
29 | } else {
30 | resolve(is)
31 | }
32 | })
33 | })
34 | }
35 |
36 | core(path, function (er, is) {
37 | // ignore EACCES because that just means we aren't allowed to run it
38 | if (er) {
39 | if (er.code === 'EACCES' || options && options.ignoreErrors) {
40 | er = null
41 | is = false
42 | }
43 | }
44 | cb(er, is)
45 | })
46 | }
47 |
48 | function sync (path, options) {
49 | // my kingdom for a filtered catch
50 | try {
51 | return core.sync(path)
52 | } catch (er) {
53 | if (options && options.ignoreErrors || er.code === 'EACCES') {
54 | return false
55 | } else {
56 | throw er
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/README.md:
--------------------------------------------------------------------------------
1 | # isexe
2 |
3 | Minimal module to check if a file is executable, and a normal file.
4 |
5 | Uses `fs.stat` and tests against the `PATHEXT` environment variable on
6 | Windows.
7 |
8 | ## USAGE
9 |
10 | ```javascript
11 | var isexe = require('isexe')
12 | isexe('some-file-name', function (err, isExe) {
13 | if (err) {
14 | console.error('probably file does not exist or something', err)
15 | } else if (isExe) {
16 | console.error('this thing can be run')
17 | } else {
18 | console.error('cannot be run')
19 | }
20 | })
21 |
22 | // same thing but synchronous, throws errors
23 | var isExe = isexe.sync('some-file-name')
24 |
25 | // treat errors as just "not executable"
26 | isexe('maybe-missing-file', { ignoreErrors: true }, callback)
27 | var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
28 | ```
29 |
30 | ## API
31 |
32 | ### `isexe(path, [options], [callback])`
33 |
34 | Check if the path is executable. If no callback provided, and a
35 | global `Promise` object is available, then a Promise will be returned.
36 |
37 | Will raise whatever errors may be raised by `fs.stat`, unless
38 | `options.ignoreErrors` is set to true.
39 |
40 | ### `isexe.sync(path, [options])`
41 |
42 | Same as `isexe` but returns the value and throws any errors raised.
43 |
44 | ### Options
45 |
46 | * `ignoreErrors` Treat all errors as "no, this is not executable", but
47 | don't raise them.
48 | * `uid` Number to use as the user id
49 | * `gid` Number to use as the group id
50 | * `pathExt` List of path extensions to use instead of `PATHEXT`
51 | environment variable on Windows.
52 |
--------------------------------------------------------------------------------
/src/test/fixtures/readme/readme.md:
--------------------------------------------------------------------------------
1 | # README
2 |
3 | >**Important:** Once installed the checker will only update if you add the setting `"spellMD.enable": true` to your `.vscode\settings.json` file.
4 |
5 | This README covers off:
6 | * [Functionality](#functionality)
7 | * [Install](#install)
8 | * [Run and Configure](#run-and-configure)
9 | * [Known Issues/Bugs](#known-issuesbugs)
10 | * [Backlog](#backlog)
11 | * [How to Debug](#how-to-debug)
12 |
13 | # Functionality
14 |
15 | Load up a Markdown file and get highlights and hovers for existing issues. Checking will occur as you type in the document.
16 |
17 | 
18 |
19 | The status bar lets you quickly navigate to any issue and you can see all positions in the gutter.
20 |
21 | [](http://shouldnottouchthis/)
22 | [](monkey)
23 | 
24 | 
25 | 
26 |
27 |
28 |
29 |
30 |
31 | The `spellMD.json` config file is watched so you can add more ignores or change mappings at will.
32 |
33 | 
34 |
35 | 
36 |
37 | [mono](monkey)
38 | [not](http://shouldnottouchthis/)
39 | [Email me](mailto:example@example.com)
40 |
41 | # Install
42 | This extension is published in the VS Code Gallery. So simply hit 'F1' and type 'ext inst' from there select `SpellMD` and follow instructions.
43 |
44 |
45 | To clone the extension and load locally...
46 |
47 | ```
48 | git clone https://github.com/Microsoft/vscode-SpellMD.git
49 | npm install
50 | tsc
51 | ```
52 |
53 | >**Note:** TypeScript 1.6 or higher is required you can check with `tsc -v` and if you need to upgrade then run `npm install -g typescript`.
54 |
--------------------------------------------------------------------------------
/src/test/fixtures/readme/readme.branch.override.content.expected.md:
--------------------------------------------------------------------------------
1 | # README
2 |
3 | >**Important:** Once installed the checker will only update if you add the setting `"spellMD.enable": true` to your `.vscode\settings.json` file.
4 |
5 | This README covers off:
6 | * [Functionality](#functionality)
7 | * [Install](#install)
8 | * [Run and Configure](#run-and-configure)
9 | * [Known Issues/Bugs](#known-issuesbugs)
10 | * [Backlog](#backlog)
11 | * [How to Debug](#how-to-debug)
12 |
13 | # Functionality
14 |
15 | Load up a Markdown file and get highlights and hovers for existing issues. Checking will occur as you type in the document.
16 |
17 | 
18 |
19 | The status bar lets you quickly navigate to any issue and you can see all positions in the gutter.
20 |
21 | [](http://shouldnottouchthis/)
22 | [](https://github.com/base/monkey)
23 | 
24 | 
25 | 
26 |
27 |
28 |
29 |
30 |
31 | The `spellMD.json` config file is watched so you can add more ignores or change mappings at will.
32 |
33 | 
34 |
35 | 
36 |
37 | [mono](https://github.com/base/monkey)
38 | [not](http://shouldnottouchthis/)
39 | [Email me](mailto:example@example.com)
40 |
41 | # Install
42 | This extension is published in the VS Code Gallery. So simply hit 'F1' and type 'ext inst' from there select `SpellMD` and follow instructions.
43 |
44 |
45 | To clone the extension and load locally...
46 |
47 | ```
48 | git clone https://github.com/Microsoft/vscode-SpellMD.git
49 | npm install
50 | tsc
51 | ```
52 |
53 | >**Note:** TypeScript 1.6 or higher is required you can check with `tsc -v` and if you need to upgrade then run `npm install -g typescript`.
54 |
--------------------------------------------------------------------------------
/src/test/fixtures/readme/readme.gitlab.branch.override.content.expected.md:
--------------------------------------------------------------------------------
1 | # README
2 |
3 | >**Important:** Once installed the checker will only update if you add the setting `"spellMD.enable": true` to your `.vscode\settings.json` file.
4 |
5 | This README covers off:
6 | * [Functionality](#functionality)
7 | * [Install](#install)
8 | * [Run and Configure](#run-and-configure)
9 | * [Known Issues/Bugs](#known-issuesbugs)
10 | * [Backlog](#backlog)
11 | * [How to Debug](#how-to-debug)
12 |
13 | # Functionality
14 |
15 | Load up a Markdown file and get highlights and hovers for existing issues. Checking will occur as you type in the document.
16 |
17 | 
18 |
19 | The status bar lets you quickly navigate to any issue and you can see all positions in the gutter.
20 |
21 | [](http://shouldnottouchthis/)
22 | [](https://gitlab.com/base/monkey)
23 | 
24 | 
25 | 
26 |
27 |
28 |
29 |
30 |
31 | The `spellMD.json` config file is watched so you can add more ignores or change mappings at will.
32 |
33 | 
34 |
35 | 
36 |
37 | [mono](https://gitlab.com/base/monkey)
38 | [not](http://shouldnottouchthis/)
39 | [Email me](mailto:example@example.com)
40 |
41 | # Install
42 | This extension is published in the VS Code Gallery. So simply hit 'F1' and type 'ext inst' from there select `SpellMD` and follow instructions.
43 |
44 |
45 | To clone the extension and load locally...
46 |
47 | ```
48 | git clone https://github.com/Microsoft/vscode-SpellMD.git
49 | npm install
50 | tsc
51 | ```
52 |
53 | >**Note:** TypeScript 1.6 or higher is required you can check with `tsc -v` and if you need to upgrade then run `npm install -g typescript`.
54 |
--------------------------------------------------------------------------------
/src/test/fixtures/readme/readme.branch.override.images.expected.md:
--------------------------------------------------------------------------------
1 | # README
2 |
3 | >**Important:** Once installed the checker will only update if you add the setting `"spellMD.enable": true` to your `.vscode\settings.json` file.
4 |
5 | This README covers off:
6 | * [Functionality](#functionality)
7 | * [Install](#install)
8 | * [Run and Configure](#run-and-configure)
9 | * [Known Issues/Bugs](#known-issuesbugs)
10 | * [Backlog](#backlog)
11 | * [How to Debug](#how-to-debug)
12 |
13 | # Functionality
14 |
15 | Load up a Markdown file and get highlights and hovers for existing issues. Checking will occur as you type in the document.
16 |
17 | 
18 |
19 | The status bar lets you quickly navigate to any issue and you can see all positions in the gutter.
20 |
21 | [](http://shouldnottouchthis/)
22 | [](https://github.com/username/repository/blob/main/monkey)
23 | 
24 | 
25 | 
26 |
27 |
28 |
29 |
30 |
31 | The `spellMD.json` config file is watched so you can add more ignores or change mappings at will.
32 |
33 | 
34 |
35 | 
36 |
37 | [mono](https://github.com/username/repository/blob/main/monkey)
38 | [not](http://shouldnottouchthis/)
39 | [Email me](mailto:example@example.com)
40 |
41 | # Install
42 | This extension is published in the VS Code Gallery. So simply hit 'F1' and type 'ext inst' from there select `SpellMD` and follow instructions.
43 |
44 |
45 | To clone the extension and load locally...
46 |
47 | ```
48 | git clone https://github.com/Microsoft/vscode-SpellMD.git
49 | npm install
50 | tsc
51 | ```
52 |
53 | >**Note:** TypeScript 1.6 or higher is required you can check with `tsc -v` and if you need to upgrade then run `npm install -g typescript`.
54 |
--------------------------------------------------------------------------------
/src/test/fixtures/readme/readme.gitlab.branch.override.images.expected.md:
--------------------------------------------------------------------------------
1 | # README
2 |
3 | >**Important:** Once installed the checker will only update if you add the setting `"spellMD.enable": true` to your `.vscode\settings.json` file.
4 |
5 | This README covers off:
6 | * [Functionality](#functionality)
7 | * [Install](#install)
8 | * [Run and Configure](#run-and-configure)
9 | * [Known Issues/Bugs](#known-issuesbugs)
10 | * [Backlog](#backlog)
11 | * [How to Debug](#how-to-debug)
12 |
13 | # Functionality
14 |
15 | Load up a Markdown file and get highlights and hovers for existing issues. Checking will occur as you type in the document.
16 |
17 | 
18 |
19 | The status bar lets you quickly navigate to any issue and you can see all positions in the gutter.
20 |
21 | [](http://shouldnottouchthis/)
22 | [](https://gitlab.com/username/repository/-/blob/main/monkey)
23 | 
24 | 
25 | 
26 |
27 |
28 |
29 |
30 |
31 | The `spellMD.json` config file is watched so you can add more ignores or change mappings at will.
32 |
33 | 
34 |
35 | 
36 |
37 | [mono](https://gitlab.com/username/repository/-/blob/main/monkey)
38 | [not](http://shouldnottouchthis/)
39 | [Email me](mailto:example@example.com)
40 |
41 | # Install
42 | This extension is published in the VS Code Gallery. So simply hit 'F1' and type 'ext inst' from there select `SpellMD` and follow instructions.
43 |
44 |
45 | To clone the extension and load locally...
46 |
47 | ```
48 | git clone https://github.com/Microsoft/vscode-SpellMD.git
49 | npm install
50 | tsc
51 | ```
52 |
53 | >**Note:** TypeScript 1.6 or higher is required you can check with `tsc -v` and if you need to upgrade then run `npm install -g typescript`.
54 |
--------------------------------------------------------------------------------
/src/publicgalleryapi.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient, HttpClientResponse } from 'typed-rest-client/HttpClient';
2 | import {
3 | PublishedExtension,
4 | ExtensionQueryFlags,
5 | FilterCriteria,
6 | ExtensionQueryFilterType,
7 | TypeInfo,
8 | } from 'azure-devops-node-api/interfaces/GalleryInterfaces';
9 | import { IHeaders } from 'azure-devops-node-api/interfaces/common/VsoBaseInterfaces';
10 | import { ContractSerializer } from 'azure-devops-node-api/Serialization';
11 |
12 | export interface ExtensionQuery {
13 | readonly pageNumber?: number;
14 | readonly pageSize?: number;
15 | readonly flags?: ExtensionQueryFlags[];
16 | readonly criteria?: FilterCriteria[];
17 | readonly assetTypes?: string[];
18 | }
19 |
20 | interface VSCodePublishedExtension extends PublishedExtension {
21 | publisher: { displayName: string; publisherName: string };
22 | }
23 |
24 | export class PublicGalleryAPI {
25 | private readonly client = new HttpClient('vsce');
26 |
27 | constructor(private baseUrl: string, private apiVersion = '3.0-preview.1') {}
28 |
29 | private post(url: string, data: string, additionalHeaders?: IHeaders): Promise {
30 | return this.client.post(`${this.baseUrl}/_apis/public${url}`, data, additionalHeaders);
31 | }
32 |
33 | async extensionQuery({
34 | pageNumber = 1,
35 | pageSize = 1,
36 | flags = [],
37 | criteria = [],
38 | assetTypes = [],
39 | }: ExtensionQuery): Promise {
40 | const data = JSON.stringify({
41 | filters: [{ pageNumber, pageSize, criteria }],
42 | assetTypes,
43 | flags: flags.reduce((memo, flag) => memo | flag, 0),
44 | });
45 |
46 | const res = await this.post('/gallery/extensionquery', data, {
47 | Accept: `application/json;api-version=${this.apiVersion}`,
48 | 'Content-Type': 'application/json',
49 | });
50 | const raw = JSON.parse(await res.readBody());
51 |
52 | if (raw.errorCode !== undefined) {
53 | throw new Error(raw.message);
54 | }
55 |
56 | return ContractSerializer.deserialize(raw.results[0].extensions, TypeInfo.PublishedExtension, false, false);
57 | }
58 |
59 | async getExtension(extensionId: string, flags: ExtensionQueryFlags[] = []): Promise {
60 | const query = { criteria: [{ filterType: ExtensionQueryFilterType.Name, value: extensionId }], flags };
61 | const extensions = await this.extensionQuery(query);
62 | return extensions.filter(
63 | ({ publisher: { publisherName: publisher }, extensionName: name }) =>
64 | extensionId.toLowerCase() === `${publisher}.${name}`.toLowerCase()
65 | )[0];
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/zip.ts:
--------------------------------------------------------------------------------
1 | import { Entry, open, ZipFile } from 'yauzl';
2 | import { ManifestPackage, UnverifiedManifest } from './manifest';
3 | import { parseXmlManifest, XMLManifest } from './xml';
4 | import { Readable } from 'stream';
5 | import { filePathToVsixPath } from './util';
6 | import { validateManifestForPackaging } from './package';
7 |
8 | async function bufferStream(stream: Readable): Promise {
9 | return await new Promise((c, e) => {
10 | const buffers: Buffer[] = [];
11 | stream.on('data', buffer => buffers.push(buffer));
12 | stream.once('error', e);
13 | stream.once('end', () => c(Buffer.concat(buffers)));
14 | });
15 | }
16 |
17 | export async function readZip(packagePath: string, filter: (name: string) => boolean): Promise