@atlaspack/core 2.12.1-canary.3452 → 2.12.1-canary.3453
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/projectPath.js +12 -4
- package/package.json +16 -16
- package/src/projectPath.js +12 -4
- package/test/requests/ConfigRequest.test.js +1 -4
package/lib/projectPath.js
CHANGED
|
@@ -27,14 +27,22 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
27
|
* A path that's relative to the project root.
|
|
28
28
|
*/
|
|
29
29
|
function toProjectPath_(projectRoot, p) {
|
|
30
|
+
// If the file path is not provided, then treat it as though it is already from the project root
|
|
30
31
|
if (p == null) {
|
|
31
32
|
return p;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
// If the file is
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
35
|
+
// If the file path is already relative and it does not begin with . then treat the path as if it
|
|
36
|
+
// is already from the project root. This prevents relative paths from being processed twice,
|
|
37
|
+
// most often within `toInternalSourceLocation` when handling loc types from symbols and asset
|
|
38
|
+
// dependencies.
|
|
39
|
+
if (p[0] !== '.' && !_path().default.isAbsolute(p)) {
|
|
40
|
+
return p;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// If the file is outside the project root, store an absolute path rather than a relative one.
|
|
44
|
+
// This way if the project root is moved, the file references still work. Accessing files outside
|
|
45
|
+
// the project root is not portable anyway.
|
|
38
46
|
let relative = (0, _utils().relativePath)(projectRoot, p, false);
|
|
39
47
|
if (relative.startsWith('..')) {
|
|
40
48
|
return process.platform === 'win32' ? (0, _utils().normalizeSeparators)(p) : p;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.12.1-canary.
|
|
3
|
+
"version": "2.12.1-canary.3453+2e948732f",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
"check-ts": "tsc --noEmit index.d.ts"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@atlaspack/cache": "2.12.1-canary.
|
|
24
|
-
"@atlaspack/diagnostic": "2.12.1-canary.
|
|
25
|
-
"@atlaspack/events": "2.12.1-canary.
|
|
26
|
-
"@atlaspack/feature-flags": "2.12.1-canary.
|
|
27
|
-
"@atlaspack/fs": "2.12.1-canary.
|
|
28
|
-
"@atlaspack/graph": "3.2.1-canary.
|
|
29
|
-
"@atlaspack/logger": "2.12.1-canary.
|
|
30
|
-
"@atlaspack/package-manager": "2.12.1-canary.
|
|
31
|
-
"@atlaspack/plugin": "2.12.1-canary.
|
|
32
|
-
"@atlaspack/profiler": "2.12.1-canary.
|
|
33
|
-
"@atlaspack/rust": "2.12.1-canary.
|
|
34
|
-
"@atlaspack/types": "2.12.1-canary.
|
|
35
|
-
"@atlaspack/utils": "2.12.1-canary.
|
|
36
|
-
"@atlaspack/workers": "2.12.1-canary.
|
|
23
|
+
"@atlaspack/cache": "2.12.1-canary.3453+2e948732f",
|
|
24
|
+
"@atlaspack/diagnostic": "2.12.1-canary.3453+2e948732f",
|
|
25
|
+
"@atlaspack/events": "2.12.1-canary.3453+2e948732f",
|
|
26
|
+
"@atlaspack/feature-flags": "2.12.1-canary.3453+2e948732f",
|
|
27
|
+
"@atlaspack/fs": "2.12.1-canary.3453+2e948732f",
|
|
28
|
+
"@atlaspack/graph": "3.2.1-canary.3453+2e948732f",
|
|
29
|
+
"@atlaspack/logger": "2.12.1-canary.3453+2e948732f",
|
|
30
|
+
"@atlaspack/package-manager": "2.12.1-canary.3453+2e948732f",
|
|
31
|
+
"@atlaspack/plugin": "2.12.1-canary.3453+2e948732f",
|
|
32
|
+
"@atlaspack/profiler": "2.12.1-canary.3453+2e948732f",
|
|
33
|
+
"@atlaspack/rust": "2.12.1-canary.3453+2e948732f",
|
|
34
|
+
"@atlaspack/types": "2.12.1-canary.3453+2e948732f",
|
|
35
|
+
"@atlaspack/utils": "2.12.1-canary.3453+2e948732f",
|
|
36
|
+
"@atlaspack/workers": "2.12.1-canary.3453+2e948732f",
|
|
37
37
|
"@mischnic/json-sourcemap": "^0.1.0",
|
|
38
38
|
"@parcel/source-map": "^2.1.1",
|
|
39
39
|
"base-x": "^3.0.8",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"browser": {
|
|
58
58
|
"./src/serializerCore.js": "./src/serializerCore.browser.js"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "2e948732f6d21e3b940160b8f6b4d56f198fca1c"
|
|
61
61
|
}
|
package/src/projectPath.js
CHANGED
|
@@ -9,14 +9,22 @@ import {relativePath, normalizeSeparators} from '@atlaspack/utils';
|
|
|
9
9
|
export opaque type ProjectPath = string;
|
|
10
10
|
|
|
11
11
|
function toProjectPath_(projectRoot: FilePath, p: FilePath): ProjectPath {
|
|
12
|
+
// If the file path is not provided, then treat it as though it is already from the project root
|
|
12
13
|
if (p == null) {
|
|
13
14
|
return p;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
// If the file is
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
17
|
+
// If the file path is already relative and it does not begin with . then treat the path as if it
|
|
18
|
+
// is already from the project root. This prevents relative paths from being processed twice,
|
|
19
|
+
// most often within `toInternalSourceLocation` when handling loc types from symbols and asset
|
|
20
|
+
// dependencies.
|
|
21
|
+
if (p[0] !== '.' && !path.isAbsolute(p)) {
|
|
22
|
+
return p;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// If the file is outside the project root, store an absolute path rather than a relative one.
|
|
26
|
+
// This way if the project root is moved, the file references still work. Accessing files outside
|
|
27
|
+
// the project root is not portable anyway.
|
|
20
28
|
let relative = relativePath(projectRoot, p, false);
|
|
21
29
|
if (relative.startsWith('..')) {
|
|
22
30
|
return process.platform === 'win32' ? normalizeSeparators(p) : p;
|
|
@@ -229,10 +229,7 @@ describe('ConfigRequest tests', () => {
|
|
|
229
229
|
invalidateOnConfigKeyChange: [
|
|
230
230
|
{
|
|
231
231
|
configKey: 'key1',
|
|
232
|
-
filePath: toProjectPath(
|
|
233
|
-
projectRoot,
|
|
234
|
-
path.join('project_root', 'config.json'),
|
|
235
|
-
),
|
|
232
|
+
filePath: toProjectPath(projectRoot, 'config.json'),
|
|
236
233
|
},
|
|
237
234
|
],
|
|
238
235
|
});
|