#include "../bindings/ZigGlobalObject.h" #include "JavaScriptCore/CustomGetterSetter.h" #include "JavaScriptCore/JSGlobalObject.h" namespace Zig { JSC_DEFINE_HOST_FUNCTION(jsFunctionProcessModuleCommonJS, (JSGlobalObject * globalObject, CallFrame *callFrame)) { VM &vm = globalObject->vm(); return JSValue::encode( reinterpret_cast(globalObject)->processObject()); } JSC_DEFINE_CUSTOM_GETTER(jsFunctionProcessModuleCommonJSGetter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName propertyName)) { VM &vm = globalObject->vm(); return JSValue::encode(reinterpret_cast(globalObject) ->processObject() ->get(globalObject, propertyName)); } JSC_DEFINE_CUSTOM_SETTER(jsFunctionProcessModuleCommonJSSetter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName propertyName)) { VM &vm = globalObject->vm(); return reinterpret_cast(globalObject) ->processObject() ->putDirect(vm, propertyName, JSValue::decode(encodedValue), 0); } inline void generateProcessSourceCode(JSC::JSGlobalObject *lexicalGlobalObject, JSC::Identifier moduleKey, Vector &exportNames, JSC::MarkedArgumentBuffer &exportValues) { JSC::VM &vm = lexicalGlobalObject->vm(); GlobalObject *globalObject = reinterpret_cast(lexicalGlobalObject); JSC::JSObject *process = globalObject->processObject(); PropertyNameArray properties(vm, PropertyNameMode::Strings, PrivateSymbolMode::Exclude); process->getPropertyNames(globalObject, properties, DontEnumPropertiesMode::Exclude); exportNames.append(JSC::Identifier::fromString(vm, "default"_s)); JSFunction *processModuleCommonJS = JSFunction::create( vm, globalObject, 0, "process"_s, jsFunctionProcessModuleCommonJS, ImplementationVisibility::Public); processModuleCommonJS->putDirect( vm, PropertyName( Identifier::fromUid(vm.symbolRegistry().symbolForKey("CommonJS"_s))), jsBoolean(true), 0); exportValues.append(processModuleCommonJS); for (auto &entry : properties) { exportNames.append(entry); exportValues.append(process->get(globalObject, entry)); processModuleCommonJS->putDirectCustomAccessor( vm, entry, JSC::CustomGetterSetter::create(vm, jsFunctionProcessModuleCommonJSGetter, jsFunctionProcessModuleCommonJSSetter), 0); } } } // namespace Zig tion> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-11-19Version Packages (next) (#1904)astro@0.21.0-next.9Gravatar github-actions[bot] 23-21/+30
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-11-19Remove OSX \x00 workaround (#1901)Gravatar Matthew Phillips 2-5/+5
* Remove OSX \x00 workaround * Adds a changeset
2021-11-19Resolve vite client modules to vendored vite (#1903)Gravatar Matthew Phillips 2-2/+7
* Resolve vite client modules to vendored vite * Adds a changeset
2021-11-19[ci] yarn formatGravatar matthewp 1-3/+3
2021-11-19Add Debug tests (#1882)Gravatar Matthew Phillips 4-0/+62
* Make Debug use the Code component * Use a random port so parallel testing works * some debugging * Skip these tests for now * Dont run these tests on osx
2021-11-19[ci] collect statsGravatar FredKSchott 1-0/+1
2021-11-19Version Packages (next) (#1881)astro@0.21.0-next.8@astrojs/renderer-vue@0.2.0-next.2Gravatar github-actions[bot] 25-23/+42
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-11-18Improve HMR (#1896)Gravatar Drew Powers 2-10/+18
2021-11-18update depsGravatar Fred K. Schott 5-352/+65
2021-11-18fix #1778Gravatar Fred K. Schott 2-1/+8
2021-11-18Update compiler (#1869)Gravatar Nate Moore 3-11/+6
* chore: update compiler * redeploy * fix(www): ensure www can build * chore: update compiler Co-authored-by: Fred K. Schott <fkschott@gmail.com>
2021-11-18remove unused remark dependency (#1894)Gravatar Fred K. Schott 2-245/+13
2021-11-18Improve error messages (#1875)Gravatar Drew Powers 39-61/+448
* Fix error handling in correct scope Also improve Vite IDs for better module graph lookups * Improve code frame * Add changeset * maybeLoc can be undefined * Add tests Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2021-11-18pin astro compiler to older versionGravatar Fred K. Schott 2-5/+5
2021-11-18Update yarn.lock to reflect the state of the package.json files (#1892)Gravatar Jonathan Neal 5-1300/+1000
* update dependencies * update file to fix build:all
2021-11-19[ci] yarn formatGravatar FredKSchott 1-5/+3