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: node imports #30

Closed
wants to merge 6 commits into from
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
4 changes: 2 additions & 2 deletions apps/docs/.vitepress/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'node:fs'
import path from 'node:path'
import fs from 'fs'
import path from 'path'

export const scanDir = (dir: string) => {
let res = fs.readdirSync(path.resolve(__dirname, `../${dir}`)).filter(item => !item.startsWith('.')) as string[]
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { resolve } = require("node:path");
const { resolve } = require("path");

const project = resolve(process.cwd(), "tsconfig.json");

Expand Down
5 changes: 2 additions & 3 deletions packages/safe-fs/src/__tests__/fs.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import fs from 'node:fs'
import path from 'node:path'

import fs from 'fs'
import { vol } from 'memfs'
import path from 'path'
import { beforeEach, describe, expect, it } from 'vitest'

import { createGetter } from '@/getter'
Expand Down
2 changes: 1 addition & 1 deletion packages/safe-fs/src/getter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from 'node:fs'
import fs from 'fs'

import PARAMS_TO_SANITIZE from '@/params'
import { sanitizePath } from '@/sanitizers'
Expand Down
2 changes: 1 addition & 1 deletion packages/safe-fs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @packageDocumentation
*/

import * as fs from 'node:fs'
import * as fs from 'fs'

import { createGetter } from '@/getter'

Expand Down
4 changes: 2 additions & 2 deletions packages/safe-fs/src/sanitizers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PathLike } from 'node:fs'
import path from 'node:path'
import { PathLike } from 'fs'
import path from 'path'

const LEADING_DOT_SLASH_REGEX = /^(\.\.(\/|\\|$))+/

Expand Down
2 changes: 1 addition & 1 deletion packages/safe-fs/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'node:path'
import path from 'path'

export default {
resolve: {
Expand Down
4 changes: 2 additions & 2 deletions packages/safe-fs/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { vi } from 'vitest'

vi.mock('node:fs', async () => {
vi.mock('fs', async () => {
const memfs: { fs: typeof fs } = await vi.importActual('memfs')

return {
Expand All @@ -10,7 +10,7 @@ vi.mock('node:fs', async () => {
}
})

vi.mock('node:fs/promises', async () => {
vi.mock('fs/promises', async () => {
const memfs: { fs: typeof fs } = await vi.importActual('memfs')

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/validators/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opengovsg/starter-kitty-validators",
"version": "1.2.7",
"version": "1.2.8",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
Expand Down
3 changes: 1 addition & 2 deletions packages/validators/src/__tests__/path.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from 'node:path'

import path from 'path'
import { describe, expect, it } from 'vitest'
import { ZodError } from 'zod'

Expand Down
3 changes: 1 addition & 2 deletions packages/validators/src/path/options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from 'node:path'

import path from 'path'
import { z } from 'zod'

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/validators/src/path/schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from 'node:path'

import path from 'path'
import { z } from 'zod'

import { ParsedPathValidatorOptions } from '@/path/options'
Expand Down
2 changes: 1 addition & 1 deletion packages/validators/src/path/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'node:path'
import path from 'path'

export const isSafePath = (absPath: string, basePath: string): boolean => {
// check for poison null bytes
Expand Down
2 changes: 1 addition & 1 deletion packages/validators/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'node:path'
import path from 'path'

export default {
resolve: {
Expand Down
Loading