Skip to content

Commit

Permalink
fix: use js extensions instead of ts in imports (#1374)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema authored Nov 4, 2024
1 parent 9c1df34 commit ef61399
Show file tree
Hide file tree
Showing 84 changed files with 327 additions and 287 deletions.
8 changes: 4 additions & 4 deletions docs/src/components/sd-playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import '@shoelace-style/shoelace/dist/components/radio-button/radio-button.js';
import '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
import '@shoelace-style/shoelace/dist/components/select/select.js';
import '@shoelace-style/shoelace/dist/components/option/option.js';
import { bundle } from '../utils/rollup-bundle.ts';
import { changeLang, init, monaco } from '../monaco/monaco.ts';
import { analyzeDependencies } from '../utils/analyzeDependencies.ts';
import { bundle } from '../utils/rollup-bundle.js';
import { changeLang, init, monaco } from '../monaco/monaco.js';
import { analyzeDependencies } from '../utils/analyzeDependencies.js';
import { downloadZIP } from '../../../lib/utils/downloadFile.js';
import type SlRadioGroup from '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
import type { Config } from '../../../types/Config.ts';
import type { Config } from '../../../types/Config.js';

const defaults = {
tokens: {
Expand Down
4 changes: 2 additions & 2 deletions docs/src/monaco/monaco.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type * as monacoType from 'monaco-editor';
import darkTheme from './dark-theme';
import githubTheme from './github-light-theme';
import darkTheme from './dark-theme.js';
import githubTheme from './github-light-theme.js';

export let monaco: typeof monacoType;

Expand Down
2 changes: 1 addition & 1 deletion docs/src/setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dark from '@shoelace-style/shoelace/dist/themes/dark.css?raw' assert { type: 'css' };
import light from '@shoelace-style/shoelace/dist/themes/light.css?raw' assert { type: 'css' };
import mermaid from 'mermaid';
import { registeredComponents } from './components/sd-playground.ts';
import { registeredComponents } from './components/sd-playground.js';

type Theme = 'dark' | 'light';
type EnhancedCSSSheet = CSSStyleSheet & { theme?: boolean };
Expand Down
8 changes: 3 additions & 5 deletions docs/starlight-config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import type { StarlightUserConfig } from '@astrojs/starlight/types';
import starlightLinksValidator from 'starlight-links-validator'
import { pluginLanguageClass } from './expressive-code-plugin-language-class.ts';
import starlightLinksValidator from 'starlight-links-validator';
import { pluginLanguageClass } from './expressive-code-plugin-language-class.js';

export default {
plugins: [
starlightLinksValidator()
],
plugins: [starlightLinksValidator()],
expressiveCode: {
plugins: [
// Call the plugin initialization function inside the `plugins` array
Expand Down
16 changes: 8 additions & 8 deletions lib/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import filterBuiltins from './common/filters.js';
import { deepmerge } from './utils/deepmerge.js';

/**
* @typedef {import('../types/File.ts').FileHeader} FileHeader
* @typedef {import('../types/Parser.ts').Parser} Parser
* @typedef {import('../types/Preprocessor.ts').Preprocessor} Preprocessor
* @typedef {import('../types/Transform.ts').Transform} Transform
* @typedef {import('../types/Filter.ts').Filter} Filter
* @typedef {import('../types/Format.ts').Format} Format
* @typedef {import('../types/Action.ts').Action} Action
* @typedef {import('../types/Config.ts').Hooks} Hooks
* @typedef {import('../types/File.d.ts').FileHeader} FileHeader
* @typedef {import('../types/Parser.d.ts').Parser} Parser
* @typedef {import('../types/Preprocessor.d.ts').Preprocessor} Preprocessor
* @typedef {import('../types/Transform.d.ts').Transform} Transform
* @typedef {import('../types/Filter.d.ts').Filter} Filter
* @typedef {import('../types/Format.d.ts').Format} Format
* @typedef {import('../types/Action.d.ts').Action} Action
* @typedef {import('../types/Config.d.ts').Hooks} Hooks
*/

/**
Expand Down
28 changes: 14 additions & 14 deletions lib/StyleDictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ import cleanActions from './cleanActions.js';
import { isNode } from './utils/isNode.js';

/**
* @typedef {import('../types/Volume.ts').Volume} Volume
* @typedef {import('../types/Config.ts').Config} Config
* @typedef {import('../types/Config.ts').PlatformConfig} PlatformConfig
* @typedef {import('../types/Config.ts').LogConfig} LogConfig
* @typedef {import('../types/Config.ts').Expand} Expand
* @typedef {import('../types/Config.ts').ExpandConfig} ExpandConfig
* @typedef {import('../types/File.ts').File} File
* @typedef {import('../types/Filter.ts').Filter} Filter
* @typedef {import('../types/DesignToken.ts').DesignToken} Token
* @typedef {import('../types/DesignToken.ts').TransformedToken} TransformedToken
* @typedef {import('../types/DesignToken.ts').DesignTokens} Tokens
* @typedef {import('../types/DesignToken.ts').PreprocessedTokens} PreprocessedTokens
* @typedef {import('../types/DesignToken.ts').TransformedTokens} TransformedTokens
* @typedef {import('../types/DesignToken.ts').Dictionary} Dictionary
* @typedef {import('../types/Volume.d.ts').Volume} Volume
* @typedef {import('../types/Config.d.ts').Config} Config
* @typedef {import('../types/Config.d.ts').PlatformConfig} PlatformConfig
* @typedef {import('../types/Config.d.ts').LogConfig} LogConfig
* @typedef {import('../types/Config.d.ts').Expand} Expand
* @typedef {import('../types/Config.d.ts').ExpandConfig} ExpandConfig
* @typedef {import('../types/File.d.ts').File} File
* @typedef {import('../types/Filter.d.ts').Filter} Filter
* @typedef {import('../types/DesignToken.d.ts').DesignToken} Token
* @typedef {import('../types/DesignToken.d.ts').TransformedToken} TransformedToken
* @typedef {import('../types/DesignToken.d.ts').DesignTokens} Tokens
* @typedef {import('../types/DesignToken.d.ts').PreprocessedTokens} PreprocessedTokens
* @typedef {import('../types/DesignToken.d.ts').TransformedTokens} TransformedTokens
* @typedef {import('../types/DesignToken.d.ts').Dictionary} Dictionary
*/

const PROPERTY_VALUE_COLLISIONS = GroupMessages.GROUP.PropertyValueCollisions;
Expand Down
8 changes: 4 additions & 4 deletions lib/cleanActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
import { fs } from 'style-dictionary/fs';

/**
* @typedef {import('../types/Volume.ts').Volume} Volume
* @typedef {import('../types/DesignToken.ts').Dictionary} Dictionary
* @typedef {import('../types/Config.ts').PlatformConfig} PlatformConfig
* @typedef {import('../types/Config.ts').Config} Config
* @typedef {import('../types/Volume.d.ts').Volume} Volume
* @typedef {import('../types/DesignToken.d.ts').Dictionary} Dictionary
* @typedef {import('../types/Config.d.ts').PlatformConfig} PlatformConfig
* @typedef {import('../types/Config.d.ts').Config} Config
*/

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/cleanDir.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { dirname } from 'path-unified';
import { fs } from 'style-dictionary/fs';

/**
* @typedef {import('../types/Volume.ts').Volume} Volume
* @typedef {import('../types/Config.ts').PlatformConfig} Config
* @typedef {import('../types/File.ts').File} File
* @typedef {import('../types/Volume.d.ts').Volume} Volume
* @typedef {import('../types/Config.d.ts').PlatformConfig} Config
* @typedef {import('../types/File.d.ts').File} File
*/

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/cleanDirs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import cleanDir from './cleanDir.js';

/**
* @typedef {import('../types/Volume.ts').Volume} Volume
* @typedef {import('../types/Config.ts').PlatformConfig} Config
* @typedef {import('../types/Volume.d.ts').Volume} Volume
* @typedef {import('../types/Config.d.ts').PlatformConfig} Config
*/

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/cleanFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import chalk from 'chalk';
import { fs } from 'style-dictionary/fs';

/**
* @typedef {import('../types/Volume.ts').Volume} Volume
* @typedef {import('../types/File.ts').File} File
* @typedef {import('../types/Config.ts').PlatformConfig} PlatformConfig
* @typedef {import('../types/Volume.d.ts').Volume} Volume
* @typedef {import('../types/File.d.ts').File} File
* @typedef {import('../types/Config.d.ts').PlatformConfig} PlatformConfig
*/

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/cleanFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import cleanFile from './cleanFile.js';

/**
* @typedef {import('../types/Volume.ts').Volume} Volume
* @typedef {import('../types/Config.ts').PlatformConfig} PlatformConfig
* @typedef {import('../types/Volume.d.ts').Volume} Volume
* @typedef {import('../types/Config.d.ts').PlatformConfig} PlatformConfig
*/

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/common/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import { fs } from 'style-dictionary/fs';

/**
* @typedef {import('../../types/DesignToken.ts').Dictionary} Dictionary
* @typedef {import('../../types/Action.ts').Action} Action
* @typedef {import('../../types/DesignToken.d.ts').Dictionary} Dictionary
* @typedef {import('../../types/Action.d.ts').Action} Action
* @typedef {import('../../types/Config.js').PlatformConfig} Config
* @typedef {import('../../types/DesignToken.ts').TransformedToken} Token
* @typedef {import('../../types/DesignToken.d.ts').TransformedToken} Token
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/common/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

/**
* @typedef {import('../../types/Filter.ts').Filter} Filter
* @typedef {import('../../types/Filter.d.ts').Filter} Filter
*/

/**
Expand Down
10 changes: 5 additions & 5 deletions lib/common/formatHelpers/createPropertyFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { getReferences } from '../../utils/references/getReferences.js';
import usesReferences from '../../utils/references/usesReferences.js';

/**
* @typedef {import('../../../types/DesignToken.ts').TransformedToken} TransformedToken
* @typedef {import('../../../types/DesignToken.ts').Dictionary} Dictionary
* @typedef {import('../../../types/File.ts').FormattingOptions} Formatting
* @typedef {import('../../../types/Format.ts').OutputReferences} OutputReferences
* @typedef {import('../../../types/DesignToken.d.ts').TransformedToken} TransformedToken
* @typedef {import('../../../types/DesignToken.d.ts').Dictionary} Dictionary
* @typedef {import('../../../types/File.d.ts').FormattingOptions} Formatting
* @typedef {import('../../../types/Format.d.ts').OutputReferences} OutputReferences
*/

/**
Expand Down Expand Up @@ -116,7 +116,7 @@ export function addComment(to_ret_token, comment, options) {
* @param {Formatting} [options.formatting] - Custom formatting properties that define parts of a declaration line in code. The configurable strings are: `prefix`, `indentation`, `separator`, `suffix`, `lineSeparator`, `fileHeaderTimestamp`, `header`, `footer`, `commentStyle` and `commentPosition`. Those are used to generate a line like this: `${indentation}${prefix}${token.name}${separator} ${prop.value}${suffix}`. The remaining formatting options are used for the fileHeader helper.
* @param {boolean} [options.themeable] [false] - Whether tokens should default to being themeable.
* @param {boolean} [options.usesDtcg] [false] - Whether DTCG token syntax should be uses.
* @returns {(token: import('../../../types/DesignToken.ts').TransformedToken) => string}
* @returns {(token: import('../../../types/DesignToken.d.ts').TransformedToken) => string}
*/
export default function createPropertyFormatter({
outputReferences = false,
Expand Down
8 changes: 4 additions & 4 deletions lib/common/formatHelpers/fileHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

/**
*
* @typedef {import('../../../types/File.ts').File} File
* @typedef {import('../../../types/File.ts').FileHeader} FileHeader
* @typedef {import('../../../types/File.ts').FormattingOptions} Formatting
* @typedef {import('../../../types/Config.ts').Config} Config
* @typedef {import('../../../types/File.d.ts').File} File
* @typedef {import('../../../types/File.d.ts').FileHeader} FileHeader
* @typedef {import('../../../types/File.d.ts').FormattingOptions} Formatting
* @typedef {import('../../../types/Config.d.ts').Config} Config
*/

const lineSeparator = `\n`;
Expand Down
10 changes: 5 additions & 5 deletions lib/common/formatHelpers/formattedVariables.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import createPropertyFormatter from './createPropertyFormatter.js';
import sortByReference from './sortByReference.js';

/**
* @typedef {import('../../../types/DesignToken.ts').TransformedToken} Token
* @typedef {import('../../../types/DesignToken.ts').TransformedTokens} Tokens
* @typedef {import('../../../types/File.ts').FormattingOptions} Formatting
* @typedef {import('../../../types/Format').OutputReferences} OutputReferences
* @typedef {import('../../../types/DesignToken.ts').Dictionary} Dictionary
* @typedef {import('../../../types/DesignToken.d.ts').TransformedToken} Token
* @typedef {import('../../../types/DesignToken.d.ts').TransformedTokens} Tokens
* @typedef {import('../../../types/File.d.ts').FormattingOptions} Formatting
* @typedef {import('../../../types/Format.d.ts').OutputReferences} OutputReferences
* @typedef {import('../../../types/DesignToken.d.ts').Dictionary} Dictionary
*/

const defaultFormatting = {
Expand Down
4 changes: 2 additions & 2 deletions lib/common/formatHelpers/getTypeScriptType.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*/

/**
* @typedef {import('../../../types/Config.ts').LocalOptions} Options
* @typedef {import('../../../types/Config.ts').Config} Config
* @typedef {import('../../../types/Config.d.ts').LocalOptions} Options
* @typedef {import('../../../types/Config.d.ts').Config} Config
*/

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/common/formatHelpers/iconsWithPrefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*/

/**
* @typedef {import('../../../types/DesignToken.ts').TransformedToken} Token
* @typedef {import('../../../types/Config.ts').Config} Options
* @typedef {import('../../../types/Config.ts').PlatformConfig} PlatformConfig
* @typedef {import('../../../types/DesignToken.d.ts').TransformedToken} Token
* @typedef {import('../../../types/Config.d.ts').Config} Options
* @typedef {import('../../../types/Config.d.ts').PlatformConfig} PlatformConfig
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/common/formatHelpers/minifyDictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

/**
* @typedef {import('../../../types/DesignToken.ts').TransformedTokens} Tokens
* @typedef {import('../../../types/DesignToken.d.ts').TransformedTokens} Tokens
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/common/formatHelpers/setComposeObjectProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

/**
* @typedef {import('../../../types/Config.ts').LocalOptions} Options
* @typedef {import('../../../types/Config.d.ts').LocalOptions} Options
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/common/formatHelpers/setSwiftFileProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

/**
* @typedef {import('../../../types/Config.ts').LocalOptions} Options
* @typedef {import('../../../types/Config.d.ts').LocalOptions} Options
*/

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/common/formatHelpers/sortByReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import usesReferences from '../../utils/references/usesReferences.js';
import { getReferences } from '../../utils/references/getReferences.js';

/**
* @typedef {import('../../../types/DesignToken.ts').TransformedTokens} Tokens
* @typedef {import('../../../types/DesignToken.ts').TransformedToken} Token
* @typedef {import('../../../types/DesignToken.d.ts').TransformedTokens} Tokens
* @typedef {import('../../../types/DesignToken.d.ts').TransformedToken} Token
*/

const A_COMES_FIRST = -1;
Expand Down
14 changes: 7 additions & 7 deletions lib/common/formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ import macrosTemplate from './templates/ios/macros.template.js';
import plistTemplate from './templates/ios/plist.template.js';

/**
* @typedef {import('../../types/Format.ts').Format} Format
* @typedef {import('../../types/Format.ts').FormatFnArguments} FormatArgs
* @typedef {import('../../types/File').FormattingOverrides} FormattingOverrides
* @typedef {import('../../types/Format.ts').OutputReferences} OutputReferences
* @typedef {import('../../types/DesignToken.ts').TransformedToken} Token
* @typedef {import('../../types/DesignToken.ts').TransformedTokens} Tokens
* @typedef {import('../../types/Format.d.ts').Format} Format
* @typedef {import('../../types/Format.d.ts').FormatFnArguments} FormatArgs
* @typedef {import('../../types/File.d.ts').FormattingOverrides} FormattingOverrides
* @typedef {import('../../types/Format.d.ts').OutputReferences} OutputReferences
* @typedef {import('../../types/DesignToken.d.ts').TransformedToken} Token
* @typedef {import('../../types/DesignToken.d.ts').TransformedTokens} Tokens
*/

/**
Expand Down Expand Up @@ -668,7 +668,7 @@ const formats = {
return type;
}

// TODO: find a browser+node compatible way to read from '../../types/DesignToken.ts'
// TODO: find a browser+node compatible way to read from '../../types/DesignToken.d.ts'
const designTokenInterface = `interface DesignToken {
${options.usesDtcg ? '$' : ''}value?: any;
${options.usesDtcg ? '$' : ''}type?: string;
Expand Down
6 changes: 3 additions & 3 deletions lib/common/templates/android/colors.template.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @typedef {import('../../../../types/DesignToken.ts').Dictionary} Dictionary
* @typedef {import('../../../../types/Config.ts').Config} Config
* @typedef {import('../../../../types/Config.ts').LocalOptions} LocalOptions
* @typedef {import('../../../../types/DesignToken.d.ts').Dictionary} Dictionary
* @typedef {import('../../../../types/Config.d.ts').Config} Config
* @typedef {import('../../../../types/Config.d.ts').LocalOptions} LocalOptions
*/

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/common/templates/android/dimens.template.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @typedef {import('../../../../types/DesignToken.ts').Dictionary} Dictionary
* @typedef {import('../../../../types/Config.ts').Config} Config
* @typedef {import('../../../../types/Config.ts').LocalOptions} LocalOptions
* @typedef {import('../../../../types/DesignToken.d.ts').Dictionary} Dictionary
* @typedef {import('../../../../types/Config.d.ts').Config} Config
* @typedef {import('../../../../types/Config.d.ts').LocalOptions} LocalOptions
*/

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/common/templates/android/fontDimens.template.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @typedef {import('../../../../types/DesignToken.ts').Dictionary} Dictionary
* @typedef {import('../../../../types/Config.ts').Config} Config
* @typedef {import('../../../../types/Config.ts').LocalOptions} LocalOptions
* @typedef {import('../../../../types/DesignToken.d.ts').Dictionary} Dictionary
* @typedef {import('../../../../types/Config.d.ts').Config} Config
* @typedef {import('../../../../types/Config.d.ts').LocalOptions} LocalOptions
*/

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/common/templates/android/integers.template.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @typedef {import('../../../../types/DesignToken.ts').Dictionary} Dictionary
* @typedef {import('../../../../types/Config.ts').Config} Config
* @typedef {import('../../../../types/Config.ts').LocalOptions} LocalOptions
* @typedef {import('../../../../types/DesignToken.d.ts').Dictionary} Dictionary
* @typedef {import('../../../../types/Config.d.ts').Config} Config
* @typedef {import('../../../../types/Config.d.ts').LocalOptions} LocalOptions
*/

/**
Expand Down
Loading

0 comments on commit ef61399

Please sign in to comment.