replace(dependency, source, definition, text) {
		const localModuleVar = this.localModuleVar(dependency);
		if (localModuleVar) {
			text = text.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$"));
			definition = definition.replace(
				/XXX/g,
				localModuleVar.replace(/\$/g, "$$$$")
			);
		}

		if (dependency.namedModule) {
			text = text.replace(/YYY/g, JSON.stringify(dependency.namedModule));
		}

		const texts = text.split("#");

		if (definition) source.insert(0, definition);

		let current = dependency.range[0];
		if (dependency.arrayRange) {
			source.replace(
				current,
				dependency.arrayRange[0] - 1,
				/** @type {string} */ (texts.shift())
			);
			current = dependency.arrayRange[1];
		}

		if (dependency.objectRange) {
			source.replace(
				current,
				dependency.objectRange[0] - 1,
				/** @type {string} */ (texts.shift())
			);
			current = dependency.objectRange[1];
		} else if (dependency.functionRange) {
			source.replace(
				current,
				dependency.functionRange[0] - 1,
				/** @type {string} */ (texts.shift())
			);
			current = dependency.functionRange[1];
		}
		source.replace(
			current,
			dependency.range[1] - 1,
			/** @type {string} */ (texts.shift())
		);
		if (texts.length > 0) throw new Error("Implementation error");
	}
@param {AMDDefineDependency} dependency dependency
@param {ReplaceSource} source source
@param {string} definition definition
@param {string} text text