feat(shared): modularized package & node16 support (#2336)

* feat(shared): modularized package & node16 support

* lockfile update

* various fixes

* moar fixes

* added znv and zod as devdeps of shared

* lockfile update
This commit is contained in:
Kristaps Fabians Geikins
2024-06-11 14:12:13 +03:00
committed by GitHub
parent 6a524a704a
commit 2f8272b6ae
66 changed files with 360 additions and 177 deletions
+2
View File
@@ -71,3 +71,5 @@ kubeconfig
minio-data/
postgres-data/
redis-data/
.tshy-build
+2
View File
@@ -36,3 +36,5 @@ venv
**/generated/graphql.ts
storybook-static
.tshy
.tshy-build
+1 -1
View File
@@ -20,7 +20,7 @@ import {
incomingOverwritesExistingMergeFunction
} from '~~/lib/core/helpers/apolloSetup'
import { onError } from '@apollo/client/link/error'
import { Observability } from '@speckle/shared'
import * as Observability from '@speckle/shared/dist/esm/observability/index.js'
let subscriptionsStopped = false
const errorRpm = Observability.simpleRpmCounter()
+1 -1
View File
@@ -6,7 +6,7 @@ const { chunk } = require('lodash')
const { logger: parentLogger } = require('../observability/logging')
const knex = require('../knex')
const { Observability } = require('@speckle/shared')
const Observability = require('@speckle/shared/dist/commonjs/observability/index.js')
const Streams = () => knex('streams')
const Branches = () => knex('branches')
const Objects = () => knex('objects')
@@ -4,7 +4,7 @@ const { logger: parentLogger } = require('../observability/logging')
const TMP_RESULTS_PATH = '/tmp/import_result.json'
const { parseAndCreateCommit } = require('./index')
const { Observability } = require('@speckle/shared')
const Observability = require('@speckle/shared/dist/commonjs/observability/index.js')
async function main() {
const cmdArgs = process.argv.slice(2)
+1 -1
View File
@@ -2,7 +2,7 @@ const { performance } = require('perf_hooks')
const { fetch } = require('undici')
const Parser = require('./parser_v2')
const ServerAPI = require('./api.js')
const { Observability } = require('@speckle/shared')
const Observability = require('@speckle/shared/dist/commonjs/observability/index.js')
const { logger: parentLogger } = require('../observability/logging')
async function parseAndCreateCommit({
+1 -1
View File
@@ -7,7 +7,7 @@ const {
GeometryTypes,
IfcTypesMap
} = require('./utils')
const { Observability } = require('@speckle/shared')
const Observability = require('@speckle/shared/dist/commonjs/observability/index.js')
const { logger: parentLogger } = require('../observability/logging')
module.exports = class IFCParser {
@@ -1,4 +1,4 @@
const { Observability } = require('@speckle/shared')
const Observability = require('@speckle/shared/dist/commonjs/observability/index.js')
// loggers for specific components within normal operation
const logger = Observability.extendLoggerComponent(
@@ -16,7 +16,7 @@
</template>
<script setup lang="ts">
import { useQuery } from '@vue/apollo-composable'
import type { Optional } from '~~/../shared/dist-esm'
import type { Optional } from '@speckle/shared'
import { useProjectPageItemViewType } from '~~/lib/projects/composables/projectPages'
import { projectDiscussionsPageQuery } from '~~/lib/projects/graphql/queries'
@@ -1,5 +1,5 @@
import { useScopedState } from '~~/lib/common/composables/scopedState'
import { Observability } from '@speckle/shared'
import * as Observability from '@speckle/shared/dist/esm/observability/index'
import type {
AbstractErrorHandler,
AbstractErrorHandlerParams,
@@ -3,7 +3,8 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { Observability, type Optional } from '@speckle/shared'
import { type Optional } from '@speckle/shared'
import * as Observability from '@speckle/shared/dist/esm/observability/index'
import {
upperFirst,
get,
+1 -1
View File
@@ -2,7 +2,7 @@ import { join } from 'path'
import { withoutLeadingSlash } from 'ufo'
import { sanitizeFilePath } from 'mlly'
import { filename } from 'pathe/utils'
import { Environment } from '@speckle/shared'
import * as Environment from '@speckle/shared/dist/esm/environment/index'
// Copied out from nuxt vite-builder source to correctly build output chunk/entry/asset/etc file names
const buildOutputFileName = (chunkName: string) =>
+3 -1
View File
@@ -134,7 +134,9 @@
"type-fest": "^3.5.1",
"typescript": "^4.8.3",
"vue-tsc": "2.0.10",
"wait-on": "^6.0.1"
"wait-on": "^6.0.1",
"znv": "^0.4.0",
"zod": "^3.22.4"
},
"engines": {
"node": "^16.0.0"
+3 -1
View File
@@ -75,7 +75,9 @@ export default defineNuxtPlugin(async (nuxtApp) => {
}
// Set up logger
let logger: ReturnType<typeof import('@speckle/shared').Observability.getLogger>
let logger: ReturnType<
typeof import('@speckle/shared/dist/esm/observability/index').getLogger
>
const errorHandlers: AbstractErrorHandler[] = []
const unhandledErrorHandlers: AbstractUnhandledErrorHandler[] = []
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { Observability } from '@speckle/shared'
import * as Observability from '@speckle/shared/dist/esm/observability/index.js'
import type { IncomingMessage } from 'node:http'
import { get } from 'lodash-es'
import type { Logger } from 'pino'
@@ -1,4 +1,4 @@
import { Observability } from '@speckle/shared'
import * as Observability from '@speckle/shared/dist/esm/observability/index'
import Vue from 'vue'
const ENTER_STATE_AT_ERRORS_PER_MIN = 100
@@ -1,4 +1,4 @@
const { Observability } = require('@speckle/shared')
const Observability = require('@speckle/shared/dist/commonjs/observability/index.js')
// loggers for specific components within normal operation
const logger = Observability.extendLoggerComponent(
@@ -1,4 +1,3 @@
import './bootstrap'
import { LegacyViewer } from '@speckle/viewer'
import { DefaultViewerParams } from '@speckle/viewer'
// import { logger } from '../../observability/logging'
-3
View File
@@ -1,3 +0,0 @@
/** This is because of @speckle/shared imporing these, but we plan on improving this */
window.znv = {}
window.zod = {}
@@ -43,11 +43,6 @@ const config = {
}
]
},
externals: {
znv: 'znv',
zod: 'zod'
},
plugins: [
new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }),
new HtmlWebpackPlugin({
+1 -1
View File
@@ -20,7 +20,7 @@ The Speckle shared package exposes a `FeatureFlags` object, that contains all th
For any usecase that is not Nuxt based, the code below is the preferred way of using feature flags.
```typescript
import { Environment } from '@speckle/shared'
import { Environment } from '@speckle/shared/dist/commonjs/environment/index' // or @speckle/shared/environment, if supported
if (Environment.getFeatureFlags().FF_AUTOMATE_MODULE_ENABLED)
console.log("Hurray I'm enabled")
+2 -3
View File
@@ -1,7 +1,6 @@
// Note logging is imported by www & ts-www, prior to init() being called
// so we can't use local imports with '@' etc., as they aren't yet defined.
import { Observability } from '@speckle/shared'
export { Observability } from '@speckle/shared'
import * as Observability from '@speckle/shared/dist/commonjs/observability/index.js'
const { getLogger, extendLoggerComponent } = Observability
@@ -32,4 +31,4 @@ export const crossServerSyncLogger = extendLoggerComponent(logger, 'cross-server
export const automateLogger = extendLoggerComponent(logger, 'automate')
export type Logger = typeof logger
export { extendLoggerComponent }
export { extendLoggerComponent, Observability }
@@ -53,13 +53,8 @@ import { getGenericRedis } from '@/modules/core/index'
import { getUser } from '@/modules/core/repositories/users'
import { createAutomation as clientCreateAutomation } from '@/modules/automate/clients/executionEngine'
import { validateStreamAccess } from '@/modules/core/services/streams/streamAccessService'
import {
Automate,
Environment,
Roles,
isNullOrUndefined,
isNonNullable
} from '@speckle/shared'
import { Automate, Roles, isNullOrUndefined, isNonNullable } from '@speckle/shared'
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
import {
getBranchLatestCommits,
getBranchesByIds
@@ -108,7 +103,7 @@ import {
ExecutionEngineNetworkError
} from '@/modules/automate/errors/executionEngine'
const { FF_AUTOMATE_MODULE_ENABLED } = Environment.getFeatureFlags()
const { FF_AUTOMATE_MODULE_ENABLED } = getFeatureFlags()
export = (FF_AUTOMATE_MODULE_ENABLED
? {
+2 -2
View File
@@ -5,7 +5,6 @@ import {
onModelVersionCreate,
triggerAutomationRevisionRun
} from '@/modules/automate/services/trigger'
import { Environment } from '@speckle/shared'
import {
getActiveTriggerDefinitions,
getAutomationRunFullTriggers,
@@ -29,8 +28,9 @@ import {
} from '@/modules/automate/services/subscriptions'
import { setupRunFinishedTracking } from '@/modules/automate/services/tracking'
import authGithubAppRest from '@/modules/automate/rest/authGithubApp'
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
const { FF_AUTOMATE_MODULE_ENABLED } = Environment.getFeatureFlags()
const { FF_AUTOMATE_MODULE_ENABLED } = getFeatureFlags()
let quitListeners: Optional<() => void> = undefined
async function initScopes() {
@@ -35,9 +35,10 @@ import {
truncateAutomations
} from '@/test/speckle-helpers/automationHelper'
import { BasicTestStream, createTestStreams } from '@/test/speckle-helpers/streamHelper'
import { Automate, Environment, Roles } from '@speckle/shared'
import { Automate, Roles } from '@speckle/shared'
import { expect } from 'chai'
import { times } from 'lodash'
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
/**
* TODO: Extra test ideas
@@ -45,7 +46,7 @@ import { times } from 'lodash'
* - All of the Automation/Function/Run GQL resolvers
*/
const { FF_AUTOMATE_MODULE_ENABLED } = Environment.getFeatureFlags()
const { FF_AUTOMATE_MODULE_ENABLED } = getFeatureFlags()
const buildAutomationUpdate = () => {
const update = updateAutomation({
@@ -47,7 +47,8 @@ import {
storeAutomationToken
} from '@/modules/automate/repositories/automations'
import { beforeEachContext, truncateTables } from '@/test/hooks'
import { Automate, Environment } from '@speckle/shared'
import { Automate } from '@speckle/shared'
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
import {
getBranchLatestCommits,
getLatestStreamBranch
@@ -71,7 +72,7 @@ import {
import { buildDecryptor } from '@/modules/shared/utils/libsodium'
import { mapGqlStatusToDbStatus } from '@/modules/automate/utils/automateFunctionRunStatus'
const { FF_AUTOMATE_MODULE_ENABLED } = Environment.getFeatureFlags()
const { FF_AUTOMATE_MODULE_ENABLED } = getFeatureFlags()
;(FF_AUTOMATE_MODULE_ENABLED ? describe : describe.skip)(
'Automate triggers @automate',
@@ -1,6 +1,7 @@
import { Roles, Scopes, AllScopes as BaseAllScopes, Environment } from '@speckle/shared'
import { Roles, Scopes, AllScopes as BaseAllScopes } from '@speckle/shared'
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
const { FF_AUTOMATE_MODULE_ENABLED } = Environment.getFeatureFlags()
const { FF_AUTOMATE_MODULE_ENABLED } = getFeatureFlags()
const AllScopes = FF_AUTOMATE_MODULE_ENABLED
? BaseAllScopes
@@ -1,5 +1,5 @@
/* istanbul ignore file */
import { TIME } from '@/../shared/dist-esm'
import { TIME } from '@speckle/shared'
import {
createRateLimiterMiddleware,
getRateLimitResult,
+2 -3
View File
@@ -8,7 +8,7 @@ const { scalarResolvers } = require('./core/graph/scalars')
const { makeExecutableSchema } = require('@graphql-tools/schema')
const { moduleLogger } = require('@/logging/logging')
const { addMocksToSchema } = require('@graphql-tools/mock')
const { Environment } = require('@speckle/shared')
const { getFeatureFlags } = require('@/modules/shared/helpers/envHelper')
/**
* Cached speckle module requires
@@ -42,8 +42,7 @@ function autoloadFromDirectory(dirPath) {
}
const getEnabledModuleNames = () => {
const { FF_AUTOMATE_MODULE_ENABLED, FF_GENDOAI_MODULE_ENABLED } =
Environment.getFeatureFlags()
const { FF_AUTOMATE_MODULE_ENABLED, FF_GENDOAI_MODULE_ENABLED } = getFeatureFlags()
const moduleNames = [
'accessrequests',
'activitystream',
@@ -1,5 +1,6 @@
import { MisconfiguredEnvironmentError } from '@/modules/shared/errors'
import { trimEnd } from 'lodash'
import * as Environment from '@speckle/shared/dist/commonjs/environment/index.js'
export function isTestEnv() {
return process.env.NODE_ENV === 'test'
@@ -294,3 +295,5 @@ export function getGendoAIResponseKey() {
export function getGendoAIAPIEndpoint() {
return process.env.GENDOAI_API_ENDPOINT
}
export const getFeatureFlags = () => Environment.getFeatureFlags()
@@ -19,7 +19,7 @@ import {
import { getUser } from '@/modules/core/repositories/users'
import { Optional, wait } from '@speckle/shared'
import { mixpanel } from '@/modules/shared/utils/mixpanel'
import { Observability } from '@speckle/shared'
import * as Observability from '@speckle/shared/dist/commonjs/observability/index.js'
import { pino } from 'pino'
import { getIpFromRequest } from '@/modules/shared/utils/ip'
import { Netmask } from 'netmask'
+1 -1
View File
@@ -29,7 +29,7 @@
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"baseUrl": "./" /* Specify the base directory to resolve non-relative module names. */,
"paths": {
"@speckle/shared": ["../shared/dist-esm/index"],
"@speckle/shared": ["../shared/dist/esm/index"],
"@speckle/viewer": ["../viewer/dist/index"],
"@/*": ["./*"],
"#/*": ["./*"]
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "../src",
"module": "nodenext",
"moduleResolution": "nodenext"
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"extends": "./build.json",
"include": [
"../src/**/*.ts",
"../src/**/*.cts",
"../src/**/*.tsx"
],
"exclude": [
"../src/**/*.mts"
],
"compilerOptions": {
"outDir": "../.tshy-build/commonjs"
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"extends": "./build.json",
"include": [
"../src/**/*.ts",
"../src/**/*.mts",
"../src/**/*.tsx"
],
"exclude": [],
"compilerOptions": {
"outDir": "../.tshy-build/esm"
}
}
+66 -15
View File
@@ -8,13 +8,12 @@
"url": "https://github.com/specklesystems/speckle-server.git",
"directory": "packages/shared"
},
"main": "./dist-cjs/index.js",
"types": "./dist-esm/index.d.ts",
"module": "./dist-esm/index.js",
"type": "module",
"main": "./dist/commonjs/index.js",
"types": "./dist/commonjs/index.d.ts",
"scripts": {
"build": "NODE_ENV=production rollup --config",
"build:dev": "rollup --config",
"dev": "rollup --config --watch",
"build": "NODE_ENV=production tshy",
"dev": "tshy --watch",
"prepack": "yarn build",
"lint:eslint": "eslint . --ext .js,.ts",
"lint:tsc": "tsc --noEmit",
@@ -34,29 +33,81 @@
"dependencies": {
"lodash": "^4.17.0",
"lodash-es": "^4.17.21",
"type-fest": "^3.11.1",
"znv": "^0.4.0",
"zod": "^3.22.4"
"type-fest": "^3.11.1"
},
"peerDependencies": {
"@tiptap/core": "^2.0.0-beta.176",
"pino": "^8.7.0",
"pino-http": "^8.0.0",
"pino-pretty": ">=8.0.0"
"pino-pretty": ">=8.0.0",
"znv": "^0.4.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@tiptap/core": "^2.0.0-beta.176",
"@types/lodash": "^4.14.184",
"@types/lodash-es": "^4.17.12",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"pino": "^8.7.0",
"pino-http": "^8.0.0",
"rollup": "^2.79.1",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-typescript2": "^0.34.1",
"typescript": "^4.5.4"
"tshy": "^1.14.0",
"typescript": "^4.5.4",
"znv": "^0.4.0",
"zod": "^3.22.4"
},
"stableVersion": "0.1.0"
"stableVersion": "0.1.0",
"tshy": {
"exports": {
"./package.json": "./package.json",
"./pinoPrettyTransport.cjs": "./pinoPrettyTransport.cjs",
"./environment": "./src/environment/index.ts",
"./observability": "./src/observability/index.ts",
"./dist/*": "./dist/*",
".": "./src/index.ts"
}
},
"imports": {
"#lodash": {
"require": "lodash",
"import": "lodash-es"
}
},
"exports": {
"./package.json": "./package.json",
"./pinoPrettyTransport.cjs": "./pinoPrettyTransport.cjs",
"./environment": {
"import": {
"types": "./dist/esm/environment/index.d.ts",
"default": "./dist/esm/environment/index.js"
},
"require": {
"types": "./dist/commonjs/environment/index.d.ts",
"default": "./dist/commonjs/environment/index.js"
}
},
"./observability": {
"import": {
"types": "./dist/esm/observability/index.d.ts",
"default": "./dist/esm/observability/index.js"
},
"require": {
"types": "./dist/commonjs/observability/index.d.ts",
"default": "./dist/commonjs/observability/index.js"
}
},
"./dist/*": "./dist/*",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
}
}
+3
View File
@@ -14,6 +14,9 @@ Some dependencies are marked as peer dependencies, to ensure that package consum
import { Roles, RichTextEditor } from '@speckle/shared'
```
There are also "heavy" imports, that are not exported by default, like `@speckle/shared/environment`. These are used to avoid importing the whole package when only a small part of it is needed.
If export maps don't work (due to a legacy TS configuration) you can always import from `@speckle/shared/dist/**` directly
## Development
Do `yarn build` to build or `yarn dev` to build in watch mode
-36
View File
@@ -1,36 +0,0 @@
const clean = require('rollup-plugin-delete')
const pkg = require('./package.json')
const typescript2 = require('rollup-plugin-typescript2')
const isProd = process.env.NODE_ENV === 'production'
const sourcemap = isProd ? false : 'inline'
/** @type {import('rollup').RollupOptions} */
module.exports = {
input: 'src/index.ts',
output: [
{
file: 'dist-esm/index.js',
format: 'esm',
sourcemap
},
{
file: 'dist-cjs/index.js',
format: 'cjs',
sourcemap
}
],
plugins: [
clean({ targets: ['dist/*', 'dist-esm/*', 'dist-cjs/*'] }),
typescript2({
tsconfigOverride: {
sourceMap: sourcemap
}
})
],
// Externalizing all deps, we don't want to bundle them in cause this is a library
external: Object.keys({
...(pkg.dependencies || {}),
...(pkg.peerDependencies || {})
}).map((d) => new RegExp(`^${d}(\\/.*)?$`))
}
@@ -1,10 +1,10 @@
import { get, has, intersection, isArray, isNumber, isObjectLike } from 'lodash'
import { get, has, intersection, isArray, isNumber, isObjectLike } from '#lodash'
import type { PartialDeep } from 'type-fest'
import {
UnformattableResultsSchemaError,
UnformattableTriggerDefinitionSchemaError
} from '../errors'
import type { Nullable } from '../../core'
} from '../errors/index.js'
import type { Nullable } from '../../core/index.js'
export const TRIGGER_DEFINITIONS_SCHEMA_VERSION = 1.0
export const RESULTS_SCHEMA_VERSION = 1.0
+2 -2
View File
@@ -1,2 +1,2 @@
export * as AutomateTypes from './helpers/types'
export * from './errors/index'
export * as AutomateTypes from './helpers/types.js'
export * from './errors/index.js'
+1 -1
View File
@@ -1,4 +1,4 @@
import { flatMap } from 'lodash'
import { flatMap } from '#lodash'
/**
* Speckle role constants
+1 -1
View File
@@ -1,4 +1,4 @@
import { range } from 'lodash'
import { range } from '#lodash'
/**
* Utility for batching async operations. Useful when you have thousands of async operations and you can't
@@ -1,4 +1,4 @@
import { isSafari } from './os'
import { isSafari } from './os.js'
const shouldPolyfillIdleCallback = isSafari() || !globalThis.requestIdleCallback
+2 -2
View File
@@ -1,5 +1,5 @@
import { get } from 'lodash'
import type { Nullable } from './utilityTypes'
import { get } from '#lodash'
import type { Nullable } from './utilityTypes.js'
export enum OperatingSystem {
Windows = 'win',
+1 -1
View File
@@ -1,4 +1,4 @@
import { md5 } from '../utils/md5'
import { md5 } from '../utils/md5.js'
export function resolveMixpanelUserId(email: string): string {
return '@' + md5(email.toLowerCase()).toUpperCase()
+3 -3
View File
@@ -1,10 +1,10 @@
import { isNull, isNumber, isUndefined } from 'lodash'
import { isNull, isNumber, isUndefined } from '#lodash'
import type {
MaybeAsync,
NonNullableProperties,
NullableKeysToOptional
} from './utilityTypes'
import { ensureError } from './error'
} from './utilityTypes.js'
import { ensureError } from './error.js'
export class TimeoutError extends Error {}
export class WaitIntervalUntilCanceledError extends Error {}
@@ -1,4 +1,4 @@
import { isUndefined } from 'lodash'
import { isUndefined } from '#lodash'
export type Nullable<T> = T | null
export type Optional<T> = T | undefined
+12 -12
View File
@@ -1,12 +1,12 @@
export * from './constants'
export * from './helpers/batch'
export * from './helpers/error'
export * from './helpers/timeConstants'
export * from './helpers/utility'
export * from './helpers/utilityTypes'
export * from './helpers/tracking'
export * from './utils/localStorage'
export * from './utils/md5'
export * from './helpers/os'
export * from './helpers/optimization'
export * from './helpers/debugging'
export * from './constants.js'
export * from './helpers/batch.js'
export * from './helpers/error.js'
export * from './helpers/timeConstants.js'
export * from './helpers/utility.js'
export * from './helpers/utilityTypes.js'
export * from './helpers/tracking.js'
export * from './utils/localStorage.js'
export * from './utils/md5.js'
export * from './helpers/os.js'
export * from './helpers/optimization.js'
export * from './helpers/debugging.js'
@@ -1,4 +1,4 @@
import type { Nullable } from '../helpers/utilityTypes'
import type { Nullable } from '../helpers/utilityTypes.js'
function checkLocalStorageAvailability(): boolean {
try {
+4 -1
View File
@@ -13,7 +13,10 @@ function parseFeatureFlags() {
let parsedFlags: ReturnType<typeof parseFeatureFlags> | undefined
export function getFeatureFlags() {
export function getFeatureFlags(): {
FF_AUTOMATE_MODULE_ENABLED: boolean
FF_GENDOAI_MODULE_ENABLED: boolean
} {
if (!parsedFlags) parsedFlags = parseFeatureFlags()
return parsedFlags
}
+6 -6
View File
@@ -1,6 +1,6 @@
export * as RichTextEditor from './rich-text-editor'
export * as Observability from './observability'
export * as SpeckleViewer from './viewer'
export * as Environment from './environment'
export * as Automate from './automate'
export * from './core'
export * as RichTextEditor from './rich-text-editor/index.js'
// export * as Observability from './observability/index.js' // Import from @speckle/shared/dist/...
export * as SpeckleViewer from './viewer/index.js'
// export * as Environment from './environment/index.js' // Import from @speckle/shared/dist/...
export * as Automate from './automate/index.js'
export * from './core/index.js'
+3 -3
View File
@@ -1,6 +1,6 @@
import pino from 'pino'
import { pino } from 'pino'
import type { LoggerOptions } from 'pino'
import { toClef, clefLevels } from './pinoClef'
import { toClef, clefLevels } from './pinoClef.js'
let logger: pino.Logger
type MixinFn = (mergeObject: object, level: number) => object
@@ -37,7 +37,7 @@ export function getLogger(
if (pretty) {
pinoOptions.transport = {
target: '@speckle/shared/pinoPrettyTransport.js',
target: '@speckle/shared/pinoPrettyTransport.cjs',
options: {
colorize: true,
destination: 2, //stderr
@@ -1,6 +1,6 @@
import { trim, isNumber } from 'lodash'
import { trim, isNumber } from '#lodash'
import type { JSONContent } from '@tiptap/core'
import type { Optional } from '../../core/helpers/utilityTypes'
import type { Optional } from '../../core/helpers/utilityTypes.js'
/**
* Used to match URLs that can appear anywhere in a string, not perfect, but crafting a perfect
@@ -1 +1 @@
export * from './helpers'
export * from './helpers/index.js'
+1 -1
View File
@@ -1,4 +1,4 @@
import { uniq, uniqBy } from 'lodash'
import { uniq, uniqBy } from '#lodash'
export enum ViewerResourceType {
Model = 'Model',
+3 -3
View File
@@ -1,7 +1,7 @@
import { intersection, isObjectLike } from 'lodash'
import type { MaybeNullOrUndefined, Nullable } from '../../core/helpers/utilityTypes'
import { intersection, isObjectLike } from '#lodash'
import type { MaybeNullOrUndefined, Nullable } from '../../core/helpers/utilityTypes.js'
import type { PartialDeep } from 'type-fest'
import { UnformattableSerializedViewerStateError } from '../errors'
import { UnformattableSerializedViewerStateError } from '../errors/index.js'
enum MeasurementType {
PERPENDICULAR = 0,
+3 -3
View File
@@ -1,3 +1,3 @@
export * as ViewerRoute from './helpers/route'
export * as ViewerState from './helpers/state'
export * as ViewerErrors from './errors/index'
export * as ViewerRoute from './helpers/route.js'
export * as ViewerState from './helpers/state.js'
export * as ViewerErrors from './errors/index.js'
+2 -3
View File
@@ -24,9 +24,9 @@
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
/* Modules */
"module": "es2020" /* Specify what module code is generated. */,
"rootDir": "./src" /* Specify the root folder within your source files. */,
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
"module": "node16" /* Specify what module code is generated. */,
"moduleResolution": "node16" /* Specify how TypeScript looks up a file from a given module specifier. */,
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
@@ -72,7 +72,6 @@
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
"verbatimModuleSyntax": true,
/* Type Checking */
"strict": true /* Enable all strict type-checking options. */,
+7
View File
@@ -21,6 +21,12 @@
"main": "./dist/lib.cjs",
"module": "./dist/lib.js",
"types": "./dist/lib.d.ts",
"imports": {
"#lodash": {
"require": "lodash",
"import": "lodash-es"
}
},
"exports": {
".": {
"import": "./dist/lib.js",
@@ -65,6 +71,7 @@
"@storybook/vue3-vite": "^8.0.5",
"@types/eslint": "^8.4.5",
"@types/lodash": "^4.0.0",
"@types/lodash-es": "^4.17.12",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"@vitejs/plugin-vue": "^4.5.0",
@@ -97,7 +97,7 @@ import type { LayoutPageTabItem } from '~~/src/helpers/layout/components'
import { isClient } from '@vueuse/core'
import { ArrowLongRightIcon, ArrowLongLeftIcon } from '@heroicons/vue/24/outline'
import type { Nullable } from '@speckle/shared'
import { throttle } from 'lodash-es'
import { throttle } from '#lodash'
const props = defineProps<{
items: LayoutPageTabItem[]
+1 -1
View File
@@ -24,7 +24,7 @@
/* Extra */
"paths": {
"~~/src/*": ["./src/*"],
"@speckle/shared": ["../shared/dist-esm/index"]
"@speckle/shared": ["../shared/dist/esm/index"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
@@ -1,4 +1,4 @@
const { Observability } = require('@speckle/shared')
const Observability = require('@speckle/shared/dist/commonjs/observability/index.js')
const logger = Observability.extendLoggerComponent(
Observability.getLogger(
+2
View File
@@ -23,6 +23,7 @@ async function checkForPresence() {
// We can't properly require this package from a node environment, so as long as we
// get to the expected error, we at least know that the package is built and exists
if (!(e instanceof Error) || !e.message.includes('v3-infinite-loading')) {
console.log(e)
return false
}
}
@@ -31,6 +32,7 @@ async function checkForPresence() {
require('@speckle/tailwind-theme')
require('@speckle/shared')
} catch (e) {
console.log(e)
return false
}
+143 -22
View File
@@ -13818,6 +13818,8 @@ __metadata:
vue-tsc: 2.0.10
wait-on: ^6.0.1
ws: ^8.9.0
znv: ^0.4.0
zod: ^3.22.4
languageName: unknown
linkType: soft
@@ -14148,6 +14150,7 @@ __metadata:
dependencies:
"@tiptap/core": ^2.0.0-beta.176
"@types/lodash": ^4.14.184
"@types/lodash-es": ^4.17.12
"@typescript-eslint/eslint-plugin": ^5.59.0
"@typescript-eslint/parser": ^5.59.0
eslint: ^8.11.0
@@ -14156,9 +14159,7 @@ __metadata:
lodash-es: ^4.17.21
pino: ^8.7.0
pino-http: ^8.0.0
rollup: ^2.79.1
rollup-plugin-delete: ^2.0.0
rollup-plugin-typescript2: ^0.34.1
tshy: ^1.14.0
type-fest: ^3.11.1
typescript: ^4.5.4
znv: ^0.4.0
@@ -14168,6 +14169,8 @@ __metadata:
pino: ^8.7.0
pino-http: ^8.0.0
pino-pretty: ">=8.0.0"
znv: ^0.4.0
zod: ^3.22.4
languageName: unknown
linkType: soft
@@ -14231,6 +14234,7 @@ __metadata:
"@storybook/vue3-vite": ^8.0.5
"@types/eslint": ^8.4.5
"@types/lodash": ^4.0.0
"@types/lodash-es": ^4.17.12
"@typescript-eslint/eslint-plugin": ^5.38.1
"@typescript-eslint/parser": ^5.38.1
"@vitejs/plugin-vue": ^4.5.0
@@ -16771,7 +16775,7 @@ __metadata:
languageName: node
linkType: hard
"@types/lodash-es@npm:4.17.12":
"@types/lodash-es@npm:4.17.12, @types/lodash-es@npm:^4.17.12":
version: 4.17.12
resolution: "@types/lodash-es@npm:4.17.12"
dependencies:
@@ -27802,7 +27806,7 @@ __metadata:
languageName: node
linkType: hard
"foreground-child@npm:^3.1.0":
"foreground-child@npm:^3.1.0, foreground-child@npm:^3.1.1":
version: 3.1.1
resolution: "foreground-child@npm:3.1.1"
dependencies:
@@ -28549,6 +28553,21 @@ __metadata:
languageName: node
linkType: hard
"glob@npm:^10.2.6, glob@npm:^10.3.3, glob@npm:^10.3.7":
version: 10.4.1
resolution: "glob@npm:10.4.1"
dependencies:
foreground-child: ^3.1.0
jackspeak: ^3.1.2
minimatch: ^9.0.4
minipass: ^7.1.2
path-scurry: ^1.11.1
bin:
glob: dist/esm/bin.mjs
checksum: 5d33c686c80bf6877f4284adf99a8c3cbb2a6eccbc92342943fe5d4b42c01d78c1881f2223d950c92a938d0f857e12e37b86a8e5483ab2141822e053b67d0dde
languageName: node
linkType: hard
"glob@npm:^10.3.10":
version: 10.3.10
resolution: "glob@npm:10.3.10"
@@ -31270,6 +31289,19 @@ __metadata:
languageName: node
linkType: hard
"jackspeak@npm:^3.1.2":
version: 3.4.0
resolution: "jackspeak@npm:3.4.0"
dependencies:
"@isaacs/cliui": ^8.0.2
"@pkgjs/parseargs": ^0.11.0
dependenciesMeta:
"@pkgjs/parseargs":
optional: true
checksum: 350f6f311018bb175ffbe736b19c26ac0b134bb5a17a638169e89594eb0c24ab1c658ab3a2fda24ff63b3b19292e1a5ec19d2255bc526df704e8168d392bef85
languageName: node
linkType: hard
"jake@npm:^10.8.5":
version: 10.8.5
resolution: "jake@npm:10.8.5"
@@ -34742,6 +34774,15 @@ __metadata:
languageName: node
linkType: hard
"minimatch@npm:^9.0.4":
version: 9.0.4
resolution: "minimatch@npm:9.0.4"
dependencies:
brace-expansion: ^2.0.1
checksum: cf717f597ec3eed7dabc33153482a2e8d49f4fd3c26e58fd9c71a94c5029a0838728841b93f46bf1263b65a8010e2ee800d0dc9b004ab8ba8b6d1ec07cc115b5
languageName: node
linkType: hard
"minimatch@npm:~3.0.4":
version: 3.0.8
resolution: "minimatch@npm:3.0.8"
@@ -34891,6 +34932,13 @@ __metadata:
languageName: node
linkType: hard
"minipass@npm:^7.1.2":
version: 7.1.2
resolution: "minipass@npm:7.1.2"
checksum: 2bfd325b95c555f2b4d2814d49325691c7bee937d753814861b0b49d5edcda55cbbf22b6b6a60bb91eddac8668771f03c5ff647dcd9d0f798e9548b9cdc46ee3
languageName: node
linkType: hard
"minizlib@npm:^2.1.1, minizlib@npm:^2.1.2":
version: 2.1.2
resolution: "minizlib@npm:2.1.2"
@@ -35756,6 +35804,15 @@ __metadata:
languageName: node
linkType: hard
"mkdirp@npm:^3.0.1":
version: 3.0.1
resolution: "mkdirp@npm:3.0.1"
bin:
mkdirp: dist/cjs/src/bin.js
checksum: 972deb188e8fb55547f1e58d66bd6b4a3623bf0c7137802582602d73e6480c1c2268dcbafbfb1be466e00cc7e56ac514d7fd9334b7cf33e3e2ab547c16f83a8d
languageName: node
linkType: hard
"mlly@npm:^1.0.0":
version: 1.0.0
resolution: "mlly@npm:1.0.0"
@@ -38322,6 +38379,16 @@ __metadata:
languageName: node
linkType: hard
"path-scurry@npm:^1.11.1, path-scurry@npm:^1.9.2":
version: 1.11.1
resolution: "path-scurry@npm:1.11.1"
dependencies:
lru-cache: ^10.2.0
minipass: ^5.0.0 || ^6.0.2 || ^7.0.0
checksum: 890d5abcd593a7912dcce7cf7c6bf7a0b5648e3dee6caf0712c126ca0a65c7f3d7b9d769072a4d1baf370f61ce493ab5b038d59988688e0c5f3f646ee3c69023
languageName: node
linkType: hard
"path-scurry@npm:^1.7.0":
version: 1.7.0
resolution: "path-scurry@npm:1.7.0"
@@ -38889,6 +38956,13 @@ __metadata:
languageName: node
linkType: hard
"polite-json@npm:^4.0.1":
version: 4.0.1
resolution: "polite-json@npm:4.0.1"
checksum: 99ac929317d2869a3614cd41caa4d2d42fedbdb4569871d72f9ead41477d87f4b633bddf65fc03bdeb24c18b430b24df6c5c8e28b338ea31e86cddb665d1d896
languageName: node
linkType: hard
"popper.js@npm:^1.16.1":
version: 1.16.1
resolution: "popper.js@npm:1.16.1"
@@ -41845,6 +41919,16 @@ __metadata:
languageName: node
linkType: hard
"resolve-import@npm:^1.4.5":
version: 1.4.5
resolution: "resolve-import@npm:1.4.5"
dependencies:
glob: ^10.3.3
walk-up-path: ^3.0.1
checksum: 343e62e5c93e2b2870f390c20355a85987442702fda733b43f20f00bbe59f7a7d239188476c667838a31f8644d756f3a6729b5218ec4b80e5667963b318c89e2
languageName: node
linkType: hard
"resolve-path@npm:^1.4.0":
version: 1.4.0
resolution: "resolve-path@npm:1.4.0"
@@ -42106,6 +42190,17 @@ __metadata:
languageName: node
linkType: hard
"rimraf@npm:^5.0.1":
version: 5.0.7
resolution: "rimraf@npm:5.0.7"
dependencies:
glob: ^10.3.7
bin:
rimraf: dist/esm/bin.mjs
checksum: 884852abf8aefd4667448d87bdab04120a8641266c828cf382ac811713547eda18f81799d2146ffec3178f357d83d44ec01c10095949c82e23551660732bf14f
languageName: node
linkType: hard
"rimraf@npm:~2.4.0":
version: 2.4.5
resolution: "rimraf@npm:2.4.5"
@@ -42210,22 +42305,6 @@ __metadata:
languageName: node
linkType: hard
"rollup-plugin-typescript2@npm:^0.34.1":
version: 0.34.1
resolution: "rollup-plugin-typescript2@npm:0.34.1"
dependencies:
"@rollup/pluginutils": ^4.1.2
find-cache-dir: ^3.3.2
fs-extra: ^10.0.0
semver: ^7.3.7
tslib: ^2.4.0
peerDependencies:
rollup: ">=1.26.3"
typescript: ">=2.4.0"
checksum: 107e66b9ab1aaf4b237564e500ea9de9f2d3f0a81be5139dc753fc76bbf00a1a2230eb1ec59145d2dfc4c4da9be8211f1f3e1370007efe1e24ce45a00905e558
languageName: node
linkType: hard
"rollup-plugin-visualizer@npm:^5.12.0":
version: 5.12.0
resolution: "rollup-plugin-visualizer@npm:5.12.0"
@@ -42292,7 +42371,7 @@ __metadata:
languageName: node
linkType: hard
"rollup@npm:^2.70.1, rollup@npm:^2.79.1":
"rollup@npm:^2.70.1":
version: 2.79.1
resolution: "rollup@npm:2.79.1"
dependencies:
@@ -44434,6 +44513,20 @@ __metadata:
languageName: node
linkType: hard
"sync-content@npm:^1.0.2":
version: 1.0.2
resolution: "sync-content@npm:1.0.2"
dependencies:
glob: ^10.2.6
mkdirp: ^3.0.1
path-scurry: ^1.9.2
rimraf: ^5.0.1
bin:
sync-content: dist/mjs/bin.mjs
checksum: a3da9efefbf24bf8e1842f3bc7237675cabaf09ed91369cbcbc735356679371a1019c0294bdba4e5506a07b690d4a7958c902184a0d000409ac6ff4e6823dd7c
languageName: node
linkType: hard
"sync-fetch@npm:^0.4.0":
version: 0.4.1
resolution: "sync-fetch@npm:0.4.1"
@@ -45324,6 +45417,27 @@ __metadata:
languageName: node
linkType: hard
"tshy@npm:^1.14.0":
version: 1.14.0
resolution: "tshy@npm:1.14.0"
dependencies:
chalk: ^5.3.0
chokidar: ^3.6.0
foreground-child: ^3.1.1
minimatch: ^9.0.4
mkdirp: ^3.0.1
polite-json: ^4.0.1
resolve-import: ^1.4.5
rimraf: ^5.0.1
sync-content: ^1.0.2
typescript: ^5.4.5
walk-up-path: ^3.0.1
bin:
tshy: dist/esm/index.js
checksum: 73e092131b274f97e033a2c5111869766d7950dbeec8ef6de3b846582312e6434d60ef8bdc1d1ede1fd00ee7b669f52ddd2144bee9cdbce471f86c915971d864
languageName: node
linkType: hard
"tslib@npm:^2.3.1":
version: 2.4.0
resolution: "tslib@npm:2.4.0"
@@ -47966,6 +48080,13 @@ __metadata:
languageName: node
linkType: hard
"walk-up-path@npm:^3.0.1":
version: 3.0.1
resolution: "walk-up-path@npm:3.0.1"
checksum: 9ffca02fe30fb65f6db531260582988c5e766f4c739cf86a6109380a7f791236b5d0b92b1dce37a6f73e22dca6bc9d93bf3700413e16251b2bd6bbd1ca2be316
languageName: node
linkType: hard
"walker@npm:^1.0.7, walker@npm:^1.0.8":
version: 1.0.8
resolution: "walker@npm:1.0.8"