Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RSC-based static site generator #10057

Merged
merged 8 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Apply source field only in development parcel builds
  • Loading branch information
devongovett committed Dec 24, 2024
commit 2d91920cd972c7ba147cc9ffedbb32e353753c2f
4 changes: 1 addition & 3 deletions crates/parcel-resolver/src/package_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,7 @@ impl PackageJson {
for (key, value) in target {
let matches = match key {
ExportsKey::Condition(key) => {
*key == ExportsCondition::SOURCE
|| *key == ExportsCondition::DEFAULT
|| conditions.contains(*key)
*key == ExportsCondition::DEFAULT || conditions.contains(*key)
}
ExportsKey::CustomCondition(key) => custom_conditions.iter().any(|k| k == key),
_ => false,
Expand Down
7 changes: 7 additions & 0 deletions packages/core/package-manager/src/NodePackageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,19 @@ import {transformSync} from '@swc/core';
// Package.json fields. Must match package_json.rs.
const MAIN = 1 << 0;
const SOURCE = 1 << 2;
const SOURCE_CONDITION = 1 << 17;
const ENTRIES =
MAIN |
(process.env.PARCEL_BUILD_ENV !== 'production' ||
process.env.PARCEL_SELF_BUILD
? SOURCE
: 0);

const CONDITIONS =
process.env.PARCEL_BUILD_ENV !== 'production' || process.env.PARCEL_SELF_BUILD
? SOURCE_CONDITION
: 0;

const NODE_MODULES = `${path.sep}node_modules${path.sep}`;

const IS_FILE = 1 << 0;
Expand Down Expand Up @@ -111,6 +117,7 @@ export class NodePackageManager implements PackageManager {
},
mode: 2,
entries: ENTRIES,
conditions: CONDITIONS,
packageExports: true,
moduleDirResolver:
process.versions.pnp != null
Expand Down
3 changes: 3 additions & 0 deletions packages/dev/babel-register/babel-plugin-module-translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ function resolveSource(specifier, from) {
if (pkg.source) {
pkg.main = pkg.source;
}
if (pkg.exports?.source) {
pkg.main = pkg.exports.source;
}
}
return pkg;
},
Expand Down
3 changes: 2 additions & 1 deletion packages/utils/node-resolver-core/src/Wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,9 @@ function environmentToExportsConditions(
const DEVELOPMENT = 1 << 8;
const PRODUCTION = 1 << 9;
const REACT_SERVER = 1 << 16;
const SOURCE = 1 << 17;

let conditions = 0;
let conditions = SOURCE;
if (env.isBrowser()) {
conditions |= BROWSER;
}
Expand Down
Loading