extension-create 4.1.3 → 4.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.cjs +31 -4
- package/dist/module.d.ts +1 -0
- package/dist/steps/import-external-template.d.ts +3 -1
- package/dist/test-template-javascript/.extension-create.json +1 -1
- package/dist/test-template-javascript/STORE.md +1 -1
- package/dist/test-template-javascript/package.json +1 -1
- package/package.json +1 -1
package/dist/module.cjs
CHANGED
|
@@ -40,7 +40,9 @@ var __webpack_require__ = {};
|
|
|
40
40
|
var __webpack_exports__ = {};
|
|
41
41
|
__webpack_require__.r(__webpack_exports__);
|
|
42
42
|
__webpack_require__.d(__webpack_exports__, {
|
|
43
|
-
|
|
43
|
+
TEMPLATE_ALIASES: ()=>TEMPLATE_ALIASES,
|
|
44
|
+
extensionCreate: ()=>extensionCreate,
|
|
45
|
+
resolveTemplateAlias: ()=>resolveTemplateAlias
|
|
44
46
|
});
|
|
45
47
|
const external_node_path_namespaceObject = require("node:path");
|
|
46
48
|
const external_pintor_namespaceObject = require("pintor");
|
|
@@ -483,7 +485,7 @@ const NETWORK_TIMEOUT_MS = (()=>{
|
|
|
483
485
|
return Number.isFinite(raw) && raw > 0 ? raw : 60000;
|
|
484
486
|
})();
|
|
485
487
|
const CODELOAD_BASE = 'https://codeload.github.com/extension-js/examples/zip';
|
|
486
|
-
const DEFAULT_TEMPLATES_REF = '
|
|
488
|
+
const DEFAULT_TEMPLATES_REF = 'e6bee72ae08802f2f14048271fb93f76c10d6a37';
|
|
487
489
|
const BUNDLED_TEMPLATES = [
|
|
488
490
|
"javascript"
|
|
489
491
|
];
|
|
@@ -502,6 +504,26 @@ function resolveCatalogUrls(ref, overrideUrl) {
|
|
|
502
504
|
urls.push(`${CODELOAD_BASE}/refs/heads/${ref}`, `${CODELOAD_BASE}/refs/tags/${ref}`);
|
|
503
505
|
return urls;
|
|
504
506
|
}
|
|
507
|
+
const TEMPLATE_ALIASES = {
|
|
508
|
+
new: 'newtab',
|
|
509
|
+
'new-browser-flags': 'newtab-browser-flags',
|
|
510
|
+
'new-config-eslint': 'newtab-config-eslint',
|
|
511
|
+
'new-config-prettier': 'newtab-config-prettier',
|
|
512
|
+
'new-config-stylelint': 'newtab-config-stylelint',
|
|
513
|
+
'new-crypto': 'newtab-crypto',
|
|
514
|
+
'new-env': 'newtab-env',
|
|
515
|
+
'new-less': 'newtab-less',
|
|
516
|
+
'new-preact': 'newtab-preact',
|
|
517
|
+
'new-react': 'newtab-react',
|
|
518
|
+
'new-react-router': 'newtab-react-router',
|
|
519
|
+
'new-sass': 'newtab-sass',
|
|
520
|
+
'new-svelte': 'newtab-svelte',
|
|
521
|
+
"new-typescript": "newtab-typescript",
|
|
522
|
+
'new-vue': 'newtab-vue'
|
|
523
|
+
};
|
|
524
|
+
function resolveTemplateAlias(name) {
|
|
525
|
+
return Object.prototype.hasOwnProperty.call(TEMPLATE_ALIASES, name) ? TEMPLATE_ALIASES[name] : name;
|
|
526
|
+
}
|
|
505
527
|
class TemplateNotFoundError extends Error {
|
|
506
528
|
constructor(templateName, cause){
|
|
507
529
|
super(`template not found in catalog: ${templateName}`), _define_property(this, "templateName", void 0);
|
|
@@ -692,9 +714,10 @@ async function cleanupFailedImport(projectPath, ownsProjectDir, preExistingEntri
|
|
|
692
714
|
async function importExternalTemplate(projectPath, projectName, template, logger, options) {
|
|
693
715
|
const templateName = external_node_path_namespaceObject.basename(template);
|
|
694
716
|
const resolvedTemplate = template;
|
|
695
|
-
const resolvedTemplateName = templateName;
|
|
696
717
|
const isHttp = /^https?:\/\//i.test(template);
|
|
697
718
|
const isGithub = /^https?:\/\/github\.com\//i.test(template);
|
|
719
|
+
const isBareName = !isHttp && !template.includes('/') && !template.includes(external_node_path_namespaceObject.sep);
|
|
720
|
+
const resolvedTemplateName = isBareName ? resolveTemplateAlias(templateName) : templateName;
|
|
698
721
|
const dirExistedBeforeImport = (0, external_node_fs_namespaceObject.existsSync)(projectPath);
|
|
699
722
|
const ownsProjectDir = options?.ownsProjectDir ?? !dirExistedBeforeImport;
|
|
700
723
|
let preExistingEntries = [];
|
|
@@ -1960,9 +1983,13 @@ async function extensionCreate(projectNameInput, { cliVersion, template = "javas
|
|
|
1960
1983
|
templateProvenance
|
|
1961
1984
|
};
|
|
1962
1985
|
}
|
|
1986
|
+
exports.TEMPLATE_ALIASES = __webpack_exports__.TEMPLATE_ALIASES;
|
|
1963
1987
|
exports.extensionCreate = __webpack_exports__.extensionCreate;
|
|
1988
|
+
exports.resolveTemplateAlias = __webpack_exports__.resolveTemplateAlias;
|
|
1964
1989
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
1965
|
-
"
|
|
1990
|
+
"TEMPLATE_ALIASES",
|
|
1991
|
+
"extensionCreate",
|
|
1992
|
+
"resolveTemplateAlias"
|
|
1966
1993
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
1967
1994
|
Object.defineProperty(exports, '__esModule', {
|
|
1968
1995
|
value: true
|
package/dist/module.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ScaffoldPackageManager } from './lib/package-manager';
|
|
2
2
|
import { type TemplateProvenance } from './steps/import-external-template';
|
|
3
|
+
export { resolveTemplateAlias, TEMPLATE_ALIASES } from './steps/import-external-template';
|
|
3
4
|
export interface CreateLogger {
|
|
4
5
|
log: (...args: unknown[]) => void;
|
|
5
6
|
error: (...args: unknown[]) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const DEFAULT_TEMPLATES_REF = "
|
|
1
|
+
export declare const DEFAULT_TEMPLATES_REF = "e6bee72ae08802f2f14048271fb93f76c10d6a37";
|
|
2
2
|
export declare const BUNDLED_TEMPLATES: readonly string[];
|
|
3
3
|
export declare function resolveCatalogUrls(ref: string, overrideUrl?: string): string[];
|
|
4
4
|
export interface TemplateProvenance {
|
|
@@ -6,6 +6,8 @@ export interface TemplateProvenance {
|
|
|
6
6
|
source: string;
|
|
7
7
|
ref?: string;
|
|
8
8
|
}
|
|
9
|
+
export declare const TEMPLATE_ALIASES: Readonly<Record<string, string>>;
|
|
10
|
+
export declare function resolveTemplateAlias(name: string): string;
|
|
9
11
|
export declare class TemplateNotFoundError extends Error {
|
|
10
12
|
readonly templateName: string;
|
|
11
13
|
constructor(templateName: string, cause?: unknown);
|
|
@@ -9,7 +9,7 @@ Packaging your extension is local and free. Submitting the result to a
|
|
|
9
9
|
store is what [extension.dev](https://docs.extension.dev/publish/overview?utm_source=store-md)
|
|
10
10
|
does, and it sponsors Extension.js.
|
|
11
11
|
|
|
12
|
-
Last updated: 2026-08-
|
|
12
|
+
Last updated: 2026-08-22
|
|
13
13
|
|
|
14
14
|
## Listing
|
|
15
15
|
|