Socket
Socket
Sign inDemoInstall

@ms-cloudpack/path-utilities

Package Overview
Dependencies
Maintainers
2
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ms-cloudpack/path-utilities - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

17

CHANGELOG.json

@@ -5,3 +5,18 @@ {

{
"date": "Tue, 06 Sep 2022 08:17:22 GMT",
"date": "Wed, 21 Sep 2022 08:14:52 GMT",
"tag": "@ms-cloudpack/path-utilities_v0.5.0",
"version": "0.5.0",
"comments": {
"minor": [
{
"author": "dzearing@microsoft.com",
"package": "@ms-cloudpack/path-utilities",
"commit": "2150233441f0689a0362e4e73fdeed5bd8d8167d",
"comment": "Path utilities should return relative paths which always start with \"./\" leading periods."
}
]
}
},
{
"date": "Tue, 06 Sep 2022 08:17:50 GMT",
"tag": "@ms-cloudpack/path-utilities_v0.4.0",

@@ -8,0 +23,0 @@ "version": "0.4.0",

# Change Log - @ms-cloudpack/path-utilities
This log was last generated on Tue, 06 Sep 2022 08:17:22 GMT and should not be manually modified.
This log was last generated on Wed, 21 Sep 2022 08:14:52 GMT and should not be manually modified.
<!-- Start content -->
## 0.5.0
Wed, 21 Sep 2022 08:14:52 GMT
### Minor changes
- Path utilities should return relative paths which always start with "./" leading periods. (dzearing@microsoft.com)
## 0.4.0
Tue, 06 Sep 2022 08:17:22 GMT
Tue, 06 Sep 2022 08:17:50 GMT

@@ -11,0 +19,0 @@ ### Minor changes

2

lib/intermediateToSourcePath.js

@@ -37,3 +37,3 @@ import path from 'path';

// Re-add the leading period.
if (match && parts[0] === '.' && !match.startsWith('./')) {
if (match && !match.startsWith('./')) {
match = './' + match;

@@ -40,0 +40,0 @@ }

@@ -8,12 +8,12 @@ import { describe, it, expect } from '@jest/globals';

it('can resolve a .js', () => {
expect(intermediateToSourcePath('lib/js.js', testPath)).toEqual('src/js.js');
expect(intermediateToSourcePath('lib/js.js', testPath)).toEqual('./src/js.js');
});
it('can resolve a .jsx', () => {
expect(intermediateToSourcePath('lib/jsx.js', testPath)).toEqual('src/jsx.jsx');
expect(intermediateToSourcePath('lib/jsx.js', testPath)).toEqual('./src/jsx.jsx');
});
it('can resolve a .ts', () => {
expect(intermediateToSourcePath('lib/ts.js', testPath)).toEqual('src/ts.ts');
expect(intermediateToSourcePath('lib/ts.js', testPath)).toEqual('./src/ts.ts');
});
it('can resolve a .ts from the src path', () => {
expect(intermediateToSourcePath('src/ts', testPath)).toEqual('src/ts.ts');
expect(intermediateToSourcePath('src/ts', testPath)).toEqual('./src/ts.ts');
});

@@ -24,12 +24,12 @@ it('can preserve a leading period when translating to a .ts from the src path', () => {

it('can resolve a .tsx', () => {
expect(intermediateToSourcePath('lib/tsx.js', testPath)).toEqual('src/tsx.tsx');
expect(intermediateToSourcePath('lib/tsx.js', testPath)).toEqual('./src/tsx.tsx');
});
it('can resolve a .mts', () => {
expect(intermediateToSourcePath('lib/mts.mjs', testPath)).toEqual('src/mts.mts');
expect(intermediateToSourcePath('lib/mts.mjs', testPath)).toEqual('./src/mts.mts');
});
it('can resolve .scss files', () => {
expect(intermediateToSourcePath('lib/scss.scss.js', testPath)).toEqual('src/scss.scss');
expect(intermediateToSourcePath('lib/scss.scss.js', testPath)).toEqual('./src/scss.scss');
});
it('can resolve non-js files', () => {
expect(intermediateToSourcePath('lib/png.png', testPath)).toEqual('src/png.png');
expect(intermediateToSourcePath('lib/png.png', testPath)).toEqual('./src/png.png');
});

@@ -36,0 +36,0 @@ it('returns undefined for missing source files', () => {

@@ -11,2 +11,5 @@ import path from 'path';

const pathParts = slash(path.dirname(sourcePath)).split('/');
if (pathParts[0] === '.') {
pathParts.shift();
}
if (pathParts[0] === 'src') {

@@ -26,4 +29,4 @@ pathParts[0] = 'lib';

}
return slash(path.join(...pathParts, basename + ext));
return './' + slash(path.join(...pathParts, basename + ext));
}
//# sourceMappingURL=sourceToIntermediatePath.js.map

@@ -5,26 +5,29 @@ import { describe, it, expect } from '@jest/globals';

it('can resolve a .js', () => {
expect(sourceToIntermediatePath('src/js.js')).toEqual('lib/js.js');
expect(sourceToIntermediatePath('src/js.js')).toEqual('./lib/js.js');
});
it('can resolve a .jsx', () => {
expect(sourceToIntermediatePath('src/jsx.jsx')).toEqual('lib/jsx.js');
expect(sourceToIntermediatePath('src/jsx.jsx')).toEqual('./lib/jsx.js');
});
it('can resolve a .ts', () => {
expect(sourceToIntermediatePath('src/ts.ts')).toEqual('lib/ts.js');
expect(sourceToIntermediatePath('src/ts.ts')).toEqual('./lib/ts.js');
});
it('can resolve a .ts with a leading period', () => {
expect(sourceToIntermediatePath('./src/ts.ts')).toEqual('./lib/ts.js');
});
it('can resolve a .tsx', () => {
expect(sourceToIntermediatePath('src/tsx.tsx')).toEqual('lib/tsx.js');
expect(sourceToIntermediatePath('src/tsx.tsx')).toEqual('./lib/tsx.js');
});
it('can resolve a .mts', () => {
expect(sourceToIntermediatePath('src/mts.mts')).toEqual('lib/mts.mjs');
expect(sourceToIntermediatePath('src/mts.mts')).toEqual('./lib/mts.mjs');
});
it('can resolve .mjs files', () => {
expect(sourceToIntermediatePath('src/mjs.mjs')).toEqual('lib/mjs.mjs');
expect(sourceToIntermediatePath('src/mjs.mjs')).toEqual('./lib/mjs.mjs');
});
it('can resolve non-js files', () => {
expect(sourceToIntermediatePath('src/png.png')).toEqual('lib/png.png');
expect(sourceToIntermediatePath('src/png.png')).toEqual('./lib/png.png');
});
it('can fall back tot he original path', () => {
expect(sourceToIntermediatePath('lib/dne.mjs')).toEqual('lib/dne.mjs');
expect(sourceToIntermediatePath('lib/dne.mjs')).toEqual('./lib/dne.mjs');
});
});
//# sourceMappingURL=sourceToIntermediatePath.test.js.map

@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.

"packageName": "@microsoft/api-extractor",
"packageVersion": "7.30.0"
"packageVersion": "7.31.1"
}
]
}
{
"name": "@ms-cloudpack/path-utilities",
"version": "0.4.0",
"version": "0.5.0",
"description": "Utilities for resolving paths between source/intermediate/output locations in Cloudpack.",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc