@jsenv/core 36.1.3 → 36.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/js/{global_this.js → global_this_js_classic.js} +3 -3
  2. package/dist/js/global_this_js_module.js +20 -0
  3. package/dist/js/inline_content.js +10 -0
  4. package/dist/jsenv_core.js +7479 -7675
  5. package/package.json +20 -20
  6. package/src/build/build.js +4 -4
  7. package/src/dev/file_service.js +1 -1
  8. package/src/kitchen/client/inline_content.js +17 -0
  9. package/src/kitchen/kitchen.js +7 -1
  10. package/src/plugins/commonjs_globals/jsenv_plugin_commonjs_globals.js +4 -1
  11. package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +4 -1
  12. package/src/plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +4 -1
  13. package/src/plugins/plugins.js +1 -1
  14. package/src/kitchen/compat/features_compatibility.js +0 -220
  15. package/src/kitchen/compat/runtime_compat.js +0 -56
  16. package/src/plugins/reference_analysis/inline_content.js +0 -7
  17. package/src/plugins/transpilation/as_js_module/convert_js_classic_to_js_module.js +0 -45
  18. package/src/plugins/transpilation/as_js_module/jsenv_plugin_as_js_module.js +0 -78
  19. package/src/plugins/transpilation/babel/global_this/babel_plugin_global_this_as_jsenv_import.js +0 -34
  20. package/src/plugins/transpilation/babel/global_this/client/global_this.js +0 -25
  21. package/src/plugins/transpilation/babel/helpers/babel_plugin_babel_helpers_as_jsenv_imports.js +0 -52
  22. package/src/plugins/transpilation/babel/helpers/babel_plugin_structure.js +0 -173
  23. package/src/plugins/transpilation/babel/helpers/babel_plugins_compatibility.js +0 -432
  24. package/src/plugins/transpilation/babel/jsenv_plugin_babel.js +0 -100
  25. package/src/plugins/transpilation/babel/new_stylesheet/babel_plugin_new_stylesheet_as_jsenv_import.js +0 -142
  26. package/src/plugins/transpilation/babel/new_stylesheet/client/new_stylesheet.js +0 -381
  27. package/src/plugins/transpilation/babel/regenerator_runtime/babel_plugin_regenerator_runtime_as_jsenv_import.js +0 -33
  28. package/src/plugins/transpilation/babel/regenerator_runtime/client/regenerator_runtime.js +0 -748
  29. package/src/plugins/transpilation/babel/require_babel_plugin.js +0 -8
  30. package/src/plugins/transpilation/css/jsenv_plugin_css_transpilation.js +0 -54
  31. package/src/plugins/transpilation/import_assertions/jsenv_plugin_import_assertions.js +0 -248
  32. package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_conversion.js +0 -119
  33. package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_fallback.js +0 -46
  34. package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_fallback_inside_html.js +0 -240
  35. package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_fallback_on_workers.js +0 -62
  36. package/src/plugins/transpilation/jsenv_plugin_import_meta_resolve.js +0 -48
  37. package/src/plugins/transpilation/jsenv_plugin_top_level_await.js +0 -87
  38. package/src/plugins/transpilation/jsenv_plugin_transpilation.js +0 -56
@@ -6,8 +6,8 @@ let globalObject;
6
6
  if (typeof globalThis === "object") {
7
7
  globalObject = globalThis;
8
8
  } else {
9
- if (undefined) {
10
- globalObject = undefined;
9
+ if (typeof this === "object") {
10
+ globalObject = this;
11
11
  } else {
12
12
  // eslint-disable-next-line no-extend-native
13
13
  Object.defineProperty(Object.prototype, "__global__", {
@@ -21,4 +21,4 @@ if (typeof globalThis === "object") {
21
21
  delete Object.prototype.__global__;
22
22
  }
23
23
  globalObject.globalThis = globalObject;
24
- }
24
+ }
@@ -0,0 +1,20 @@
1
+ // https://mathiasbynens.be/notes/globalthis
2
+
3
+ /* eslint-disable no-redeclare */
4
+ /* global globalThis */
5
+ let globalObject;
6
+ if (typeof globalThis === "object") {
7
+ globalObject = globalThis;
8
+ } else {
9
+ // eslint-disable-next-line no-extend-native
10
+ Object.defineProperty(Object.prototype, "__global__", {
11
+ get() {
12
+ return this;
13
+ },
14
+ configurable: true
15
+ });
16
+ // eslint-disable-next-line no-undef
17
+ globalObject = __global__;
18
+ delete Object.prototype.__global__;
19
+ }
20
+ globalObject.globalThis = globalObject;
@@ -1,5 +1,15 @@
1
1
  /* eslint-env browser,node */
2
2
 
3
+ /*
4
+ * This file does not use export const InlineContent = function() {} on purpose:
5
+ * - An export would be renamed by rollup,
6
+ * making it harder to statically detect new InlineContent() calls
7
+ * - An export would be renamed by terser
8
+ * here again it becomes hard to detect new InlineContent() calls
9
+ * Instead it sets "__InlineContent__" on the global object and terser is configured by jsenv
10
+ * to preserve the __InlineContent__ global variable name
11
+ */
12
+
3
13
  const globalObject = typeof self === "object" ? self : process;
4
14
  globalObject.__InlineContent__ = function (content, {
5
15
  type = "text/plain"