-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "vanilla-integration", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"test:build": "vite build && vitest" | ||
}, | ||
"devDependencies": { | ||
"@tanstack/config": "<1.0.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); | ||
const utils = require("./utils.cjs"); | ||
exports.optionalChaining = utils.optionalChaining; | ||
//# sourceMappingURL=index.cjs.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './utils'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); | ||
const optionalChaining = (data) => { | ||
var _a; | ||
return (_a = data == null ? void 0 : data.maybe) == null ? void 0 : _a.property; | ||
}; | ||
exports.optionalChaining = optionalChaining; | ||
//# sourceMappingURL=utils.cjs.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare const optionalChaining: (data: any) => any; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './utils'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare const optionalChaining: (data: any) => any; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './utils' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const optionalChaining = (data: any) => { | ||
return data?.maybe?.property | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { readFileSync, readdirSync } from 'node:fs' | ||
import { fileURLToPath } from 'node:url' | ||
import { dirname, resolve } from 'node:path' | ||
import { describe, expect, it } from 'vitest' | ||
|
||
const __dirname = dirname(fileURLToPath(import.meta.url)) | ||
const rootDir = resolve(__dirname, '..') | ||
|
||
const esmExtensions = ['.js', '.js.map', '.d.ts'] | ||
const cjsExtensions = ['.cjs', '.cjs.map', '.d.cts'] | ||
|
||
const files = ['index', 'utils'] | ||
|
||
describe('Check Vanilla build output', () => { | ||
it('should output the same file structure', () => { | ||
const distFiles = readdirSync(`${rootDir}/dist`, { recursive: true }) | ||
const snapFiles = readdirSync(`${rootDir}/snap`, { recursive: true }) | ||
|
||
expect(distFiles).toEqual(snapFiles) | ||
}) | ||
|
||
it('should build the same ESM output', () => { | ||
files.forEach((file) => { | ||
esmExtensions.forEach((ext) => { | ||
expect( | ||
readFileSync(`${rootDir}/dist/esm/${file}${ext}`).toString(), | ||
).toMatchFileSnapshot(`${rootDir}/snap/esm/${file}${ext}`) | ||
}) | ||
}) | ||
}) | ||
|
||
it('should build the same CJS output', () => { | ||
files.forEach((file) => { | ||
cjsExtensions.forEach((ext) => { | ||
expect( | ||
readFileSync(`${rootDir}/dist/cjs/${file}${ext}`).toString(), | ||
).toMatchFileSnapshot(`${rootDir}/snap/cjs/${file}${ext}`) | ||
}) | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"module": "ESNext", | ||
"skipLibCheck": true, | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["src", "tests", "vite.config.ts"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { mergeConfig, defineConfig } from 'vitest/config' | ||
import { tanstackBuildConfig } from '@tanstack/config/build' | ||
|
||
const config = defineConfig({ | ||
test: { | ||
name: 'vanilla-integration', | ||
watch: false, | ||
}, | ||
}) | ||
|
||
export default mergeConfig( | ||
config, | ||
tanstackBuildConfig({ | ||
entry: 'src/index.ts', | ||
srcDir: 'src', | ||
}), | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.