Skip to content

Commit

Permalink
fix(core): fix wasm build (#27830)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

wasm build is broken, blocking releases.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

wasm build is not broken.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
  • Loading branch information
FrozenPandaz authored Sep 9, 2024
1 parent e768de6 commit d47d41c
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 100 deletions.
102 changes: 53 additions & 49 deletions packages/nx/src/native/nx.wasi-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,55 +51,57 @@ const {
})

function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__expand_outputs_0']?.()
__napiInstance.exports['__napi_register__get_files_for_outputs_1']?.()
__napiInstance.exports['__napi_register__remove_2']?.()
__napiInstance.exports['__napi_register__copy_3']?.()
__napiInstance.exports['__napi_register__CachedResult_struct_4']?.()
__napiInstance.exports['__napi_register__NxCache_struct_5']?.()
__napiInstance.exports['__napi_register__NxCache_impl_13']?.()
__napiInstance.exports['__napi_register__hash_array_14']?.()
__napiInstance.exports['__napi_register__hash_file_15']?.()
__napiInstance.exports['__napi_register__IS_WASM_16']?.()
__napiInstance.exports['__napi_register__get_binary_target_17']?.()
__napiInstance.exports['__napi_register__ImportResult_struct_18']?.()
__napiInstance.exports['__napi_register__find_imports_19']?.()
__napiInstance.exports['__napi_register__transfer_project_graph_20']?.()
__napiInstance.exports['__napi_register__ExternalNode_struct_21']?.()
__napiInstance.exports['__napi_register__Target_struct_22']?.()
__napiInstance.exports['__napi_register__Project_struct_23']?.()
__napiInstance.exports['__napi_register__ProjectGraph_struct_24']?.()
__napiInstance.exports['__napi_register__HashedTask_struct_25']?.()
__napiInstance.exports['__napi_register__TaskDetails_struct_26']?.()
__napiInstance.exports['__napi_register__TaskDetails_impl_29']?.()
__napiInstance.exports['__napi_register__HashPlanner_struct_30']?.()
__napiInstance.exports['__napi_register__HashPlanner_impl_34']?.()
__napiInstance.exports['__napi_register__HashDetails_struct_35']?.()
__napiInstance.exports['__napi_register__HasherOptions_struct_36']?.()
__napiInstance.exports['__napi_register__TaskHasher_struct_37']?.()
__napiInstance.exports['__napi_register__TaskHasher_impl_40']?.()
__napiInstance.exports['__napi_register__TaskRun_struct_41']?.()
__napiInstance.exports['__napi_register__NxTaskHistory_struct_42']?.()
__napiInstance.exports['__napi_register__NxTaskHistory_impl_46']?.()
__napiInstance.exports['__napi_register__Task_struct_47']?.()
__napiInstance.exports['__napi_register__TaskTarget_struct_48']?.()
__napiInstance.exports['__napi_register__TaskGraph_struct_49']?.()
__napiInstance.exports['__napi_register__FileData_struct_50']?.()
__napiInstance.exports['__napi_register__InputsInput_struct_51']?.()
__napiInstance.exports['__napi_register__FileSetInput_struct_52']?.()
__napiInstance.exports['__napi_register__RuntimeInput_struct_53']?.()
__napiInstance.exports['__napi_register__EnvironmentInput_struct_54']?.()
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_55']?.()
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_56']?.()
__napiInstance.exports['__napi_register__NxJson_struct_57']?.()
__napiInstance.exports['__napi_register__WorkspaceContext_struct_58']?.()
__napiInstance.exports['__napi_register__WorkspaceContext_impl_67']?.()
__napiInstance.exports['__napi_register__WorkspaceErrors_68']?.()
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_69']?.()
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_70']?.()
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_71']?.()
__napiInstance.exports['__napi_register__FileMap_struct_72']?.()
__napiInstance.exports['__napi_register____test_only_transfer_file_map_73']?.()
__napiInstance.exports['__napi_register__CachedResult_struct_0']?.()
__napiInstance.exports['__napi_register__NxCache_struct_1']?.()
__napiInstance.exports['__napi_register__NxCache_impl_9']?.()
__napiInstance.exports['__napi_register__expand_outputs_10']?.()
__napiInstance.exports['__napi_register__get_files_for_outputs_11']?.()
__napiInstance.exports['__napi_register__remove_12']?.()
__napiInstance.exports['__napi_register__copy_13']?.()
__napiInstance.exports['__napi_register__validate_outputs_14']?.()
__napiInstance.exports['__napi_register__get_transformable_outputs_15']?.()
__napiInstance.exports['__napi_register__hash_array_16']?.()
__napiInstance.exports['__napi_register__hash_file_17']?.()
__napiInstance.exports['__napi_register__IS_WASM_18']?.()
__napiInstance.exports['__napi_register__get_binary_target_19']?.()
__napiInstance.exports['__napi_register__ImportResult_struct_20']?.()
__napiInstance.exports['__napi_register__find_imports_21']?.()
__napiInstance.exports['__napi_register__transfer_project_graph_22']?.()
__napiInstance.exports['__napi_register__ExternalNode_struct_23']?.()
__napiInstance.exports['__napi_register__Target_struct_24']?.()
__napiInstance.exports['__napi_register__Project_struct_25']?.()
__napiInstance.exports['__napi_register__ProjectGraph_struct_26']?.()
__napiInstance.exports['__napi_register__HashedTask_struct_27']?.()
__napiInstance.exports['__napi_register__TaskDetails_struct_28']?.()
__napiInstance.exports['__napi_register__TaskDetails_impl_31']?.()
__napiInstance.exports['__napi_register__HashPlanner_struct_32']?.()
__napiInstance.exports['__napi_register__HashPlanner_impl_36']?.()
__napiInstance.exports['__napi_register__HashDetails_struct_37']?.()
__napiInstance.exports['__napi_register__HasherOptions_struct_38']?.()
__napiInstance.exports['__napi_register__TaskHasher_struct_39']?.()
__napiInstance.exports['__napi_register__TaskHasher_impl_42']?.()
__napiInstance.exports['__napi_register__TaskRun_struct_43']?.()
__napiInstance.exports['__napi_register__NxTaskHistory_struct_44']?.()
__napiInstance.exports['__napi_register__NxTaskHistory_impl_48']?.()
__napiInstance.exports['__napi_register__Task_struct_49']?.()
__napiInstance.exports['__napi_register__TaskTarget_struct_50']?.()
__napiInstance.exports['__napi_register__TaskGraph_struct_51']?.()
__napiInstance.exports['__napi_register__FileData_struct_52']?.()
__napiInstance.exports['__napi_register__InputsInput_struct_53']?.()
__napiInstance.exports['__napi_register__FileSetInput_struct_54']?.()
__napiInstance.exports['__napi_register__RuntimeInput_struct_55']?.()
__napiInstance.exports['__napi_register__EnvironmentInput_struct_56']?.()
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_57']?.()
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_58']?.()
__napiInstance.exports['__napi_register__NxJson_struct_59']?.()
__napiInstance.exports['__napi_register__WorkspaceContext_struct_60']?.()
__napiInstance.exports['__napi_register__WorkspaceContext_impl_69']?.()
__napiInstance.exports['__napi_register__WorkspaceErrors_70']?.()
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_71']?.()
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_72']?.()
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_73']?.()
__napiInstance.exports['__napi_register__FileMap_struct_74']?.()
__napiInstance.exports['__napi_register____test_only_transfer_file_map_75']?.()
}
export const HashPlanner = __napiModule.exports.HashPlanner
export const ImportResult = __napiModule.exports.ImportResult
Expand All @@ -113,10 +115,12 @@ export const expandOutputs = __napiModule.exports.expandOutputs
export const findImports = __napiModule.exports.findImports
export const getBinaryTarget = __napiModule.exports.getBinaryTarget
export const getFilesForOutputs = __napiModule.exports.getFilesForOutputs
export const getTransformableOutputs = __napiModule.exports.getTransformableOutputs
export const hashArray = __napiModule.exports.hashArray
export const hashFile = __napiModule.exports.hashFile
export const IS_WASM = __napiModule.exports.IS_WASM
export const remove = __napiModule.exports.remove
export const testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
export const transferProjectGraph = __napiModule.exports.transferProjectGraph
export const validateOutputs = __napiModule.exports.validateOutputs
export const WorkspaceErrors = __napiModule.exports.WorkspaceErrors
102 changes: 53 additions & 49 deletions packages/nx/src/native/nx.wasi.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,55 +82,57 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
})

function __napi_rs_initialize_modules(__napiInstance) {
__napiInstance.exports['__napi_register__expand_outputs_0']?.()
__napiInstance.exports['__napi_register__get_files_for_outputs_1']?.()
__napiInstance.exports['__napi_register__remove_2']?.()
__napiInstance.exports['__napi_register__copy_3']?.()
__napiInstance.exports['__napi_register__CachedResult_struct_4']?.()
__napiInstance.exports['__napi_register__NxCache_struct_5']?.()
__napiInstance.exports['__napi_register__NxCache_impl_13']?.()
__napiInstance.exports['__napi_register__hash_array_14']?.()
__napiInstance.exports['__napi_register__hash_file_15']?.()
__napiInstance.exports['__napi_register__IS_WASM_16']?.()
__napiInstance.exports['__napi_register__get_binary_target_17']?.()
__napiInstance.exports['__napi_register__ImportResult_struct_18']?.()
__napiInstance.exports['__napi_register__find_imports_19']?.()
__napiInstance.exports['__napi_register__transfer_project_graph_20']?.()
__napiInstance.exports['__napi_register__ExternalNode_struct_21']?.()
__napiInstance.exports['__napi_register__Target_struct_22']?.()
__napiInstance.exports['__napi_register__Project_struct_23']?.()
__napiInstance.exports['__napi_register__ProjectGraph_struct_24']?.()
__napiInstance.exports['__napi_register__HashedTask_struct_25']?.()
__napiInstance.exports['__napi_register__TaskDetails_struct_26']?.()
__napiInstance.exports['__napi_register__TaskDetails_impl_29']?.()
__napiInstance.exports['__napi_register__HashPlanner_struct_30']?.()
__napiInstance.exports['__napi_register__HashPlanner_impl_34']?.()
__napiInstance.exports['__napi_register__HashDetails_struct_35']?.()
__napiInstance.exports['__napi_register__HasherOptions_struct_36']?.()
__napiInstance.exports['__napi_register__TaskHasher_struct_37']?.()
__napiInstance.exports['__napi_register__TaskHasher_impl_40']?.()
__napiInstance.exports['__napi_register__TaskRun_struct_41']?.()
__napiInstance.exports['__napi_register__NxTaskHistory_struct_42']?.()
__napiInstance.exports['__napi_register__NxTaskHistory_impl_46']?.()
__napiInstance.exports['__napi_register__Task_struct_47']?.()
__napiInstance.exports['__napi_register__TaskTarget_struct_48']?.()
__napiInstance.exports['__napi_register__TaskGraph_struct_49']?.()
__napiInstance.exports['__napi_register__FileData_struct_50']?.()
__napiInstance.exports['__napi_register__InputsInput_struct_51']?.()
__napiInstance.exports['__napi_register__FileSetInput_struct_52']?.()
__napiInstance.exports['__napi_register__RuntimeInput_struct_53']?.()
__napiInstance.exports['__napi_register__EnvironmentInput_struct_54']?.()
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_55']?.()
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_56']?.()
__napiInstance.exports['__napi_register__NxJson_struct_57']?.()
__napiInstance.exports['__napi_register__WorkspaceContext_struct_58']?.()
__napiInstance.exports['__napi_register__WorkspaceContext_impl_67']?.()
__napiInstance.exports['__napi_register__WorkspaceErrors_68']?.()
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_69']?.()
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_70']?.()
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_71']?.()
__napiInstance.exports['__napi_register__FileMap_struct_72']?.()
__napiInstance.exports['__napi_register____test_only_transfer_file_map_73']?.()
__napiInstance.exports['__napi_register__CachedResult_struct_0']?.()
__napiInstance.exports['__napi_register__NxCache_struct_1']?.()
__napiInstance.exports['__napi_register__NxCache_impl_9']?.()
__napiInstance.exports['__napi_register__expand_outputs_10']?.()
__napiInstance.exports['__napi_register__get_files_for_outputs_11']?.()
__napiInstance.exports['__napi_register__remove_12']?.()
__napiInstance.exports['__napi_register__copy_13']?.()
__napiInstance.exports['__napi_register__validate_outputs_14']?.()
__napiInstance.exports['__napi_register__get_transformable_outputs_15']?.()
__napiInstance.exports['__napi_register__hash_array_16']?.()
__napiInstance.exports['__napi_register__hash_file_17']?.()
__napiInstance.exports['__napi_register__IS_WASM_18']?.()
__napiInstance.exports['__napi_register__get_binary_target_19']?.()
__napiInstance.exports['__napi_register__ImportResult_struct_20']?.()
__napiInstance.exports['__napi_register__find_imports_21']?.()
__napiInstance.exports['__napi_register__transfer_project_graph_22']?.()
__napiInstance.exports['__napi_register__ExternalNode_struct_23']?.()
__napiInstance.exports['__napi_register__Target_struct_24']?.()
__napiInstance.exports['__napi_register__Project_struct_25']?.()
__napiInstance.exports['__napi_register__ProjectGraph_struct_26']?.()
__napiInstance.exports['__napi_register__HashedTask_struct_27']?.()
__napiInstance.exports['__napi_register__TaskDetails_struct_28']?.()
__napiInstance.exports['__napi_register__TaskDetails_impl_31']?.()
__napiInstance.exports['__napi_register__HashPlanner_struct_32']?.()
__napiInstance.exports['__napi_register__HashPlanner_impl_36']?.()
__napiInstance.exports['__napi_register__HashDetails_struct_37']?.()
__napiInstance.exports['__napi_register__HasherOptions_struct_38']?.()
__napiInstance.exports['__napi_register__TaskHasher_struct_39']?.()
__napiInstance.exports['__napi_register__TaskHasher_impl_42']?.()
__napiInstance.exports['__napi_register__TaskRun_struct_43']?.()
__napiInstance.exports['__napi_register__NxTaskHistory_struct_44']?.()
__napiInstance.exports['__napi_register__NxTaskHistory_impl_48']?.()
__napiInstance.exports['__napi_register__Task_struct_49']?.()
__napiInstance.exports['__napi_register__TaskTarget_struct_50']?.()
__napiInstance.exports['__napi_register__TaskGraph_struct_51']?.()
__napiInstance.exports['__napi_register__FileData_struct_52']?.()
__napiInstance.exports['__napi_register__InputsInput_struct_53']?.()
__napiInstance.exports['__napi_register__FileSetInput_struct_54']?.()
__napiInstance.exports['__napi_register__RuntimeInput_struct_55']?.()
__napiInstance.exports['__napi_register__EnvironmentInput_struct_56']?.()
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_57']?.()
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_58']?.()
__napiInstance.exports['__napi_register__NxJson_struct_59']?.()
__napiInstance.exports['__napi_register__WorkspaceContext_struct_60']?.()
__napiInstance.exports['__napi_register__WorkspaceContext_impl_69']?.()
__napiInstance.exports['__napi_register__WorkspaceErrors_70']?.()
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_71']?.()
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_72']?.()
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_73']?.()
__napiInstance.exports['__napi_register__FileMap_struct_74']?.()
__napiInstance.exports['__napi_register____test_only_transfer_file_map_75']?.()
}
module.exports.HashPlanner = __napiModule.exports.HashPlanner
module.exports.ImportResult = __napiModule.exports.ImportResult
Expand All @@ -144,10 +146,12 @@ module.exports.expandOutputs = __napiModule.exports.expandOutputs
module.exports.findImports = __napiModule.exports.findImports
module.exports.getBinaryTarget = __napiModule.exports.getBinaryTarget
module.exports.getFilesForOutputs = __napiModule.exports.getFilesForOutputs
module.exports.getTransformableOutputs = __napiModule.exports.getTransformableOutputs
module.exports.hashArray = __napiModule.exports.hashArray
module.exports.hashFile = __napiModule.exports.hashFile
module.exports.IS_WASM = __napiModule.exports.IS_WASM
module.exports.remove = __napiModule.exports.remove
module.exports.testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
module.exports.transferProjectGraph = __napiModule.exports.transferProjectGraph
module.exports.validateOutputs = __napiModule.exports.validateOutputs
module.exports.WorkspaceErrors = __napiModule.exports.WorkspaceErrors
4 changes: 2 additions & 2 deletions packages/nx/src/native/walker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ where

/// Walk the directory and ignore files from .gitignore and .nxignore
#[cfg(target_arch = "wasm32")]
pub fn nx_walker<P>(directory: P) -> impl Iterator<Item = NxFile>
pub fn nx_walker<P>(directory: P, use_ignores: bool) -> impl Iterator<Item = NxFile>
where
P: AsRef<Path>,
{
let directory: PathBuf = directory.as_ref().into();
let walker = create_walker(&directory);
let walker = create_walker(&directory, use_ignores);

let entries = walker.build();

Expand Down

0 comments on commit d47d41c

Please sign in to comment.