Skip to content

Commit

Permalink
chore: switch to tinyglobby
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Feb 25, 2025
1 parent 3d59e84 commit 05448bf
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 197 deletions.
4 changes: 2 additions & 2 deletions packages/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@
"@rollup/plugin-virtual": "^3.0.2",
"@types/aria-query": "^5.0.4",
"@types/node": "^20.11.5",
"dts-buddy": "^0.5.3",
"dts-buddy": "^0.5.5",
"esbuild": "^0.21.5",
"rollup": "^4.22.4",
"source-map": "^0.7.4",
"tiny-glob": "^0.2.9",
"tinyglobby": "^0.2.12",
"typescript": "^5.5.4",
"vitest": "^2.1.9"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte/tests/helpers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @import { CompileOptions } from '#compiler' */
import * as fs from 'node:fs';
import * as path from 'node:path';
import glob from 'tiny-glob/sync.js';
import { globSync } from 'tinyglobby';
import { VERSION, compile, compileModule, preprocess } from 'svelte/compiler';
import { vi } from 'vitest';

Expand Down Expand Up @@ -70,7 +70,7 @@ export async function compile_directory(

fs.rmSync(output_dir, { recursive: true, force: true });

for (let file of glob('**', { cwd, filesOnly: true })) {
for (let file of globSync('**', { cwd, filesOnly: true })) {
if (file.startsWith('_')) continue;

let text = fs.readFileSync(`${cwd}/${file}`, 'utf-8').replace(/\r\n/g, '\n');
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte/tests/runtime-legacy/shared.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'node:fs';
import { setImmediate } from 'node:timers/promises';
import glob from 'tiny-glob/sync.js';
import { globSync } from 'tinyglobby';
import { createClassComponent } from 'svelte/legacy';
import { proxy } from 'svelte/internal/client';
import { flushSync, hydrate, mount, unmount } from 'svelte';
Expand Down Expand Up @@ -257,7 +257,7 @@ async function run_test_variant(
raf.reset();

// Put things we need on window for testing
const styles = glob('**/*.css', { cwd: `${cwd}/_output/client` })
const styles = globSync('**/*.css', { cwd: `${cwd}/_output/client` })
.map((file) => fs.readFileSync(`${cwd}/_output/client/${file}`, 'utf-8'))
.join('\n')
.replace(/\/\*<\/?style>\*\//g, '');
Expand Down
6 changes: 3 additions & 3 deletions packages/svelte/tests/snapshot/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'node:fs';
import { assert, expect } from 'vitest';
import glob from 'tiny-glob/sync.js';
import { globSYnc } from 'tinyglobby';
import { compile_directory } from '../helpers.js';
import { suite, type BaseTest } from '../suite.js';
import { VERSION } from 'svelte/compiler';
Expand All @@ -18,8 +18,8 @@ const { test, run } = suite<SnapshotTest>(async (config, cwd) => {
fs.rmSync(`${cwd}/_expected`, { recursive: true, force: true });
fs.cpSync(`${cwd}/_output`, `${cwd}/_expected`, { recursive: true, force: true });
} else {
const actual = glob('**', { cwd: `${cwd}/_output`, filesOnly: true });
const expected = glob('**', { cwd: `${cwd}/_expected`, filesOnly: true });
const actual = globSync('**', { cwd: `${cwd}/_output`, onlyFiles: true });
const expected = globSync('**', { cwd: `${cwd}/_expected`, onlyFiles: true });

assert.deepEqual(actual, expected);

Expand Down
2 changes: 1 addition & 1 deletion playgrounds/sandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.6",
"polka": "^1.0.0-next.25",
"svelte": "workspace:*",
"tiny-glob": "^0.2.9",
"tinyglobby": "^0.2.12",
"vite": "^5.4.14",
"vite-plugin-inspect": "^0.8.4"
}
Expand Down
6 changes: 3 additions & 3 deletions playgrounds/sandbox/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from 'node:fs';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';
import glob from 'tiny-glob/sync.js';
import { globSync } from 'tinyglobby';
import { compile, compileModule, parse, migrate } from 'svelte/compiler';

const argv = parseArgs({ options: { runes: { type: 'boolean' } }, args: process.argv.slice(2) });
Expand Down Expand Up @@ -35,8 +35,8 @@ function write(file, contents) {
fs.writeFileSync(file, contents);
}

const svelte_modules = glob('**/*.svelte', { cwd: `${cwd}/src` });
const js_modules = glob('**/*.js', { cwd: `${cwd}/src` });
const svelte_modules = globSync('**/*.svelte', { cwd: `${cwd}/src` });
const js_modules = globSync('**/*.js', { cwd: `${cwd}/src` });

for (const generate of /** @type {const} */ (['client', 'server'])) {
console.error(`\n--- generating ${generate} ---\n`);
Expand Down
Loading

0 comments on commit 05448bf

Please sign in to comment.