Skip to content

Commit

Permalink
replace @jayfate/path with path (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: 72161674 <[email protected]>
  • Loading branch information
xingfujiang and 72161674 authored Jun 16, 2023
1 parent 4c3b44b commit 0c2f926
Show file tree
Hide file tree
Showing 73 changed files with 82 additions and 80 deletions.
2 changes: 1 addition & 1 deletion packages/hap-compiler/src/style/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

'use strict'
import path from '@jayfate/path'
import path from 'path'
import css from 'css'
import { compileOptionsObject } from '@hap-toolkit/shared-utils'
import { validate as validateDelaration, mightReferlocalResource } from './validator'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-compiler/src/style/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

'use strict'
import fs from 'fs'
import path from '@jayfate/path'
import path from 'path'
import css from 'css'
import cssWhat from 'css-what'
import { extend, compileOptionsObject } from '@hap-toolkit/shared-utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-compiler/src/template/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import { colorconsole, extend } from '@hap-toolkit/shared-utils'
import exp from './exp'
import styler from '../style'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-compiler/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// TODO duplicate of packager/src/common/utils.js
import fs from 'fs'
import path from '@jayfate/path'
import path from 'path'
import { globalConfig } from '@hap-toolkit/shared-utils'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-debugger/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import KoaRouter from 'koa-router'
import koaBody from 'koa-body'
import serve from 'koa-static'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-debugger/src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import fs from 'fs'

import qr from 'qr-image'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dev-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const process = require('process')
const fs = require('fs-extra')
const { spawn } = require('child_process')
const JSZip = require('jszip')
const path = require('@jayfate/path')
const path = require('path')
const glob = require('glob')

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/__tests__/loaders/app-loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

const path = require('@jayfate/path')
const path = require('path')
const { rowify } = require('hap-dev-utils')
const appLoader = require('../../lib/loaders/app-loader').default

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/__tests__/loaders/ux-loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

const path = require('@jayfate/path')
const path = require('path')
const { rowify } = require('hap-dev-utils')
const uxLoader = require('../../lib/loaders/ux-loader').default
const { compileOptionsObject } = require('@hap-toolkit/shared-utils')
Expand Down
6 changes: 2 additions & 4 deletions packages/hap-dsl-xvm/src/loaders/common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import loaderUtils from 'loader-utils'
import hash from 'hash-sum'
import { SourceMapGenerator, SourceMapConsumer } from 'source-map'
Expand Down Expand Up @@ -235,7 +235,5 @@ export function convertPath(filePath) {
if (/^[/\\]node_modules/.test(filePath)) {
pathBase = globalConfig.projectPath
}
return process.platform === 'win32'
? path.join(pathBase, filePath).replace(/\//g, '\\')
: path.join(pathBase, filePath)
return path.join(pathBase, filePath)
}
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/src/loaders/ux-fragment-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { sync as resolveSync } from 'resolve'
import path from '@jayfate/path'
import path from 'path'
import { globalConfig, compileOptionsObject } from '@hap-toolkit/shared-utils'
import { getBabelConfigJsPath } from '@hap-toolkit/packager'
import { ENTRY_TYPE, FRAG_TYPE, templater } from '@hap-toolkit/compiler'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/src/loaders/ux-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import loaderUtils from 'loader-utils'
import { parseFragmentsWithCache, ENTRY_TYPE, templater } from '@hap-toolkit/compiler'
import { globalConfig, compileOptionsObject } from '@hap-toolkit/shared-utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/src/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'

export const template = {
app: {
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/test/unit/func/part.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

const path = require('@jayfate/path')
const path = require('path')
const { resolveTestEntries, compileFiles } = require('../../utils')

describe('分包测试', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/test/unit/func/processImport.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


'use strict'
const path = require('@jayfate/path')
const path = require('path')
const { processImport } = require('@hap-toolkit/compiler')
const testCssDir = path.resolve(__dirname, '../../case/ux/Helloworld/Common')

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/test/unit/ux/card.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

const path = require('@jayfate/path')
const path = require('path')
const { wipeDynamic } = require('hap-dev-utils')
const { resolveTestEntries, compileFiles } = require('../../utils')

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/test/unit/ux/component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/


const path = require('@jayfate/path')
const path = require('path')
const { wipeDynamic } = require('hap-dev-utils')
const { resolveTestEntries, compileFiles } = require('../../utils')

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/test/unit/ux/sign.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'use strict'

const fs = require('fs')
const path = require('@jayfate/path')
const path = require('path')
const { mkdirsSync } = require('@hap-toolkit/shared-utils')
const { doSign } = require('@hap-toolkit/packager')

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/test/unit/ux/style.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/


const path = require('@jayfate/path')
const path = require('path')
const { wipeDynamic } = require('hap-dev-utils')
const { resolveTestEntries, compileFiles } = require('../../utils')

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/test/unit/ux/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/


const path = require('@jayfate/path')
const path = require('path')
const { wipeDynamic } = require('hap-dev-utils')
const { resolveTestEntries, compileFiles } = require('../../utils')

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

'use strict'

import path from '@jayfate/path'
import path from 'path'
import fs from 'fs-extra'
import glob from 'glob'
import del from 'del'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-dsl-xvm/test/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { sync as resolveSync } from 'resolve'
import path from '@jayfate/path'
import path from 'path'
import webpack from 'webpack'
import { ResourcePlugin, HandlerPlugin, ZipPlugin } from '@hap-toolkit/packager'
import { compileOptionsMeta } from '@hap-toolkit/shared-utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/common/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import fs from 'fs'
import path from '@jayfate/path'
import path from 'path'
import { readJson } from '@hap-toolkit/shared-utils'

export const name = {
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import fs from 'fs'
import path from '@jayfate/path'
import path from 'path'
import crypto from 'crypto'
import { sync as resolveSync } from 'resolve'

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/loaders/device-type-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import fs from 'fs'
import { getOptions } from 'loader-utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/loaders/manifest-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

'use strict'
import path from '@jayfate/path'
import path from 'path'
import fs from 'fs'
import loaderUtils from 'loader-utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/plugins/device-type-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import fs from 'fs'
import path from '@jayfate/path'
import path from 'path'
import { colorconsole } from '@hap-toolkit/shared-utils'
import { mergeDeep } from '../common/utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/plugins/resource-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import fs from 'fs-extra'
import aaptjs from '@hap-toolkit/aaptjs'
import glob from 'glob'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import Compilation from 'webpack/lib/Compilation'
import { getEntryFiles } from '../common/info'
import { compileOptionsMeta } from '@hap-toolkit/shared-utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/plugins/zip-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import fs from 'fs-extra'
import path from '@jayfate/path'
import path from 'path'
import {
colorconsole,
readJson,
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import fs from 'fs-extra'
import path from '@jayfate/path'
import path from 'path'
import qr from 'qr-image'
import moment from 'moment'

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/router/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import fs from 'fs'
import { colorconsole, getIPv4IPAddress, getClientIPAddress } from '@hap-toolkit/shared-utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/signature/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'

import { calcDataDigest } from '../common/utils'

Expand Down
6 changes: 3 additions & 3 deletions packages/hap-packager/src/subpackages/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import fs from 'fs'
import path from '@jayfate/path'
import path from 'path'

import { compileOptionsMeta } from '@hap-toolkit/shared-utils'
import { calcDataDigest } from '../common/utils'
Expand Down Expand Up @@ -77,7 +77,7 @@ function allocateResourceToPackages(files, base, fullPackage, subPackages, build

files.forEach((fileBuildPath) => {
const fileAbsPath = path.join(base, fileBuildPath)
const fileContentBuffer = fs.readFileSync(fileAbsPath)
const fileContentBuffer = fs.readFileSync(fileAbsPath.replace(/\\/g, '/'))
const fileContentDigest = calcDataDigest(fileContentBuffer)
// 资源基本信息
const resourceInfo = [fileBuildPath, fileContentBuffer, fileContentDigest]
Expand All @@ -95,7 +95,7 @@ function allocateResourceToPackages(files, base, fullPackage, subPackages, build
let belongToBasePkg = true

// 将base包的page-chunks.json文件放在包根路径,其余在分包目录下
if (fileBuildPath === basePageChunksJson) {
if (fileBuildPath === basePageChunksJson.replace(/\\/g, '/')) {
resourceInfo[0] = SPLIT_CHUNKS_PAGE_NAME
}

Expand Down
2 changes: 1 addition & 1 deletion packages/hap-packager/src/webpack.post.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import { sync as resolveSync } from 'resolve'
import {
globalConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-server/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'

// 路径
const pathToolkit = path.resolve(__dirname, '../../..')
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-server/src/preview/create-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import Koa from 'koa'
import mount from 'koa-mount'
import koaStatic from 'koa-static'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-server/src/preview/create-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import fs from 'fs'
import path from '@jayfate/path'
import path from 'path'
import { PassThrough } from 'stream'
import util from 'util'
import KoaRouter from 'koa-router'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-server/src/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import path from '@jayfate/path'
import path from 'path'
import mount from 'koa-mount'
import { globalConfig } from '@hap-toolkit/shared-utils'
import createPreview from './create-preview'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-server/src/preview/remote-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import crypto from 'crypto'
import chalk from 'chalk'
import path from '@jayfate/path'
import path from 'path'
import inquirer from 'inquirer'
import { enc, HmacSHA256, MD5 } from 'crypto-js'
import request from 'request'
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-server/src/preview/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import fs from 'fs'
import path from '@jayfate/path'
import path from 'path'
import util from 'util'
import { renderString } from '@hap-toolkit/shared-utils'

Expand Down
Loading

0 comments on commit 0c2f926

Please sign in to comment.