Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/silent-ears-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@atlaspack/feature-flags': patch
'@atlaspack/core': patch
---

Clean-up patch project paths feature-flag
17 changes: 3 additions & 14 deletions packages/core/core/src/projectPath.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// @flow strict-local
import type {FilePath} from '@atlaspack/types';
import path from 'path';
import {relativePath, normalizeSeparators} from '@atlaspack/utils';
import {getFeatureFlagValue} from '@atlaspack/feature-flags';
import {relativePath} from '@atlaspack/utils';

/**
* A path that's relative to the project root.
Expand Down Expand Up @@ -30,19 +29,9 @@ function toProjectPath_(projectRoot: FilePath, p: FilePath): ProjectPath {
return p;
}

// If the file is outside the project root, store an absolute path rather than a relative one.
// This way if the project root is moved, the file references still work. Accessing files outside
// the project root is not portable anyway.
// If the file is outside the project root, we store a relative path.
// Relative paths make the cache portable across machines.
let relative = relativePath(projectRoot, p, false);
if (relative.startsWith('..')) {
// e.g given projectRoot = '/Users/monorepo/project' and p = '/Users/monorepo/other-project/src/index.js' --> relative = '../other-project/src/index.js'
if (getFeatureFlagValue('patchProjectPaths')) {
return relative;
}

return process.platform === 'win32' ? normalizeSeparators(p) : p;
}

return relative;
}

Expand Down
1 change: 0 additions & 1 deletion packages/core/feature-flags/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const DEFAULT_FEATURE_FLAGS: FeatureFlags = {
reduceResolverStringCreation: false,
inlineBundlesSourceMapFixes: false,
conditionalBundlingNestedRuntime: false,
patchProjectPaths: false,
cachePerformanceImprovements: process.env.NODE_ENV === 'test',
environmentDeduplication: false,
inlineStringReplacementPerf: false,
Expand Down
4 changes: 0 additions & 4 deletions packages/core/feature-flags/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ export type FeatureFlags = {|
* Enable nested loading of bundles in the runtime with conditional bundling
*/
conditionalBundlingNestedRuntime: boolean,
/** Enable patch project paths. This will patch the project paths to be relative to the project root.
* This feature is experimental and should not be used in production. It will used to test downloadble cache artefacts.
*/
patchProjectPaths: boolean,
/**
* Enables optimized inline string replacement perf for the packager.
* Used heavily for inline bundles.
Expand Down
Loading