Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fix-duplicate-export
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed May 28, 2024
2 parents 52c5ac5 + 0d9f351 commit 0cda956
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
9 changes: 9 additions & 0 deletions hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,15 @@ function createHook (meta) {
return url
}

// If the file is referencing itself, we need to skip adding the iitm search params
if (url.url === parentURL) {
return {
url: url.url,
shortCircuit: true,
format: url.format
}
}

specifiers.set(url.url, specifier)

return {
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/cyclical-self.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// File generated from our OpenAPI spec by Stainless.
import * as BatchesAPI from './cyclical-self.mjs'
export class Batches {}
export class BatchesPage {}
(function (Batches) {
Batches.BatchesPage = BatchesAPI.BatchesPage
// eslint-disable-next-line no-class-assign
})(Batches || (Batches = {}))
4 changes: 4 additions & 0 deletions test/hook/cyclical-self.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Batches, BatchesPage } from '../fixtures/cyclical-self.mjs'
import { strictEqual } from 'assert'

strictEqual(Batches.BatchesPage, BatchesPage)
File renamed without changes.
8 changes: 7 additions & 1 deletion test/version-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ process.env.IITM_TEST_FILE = filename

const [processMajor, processMinor] = process.versions.node.split('.').map(Number)

const match = filename.match(/v([0-9]+)(?:\.([0-9]+))?/)
const match = filename.match(/v([0-9]+)(?:\.([0-9]+))?(?:-v([0-9]+))?/)

const majorRequirement = match ? match[1] : 0
const minorRequirement = match && match[2]
const majorMax = match ? match[3] : Infinity

if (processMajor < majorRequirement) {
console.log(`skipping ${filename} as this is Node.js v${processMajor} and test wants v${majorRequirement}`)
Expand All @@ -25,3 +26,8 @@ if (processMajor <= majorRequirement && processMinor < minorRequirement) {
console.log(`skipping ${filename} as this is Node.js v${processMajor}.${processMinor} and test wants >=v${majorRequirement}.${minorRequirement}`)
process.exit(0)
}

if (processMajor > majorMax) {
console.log(`skipping ${filename} as this is Node.js v${processMajor} and test wants <=v${majorMax}`)
process.exit(0)
}

0 comments on commit 0cda956

Please sign in to comment.