| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ec8336b commit 8caeb03
19 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1092,7 +1092,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | |||
| 1092 | 1092 | "Type-stripping for TypeScript files.", | |
| 1093 | 1093 | &EnvironmentOptions::strip_types, | |
| 1094 | 1094 | kAllowedInEnvvar, | |
| 1095 | - true); | ||
| 1095 | + HAVE_AMARO); | ||
| 1096 | 1096 | AddAlias("--experimental-strip-types", "--strip-types"); | |
| 1097 | 1097 | AddOption("--experimental-transform-types", | |
| 1098 | 1098 | "enable transformation of TypeScript-only" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -259,7 +259,7 @@ class EnvironmentOptions : public Options { | |||
| 259 | 259 | ||
| 260 | 260 | std::vector<std::string> preload_esm_modules; | |
| 261 | 261 | ||
| 262 | - bool strip_types = true; | ||
| 262 | + bool strip_types = HAVE_AMARO; | ||
| 263 | 263 | bool experimental_transform_types = false; | |
| 264 | 264 | ||
| 265 | 265 | std::vector<std::string> user_argv; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,8 @@ function wrapScriptInUrlWorker(script) { | |||
| 21 | 21 | `; | |
| 22 | 22 | } | |
| 23 | 23 | ||
| 24 | + const onlyWithAmaro = { skip: !process.config.variables.node_use_amaro }; | ||
| 25 | + | ||
| 24 | 26 | describe('import.meta.main in evaluated scripts', () => { | |
| 25 | 27 | const importMetaMainScript = ` | |
| 26 | 28 | import assert from 'node:assert/strict'; | |
@@ -85,7 +87,7 @@ const { isMain: importedModuleIsMain } = await import( | |||
| 85 | 87 | assert.strictEqual(importedModuleIsMain, false, 'import.meta.main should evaluate false in imported module'); | |
| 86 | 88 | `; | |
| 87 | 89 | ||
| 88 | - it('should evaluate true in evaluated script', async () => { | ||
| 90 | + it('should evaluate true in evaluated script', onlyWithAmaro, async () => { | ||
| 89 | 91 | const result = await spawnPromisified( | |
| 90 | 92 | process.execPath, | |
| 91 | 93 | ['--input-type=module-typescript', '--disable-warning=ExperimentalWarning', '--eval', importMetaMainTSScript], | |
@@ -98,7 +100,7 @@ assert.strictEqual(importedModuleIsMain, false, 'import.meta.main should evaluat | |||
| 98 | 100 | }); | |
| 99 | 101 | }); | |
| 100 | 102 | ||
| 101 | - it('should evaluate true in worker instantiated with module source by evaluated script', async () => { | ||
| 103 | + it('should evaluate true in worker instantiated with module source by evaluated script', onlyWithAmaro, async () => { | ||
| 102 | 104 | const result = await spawnPromisified( | |
| 103 | 105 | process.execPath, | |
| 104 | 106 | ['--input-type=module-typescript', | |
@@ -114,7 +116,7 @@ assert.strictEqual(importedModuleIsMain, false, 'import.meta.main should evaluat | |||
| 114 | 116 | }); | |
| 115 | 117 | }); | |
| 116 | 118 | ||
| 117 | - it('should evaluate true in worker instantiated with `data:` URL by evaluated script', async () => { | ||
| 119 | + it('should evaluate true in worker instantiated with `data:` URL by evaluated script', onlyWithAmaro, async () => { | ||
| 118 | 120 | const result = await spawnPromisified( | |
| 119 | 121 | process.execPath, | |
| 120 | 122 | ['--input-type=module', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,8 @@ async function assertSpawnedProcess(args, options = {}, expected = {}) { | |||
| 23 | 23 | // Common expectation for experimental feature warning in stderr | |
| 24 | 24 | const experimentalFeatureWarning = { stderr: /--entry-url is an experimental feature/ }; | |
| 25 | 25 | ||
| 26 | + const onlyWithAmaro = { skip: !process.config.variables.node_use_amaro }; | ||
| 27 | + | ||
| 26 | 28 | describe('--entry-url', { concurrency: true }, () => { | |
| 27 | 29 | it('should reject loading a path that contains %', async () => { | |
| 28 | 30 | await assertSpawnedProcess( | |
@@ -76,7 +78,7 @@ describe('--entry-url', { concurrency: true }, () => { | |||
| 76 | 78 | ); | |
| 77 | 79 | }); | |
| 78 | 80 | ||
| 79 | - it('should support loading TypeScript URLs', { skip: !process.config.variables.node_use_amaro }, async () => { | ||
| 81 | + it('should support loading TypeScript URLs', onlyWithAmaro, async () => { | ||
| 80 | 82 | const typescriptUrls = [ | |
| 81 | 83 | 'typescript/cts/test-require-ts-file.cts', | |
| 82 | 84 | 'typescript/mts/test-import-ts-file.mts', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -198,6 +198,10 @@ try { | |||
| 198 | 198 | subdirPackageType, | |
| 199 | 199 | expectedResolvedFormat, | |
| 200 | 200 | mainSuffix = '' ] = testVariant; | |
| 201 | + const skip = mainImportScript.endsWith('.ts') && !process.config.variables.node_use_amaro; | ||
| 202 | + if (skip) { | ||
| 203 | + return; | ||
| 204 | + } | ||
| 201 | 205 | ||
| 202 | 206 | const mDir = rel(`node_modules/${moduleName}`); | |
| 203 | 207 | const subDir = rel(`node_modules/${moduleName}/subdir`); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,6 +63,11 @@ for (const [, envVar, config] of nodeOptionsCC.matchAll(addOptionRE)) { | |||
| 63 | 63 | hasTrueAsDefaultValue = true; | |
| 64 | 64 | } | |
| 65 | 65 | ||
| 66 | + // Exception for HAVE_AMARO conditional default (defaults to true when Amaro is available) | ||
| 67 | + if (config.includes('HAVE_AMARO')) { | ||
| 68 | + hasTrueAsDefaultValue = true; | ||
| 69 | + } | ||
| 70 | + | ||
| 66 | 71 | if ( | |
| 67 | 72 | envVar.startsWith('[') || | |
| 68 | 73 | deprecated.includes(envVar) || | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | 3 | // This tests NODE_COMPILE_CACHE works for CommonJS with types. | |
| 4 | 4 | ||
| 5 | - require('../common'); | ||
| 5 | + const common = require('../common'); | ||
| 6 | + if (!process.config.variables.node_use_amaro) { | ||
| 7 | + common.skip('Requires Amaro'); | ||
| 8 | + } | ||
| 6 | 9 | const { spawnSyncAndAssert } = require('../common/child_process'); | |
| 7 | 10 | const assert = require('assert'); | |
| 8 | 11 | const tmpdir = require('../common/tmpdir'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | 3 | // This tests NODE_COMPILE_CACHE works for ESM with types. | |
| 4 | 4 | ||
| 5 | - require('../common'); | ||
| 5 | + const common = require('../common'); | ||
| 6 | + if (!process.config.variables.node_use_amaro) { | ||
| 7 | + common.skip('Requires Amaro'); | ||
| 8 | + } | ||
| 6 | 9 | const { spawnSyncAndAssert } = require('../common/child_process'); | |
| 7 | 10 | const assert = require('assert'); | |
| 8 | 11 | const tmpdir = require('../common/tmpdir'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,10 @@ | |||
| 3 | 3 | // This tests NODE_COMPILE_CACHE can handle cache invalidation | |
| 4 | 4 | // between strip-only TypeScript and transformed TypeScript. | |
| 5 | 5 | ||
| 6 | - require('../common'); | ||
| 6 | + const common = require('../common'); | ||
| 7 | + if (!process.config.variables.node_use_amaro) { | ||
| 8 | + common.skip('Requires Amaro'); | ||
| 9 | + } | ||
| 7 | 10 | const { spawnSyncAndAssert } = require('../common/child_process'); | |
| 8 | 11 | const assert = require('assert'); | |
| 9 | 12 | const tmpdir = require('../common/tmpdir'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,10 @@ | |||
| 3 | 3 | // This tests NODE_COMPILE_CACHE can be used for type stripping and ignores | |
| 4 | 4 | // --enable-source-maps as there's no difference in the code generated. | |
| 5 | 5 | ||
| 6 | - require('../common'); | ||
| 6 | + const common = require('../common'); | ||
| 7 | + if (!process.config.variables.node_use_amaro) { | ||
| 8 | + common.skip('Requires Amaro'); | ||
| 9 | + } | ||
| 7 | 10 | const { spawnSyncAndAssert } = require('../common/child_process'); | |
| 8 | 11 | const assert = require('assert'); | |
| 9 | 12 | const tmpdir = require('../common/tmpdir'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments