• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "ecmascript/platform/module.h"
17 
18 #include "ecmascript/module/module_path_helper.h"
19 
20 namespace panda::ecmascript {
GetOutEntryPoint(EcmaVM * vm,const CString & inputFileName)21 CString GetOutEntryPoint(EcmaVM *vm, const CString &inputFileName)
22 {
23     // inputFileName: moduleName/ets/xxx/xxx.abc
24     return base::ConcatToCString(vm->GetBundleName(), PathHelper::SLASH_TAG, inputFileName);
25 }
26 
GetBaseFileName(EcmaVM * vm,CString & moduleRequestName,CString & baseFileName,const CString & bundleName,const CString & moduleName,CString & recordName)27 CString GetBaseFileName(EcmaVM *vm, [[maybe_unused]] CString &moduleRequestName, CString &baseFileName,
28     const CString &bundleName, const CString &moduleName, [[maybe_unused]] CString &recordName)
29 {
30     if (bundleName != vm->GetBundleName()) {
31         baseFileName = base::ConcatToCString(ModulePathHelper::BUNDLE_INSTALL_PATH, bundleName, PathHelper::SLASH_TAG,
32             moduleName, PathHelper::SLASH_TAG, moduleName, ModulePathHelper::MERGE_ABC_ETS_MODULES);
33     } else if (moduleName != vm->GetModuleName()) {
34         baseFileName = base::ConcatToCString(ModulePathHelper::BUNDLE_INSTALL_PATH, moduleName,
35             ModulePathHelper::MERGE_ABC_ETS_MODULES);
36     } else {
37         // Support multi-module card service
38         baseFileName = vm->GetAssetPath();
39     }
40     return baseFileName;
41 }
42 
CheckEntryPointPreview(JSThread * thread,const CString & entryPoint)43 JSHandle<JSTaggedValue> CheckEntryPointPreview(JSThread *thread, [[maybe_unused]] const CString &entryPoint)
44 {
45     return thread->GlobalConstants()->GetHandledNull();
46 }
47 } // namespace panda::ecmascript