Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move utils to the correct place #2964

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ export type {
export { FakerError } from './errors/faker-error';
export { Faker } from './faker';
export type { FakerOptions } from './faker';
export {
generateMersenne32Randomizer,
generateMersenne53Randomizer,
} from './internal/mersenne';
export * from './locale';
export { fakerEN as faker } from './locale';
export * from './locales';
Expand Down Expand Up @@ -84,3 +80,7 @@ export type { WordModule } from './modules/word';
export type { Randomizer } from './randomizer';
export { SimpleFaker, simpleFaker } from './simple-faker';
export { mergeLocales } from './utils/merge-locales';
export {
generateMersenne32Randomizer,
generateMersenne53Randomizer,
} from './utils/mersenne';
File renamed without changes.
2 changes: 1 addition & 1 deletion src/modules/string/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FakerError } from '../../errors/faker-error';
import { SimpleModuleBase } from '../../internal/module-base';
import type { LiteralUnion } from '../../utils/types';
import type { LiteralUnion } from '../../internal/types';

export type Casing = 'upper' | 'lower' | 'mixed';

Expand Down
2 changes: 1 addition & 1 deletion src/simple-faker.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { generateMersenne53Randomizer } from './internal/mersenne';
import { DatatypeModule } from './modules/datatype';
import { SimpleDateModule } from './modules/date';
import { SimpleHelpersModule } from './modules/helpers';
import { NumberModule } from './modules/number';
import { StringModule } from './modules/string';
import type { Randomizer } from './randomizer';
import { generateMersenne53Randomizer } from './utils/mersenne';

/**
* This is a simplified Faker class that doesn't need any localized data to generate its output.
Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): MersenneTwister19937 is an internal class and should stay in internal

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarification: the mersenne class is internal, the generateXRandomizer utility functions are public.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, then mersenne goes internal, and randomizer would go outside of utils and types in internal along with mersenne, would that be the correction to the problem?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course I think I already understood the point, thank you very much, I will upload changes to those previously mentioned in a moment.

File renamed without changes.
2 changes: 1 addition & 1 deletion test/internal/mersenne.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
MersenneTwister19937,
generateMersenne32Randomizer,
generateMersenne53Randomizer,
} from '../../src/internal/mersenne';

Check failure on line 6 in test/internal/mersenne.spec.ts

View workflow job for this annotation

GitHub Actions / TS-Check: node-22, ubuntu-latest

Cannot find module '../../src/internal/mersenne' or its corresponding type declarations.
import type { Randomizer } from '../../src/randomizer';
import type { Randomizer } from '../../src/utils/randomizer';

Check failure on line 7 in test/internal/mersenne.spec.ts

View workflow job for this annotation

GitHub Actions / TS-Check: node-22, ubuntu-latest

Cannot find module '../../src/utils/randomizer' or its corresponding type declarations.
import { seededRuns } from '../support/seeded-runs';
import { times } from '../support/times';
import {
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/apidocs/method.example.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Casing, ColorFormat } from '../../../src';
import { FakerError } from '../../../src/errors/faker-error';
import type { LiteralUnion } from '../../../src/internal/types';
import type { AlphaNumericChar } from '../../../src/modules/string';
import type { LiteralUnion } from '../../../src/utils/types';
// explicitly export types so they show up in the docs as decomposed types
export type { NumberColorFormat, StringColorFormat } from '../../../src';
export type { AlphaNumericChar, Casing, ColorFormat, LiteralUnion };
Expand Down
2 changes: 1 addition & 1 deletion test/support/seeded-runs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, describe as vi_describe, it as vi_it } from 'vitest';
import type { Faker } from '../../src/faker';
import type { Callable, MethodOf } from '../../src/utils/types';
import type { Callable, MethodOf } from '../../src/internal/types';

export const seededRuns = [42, 1337, 1211];

Expand Down
Loading